From 0306a5d726ac74450a32501affb92c71afb3e19f Mon Sep 17 00:00:00 2001 From: Laine Date: Wed, 12 Mar 2025 10:20:27 -0400 Subject: [PATCH] Auto-start workflow if one isn't found to get rid of startup error --- api/main.py | 12 ++++++++---- todo.md | 2 ++ 2 files changed, 10 insertions(+), 4 deletions(-) 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