fix(agent): /api/agent/run defaults to live when OPENROUTER_API_KEY is configured (was always mock)

This commit is contained in:
Torres
2026-11-12 09:38:00 -04:00
parent 44202c3679
commit 5226ec4819

View File

@@ -633,7 +633,9 @@ def create_app(db_path, img_dir, state_dir=None):
@app.post('/api/agent/run')
def agent_run(body: dict):
source = body.get('source', 'mock') if isinstance(body, dict) else 'mock'
source = body.get('source') if isinstance(body, dict) else None
if source is None:
source = 'live' if live_configured() else 'mock'
if source not in ('mock', 'live'):
raise HTTPException(status_code=400,
detail='source must be mock|live')