fix(agent): /api/agent/run defaults to live when OPENROUTER_API_KEY is configured (was always mock)
This commit is contained in:
@@ -633,7 +633,9 @@ def create_app(db_path, img_dir, state_dir=None):
|
|||||||
|
|
||||||
@app.post('/api/agent/run')
|
@app.post('/api/agent/run')
|
||||||
def agent_run(body: dict):
|
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'):
|
if source not in ('mock', 'live'):
|
||||||
raise HTTPException(status_code=400,
|
raise HTTPException(status_code=400,
|
||||||
detail='source must be mock|live')
|
detail='source must be mock|live')
|
||||||
|
|||||||
Reference in New Issue
Block a user