diff --git a/api/main.py b/api/main.py index a22405f..f518325 100644 --- a/api/main.py +++ b/api/main.py @@ -113,10 +113,14 @@ async def get_conversation_history(): status_code=404, detail="Workflow worker unavailable or not found." ) - # For other Temporal errors, return a 500 - raise HTTPException( - status_code=500, detail="Internal server error while querying workflow." - ) + if "workflow not found" in error_message: + await start_workflow() + return [] + else: + # For other Temporal errors, return a 500 + raise HTTPException( + status_code=500, detail="Internal server error while querying workflow." + ) @app.get("/agent-goal") async def get_agent_goal(): diff --git a/todo.md b/todo.md index a63530a..a1ee04c 100644 --- a/todo.md +++ b/todo.md @@ -34,3 +34,5 @@ [ ] non-retry the api key error - "Invalid API Key provided: sk_test_**J..." and "AuthenticationError" [ ] make it so you can yeet yourself out of a goal and pick a new one + +[ ] add visual feedback when workflow starting \ No newline at end of file