feat(types): Resolve strict mypy errors in conductor subsystem
This commit is contained in:
@@ -5,6 +5,7 @@ import mma_prompts
|
||||
import aggregate
|
||||
import summarize
|
||||
from pathlib import Path
|
||||
from typing import Any, Optional
|
||||
|
||||
CONDUCTOR_PATH: Path = Path("conductor")
|
||||
|
||||
@@ -53,7 +54,7 @@ def get_track_history_summary() -> str:
|
||||
return "No previous tracks found."
|
||||
return "\n".join(summary_parts)
|
||||
|
||||
def generate_tracks(user_request: str, project_config: dict, file_items: list[dict], history_summary: str = None) -> list[dict]:
|
||||
def generate_tracks(user_request: str, project_config: dict[str, Any], file_items: list[dict[str, Any]], history_summary: Optional[str] = None) -> list[dict[str, Any]]:
|
||||
"""
|
||||
Tier 1 (Strategic PM) call.
|
||||
Analyzes the project state and user request to generate a list of Tracks.
|
||||
@@ -72,7 +73,7 @@ def generate_tracks(user_request: str, project_config: dict, file_items: list[di
|
||||
user_message = "\n".join(user_message_parts)
|
||||
# Set custom system prompt for this call
|
||||
old_system_prompt = ai_client._custom_system_prompt
|
||||
ai_client.set_custom_system_prompt(system_prompt)
|
||||
ai_client.set_custom_system_prompt(system_prompt or "")
|
||||
try:
|
||||
# 3. Call Tier 1 Model (Strategic - Pro)
|
||||
# Note: We use gemini-1.5-pro or similar high-reasoning model for Tier 1
|
||||
@@ -89,7 +90,7 @@ def generate_tracks(user_request: str, project_config: dict, file_items: list[di
|
||||
json_match = json_match.split("```json")[1].split("```")[0].strip()
|
||||
elif "```" in json_match:
|
||||
json_match = json_match.split("```")[1].split("```")[0].strip()
|
||||
tracks = json.loads(json_match)
|
||||
tracks: list[dict[str, Any]] = json.loads(json_match)
|
||||
# Ensure each track has a 'title' for the GUI
|
||||
for t in tracks:
|
||||
if "title" not in t:
|
||||
@@ -101,7 +102,7 @@ def generate_tracks(user_request: str, project_config: dict, file_items: list[di
|
||||
return []
|
||||
finally:
|
||||
# Restore old system prompt
|
||||
ai_client.set_custom_system_prompt(old_system_prompt)
|
||||
ai_client.set_custom_system_prompt(old_system_prompt or "")
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Quick CLI test
|
||||
|
||||
Reference in New Issue
Block a user