Add function_id tracking and enable JSON mode for all AI functions

This commit is contained in:
Gitea Deploy
2025-11-10 06:28:34 +00:00
parent c4c953fae2
commit 38324aedcd
17 changed files with 544 additions and 113 deletions

View File

@@ -82,11 +82,15 @@ class AIEngine:
ai_core = AICore(account=self.account)
function_name = fn.get_name()
# Generate function_id for tracking (ai-{function_name}-01)
function_id = f"ai-{function_name}-01"
# Get model config from settings (Stage 4 requirement)
model_config = get_model_config(function_name)
model = model_config.get('model')
self.console_tracker.ai_call(f"Calling {model or 'default'} model with {len(prompt)} char prompt")
self.console_tracker.ai_call(f"Function ID: {function_id}")
# Track AI call start
self.step_tracker.add_response_step("AI_CALL", "success", f"Calling {model or 'default'} model...")
@@ -102,6 +106,7 @@ class AIEngine:
temperature=model_config.get('temperature'),
response_format=model_config.get('response_format'),
function_name=function_name,
function_id=function_id, # Pass function_id for tracking
tracker=self.console_tracker # Pass console tracker for logging
)
except Exception as e: