feat(personas): Add persona_id support to Ticket/WorkerContext and ConductorEngine
This commit is contained in:
@@ -295,7 +295,8 @@ class ConductorEngine:
|
||||
ticket_id=ticket.id,
|
||||
model_name=model_name,
|
||||
messages=[],
|
||||
tool_preset=self.tier_usage["Tier 3"]["tool_preset"]
|
||||
tool_preset=self.tier_usage["Tier 3"]["tool_preset"],
|
||||
persona_id=ticket.persona_id
|
||||
)
|
||||
context_files = ticket.context_requirements if ticket.context_requirements else None
|
||||
|
||||
@@ -410,6 +411,22 @@ def run_worker_lifecycle(ticket: Ticket, context: WorkerContext, context_files:
|
||||
ai_client.set_provider(ai_client.get_provider(), context.model_name)
|
||||
ai_client.set_tool_preset(context.tool_preset)
|
||||
|
||||
# Apply Persona if specified
|
||||
if context.persona_id:
|
||||
from src.personas import PersonaManager
|
||||
from src import paths
|
||||
pm = PersonaManager(Path(paths.get_project_personas_path(Path.cwd())) if paths.get_project_personas_path(Path.cwd()).exists() else None)
|
||||
try:
|
||||
personas = pm.load_all()
|
||||
if context.persona_id in personas:
|
||||
persona = personas[context.persona_id]
|
||||
if persona.system_prompt:
|
||||
ai_client.set_custom_system_prompt(persona.system_prompt)
|
||||
if persona.bias_profile:
|
||||
ai_client.set_bias_profile(persona.bias_profile)
|
||||
except Exception as e:
|
||||
print(f"[WARN] Failed to load persona {context.persona_id}: {e}")
|
||||
|
||||
# Check for abort BEFORE any major work
|
||||
if engine and hasattr(engine, "_abort_events"):
|
||||
abort_event = engine._abort_events.get(ticket.id)
|
||||
|
||||
Reference in New Issue
Block a user