refactor(orchestrator_pm): migrate to send_result() (G2, public_api_migration_and_ui_polish_20260615 Phase 1.2)
Replaces deprecated ai_client.send(md_content='', user_message=user_message, enable_tools=False) with ai_client.send_result(...) and branches on result.ok. On error, logs the ui_message() and returns [] (the function returns a list of track definitions or [] on failure). The 3 tests in test_orchestrator_pm.py + 1 in test_orchestrator_pm_history.py now fail because they mock src.ai_client.send. These will be fixed in Phase 2.14-2.15 by mocking send_result instead.
This commit is contained in:
@@ -83,11 +83,17 @@ def generate_tracks(user_request: str, project_config: dict[str, Any], file_item
|
||||
try:
|
||||
# 3. Call Tier 1 Model (Strategic - Pro)
|
||||
# Note: We use gemini-1.5-pro or similar high-reasoning model for Tier 1
|
||||
response = ai_client.send(
|
||||
result = ai_client.send_result(
|
||||
md_content="", # We pass everything in user_message for clarity
|
||||
user_message=user_message,
|
||||
enable_tools=False,
|
||||
)
|
||||
if not result.ok:
|
||||
_err = result.errors[0] if result.errors else None
|
||||
_msg = _err.ui_message() if _err else "unknown error"
|
||||
print(f"[orchestrator_pm] send_result failed: {_msg}")
|
||||
return []
|
||||
response = result.data
|
||||
# 4. Parse JSON Output
|
||||
try:
|
||||
# The prompt asks for a JSON array. We need to extract it if the AI added markdown blocks.
|
||||
|
||||
Reference in New Issue
Block a user