Spaces:
Sleeping
Sleeping
Nagesh Muralidhar
commited on
Commit
·
72e705f
1
Parent(s):
fbb963b
midterm-submission
Browse files- server/main.py +3 -6
server/main.py
CHANGED
|
@@ -290,11 +290,8 @@ async def get_podcast_context(podcast_id: str):
|
|
| 290 |
|
| 291 |
@app.post("/chat")
|
| 292 |
async def chat(message: ChatMessage):
|
| 293 |
-
"""Process a chat message
|
| 294 |
try:
|
| 295 |
-
# Log incoming message
|
| 296 |
-
logger.info(f"Received chat message: {message}")
|
| 297 |
-
|
| 298 |
# Get API key
|
| 299 |
tavily_api_key = os.getenv("TAVILY_API_KEY")
|
| 300 |
if not tavily_api_key:
|
|
@@ -318,11 +315,11 @@ async def chat(message: ChatMessage):
|
|
| 318 |
context=message.context
|
| 319 |
)
|
| 320 |
logger.info("Workflow completed successfully")
|
|
|
|
| 321 |
except Exception as e:
|
| 322 |
logger.error(f"Error running workflow: {str(e)}")
|
| 323 |
raise HTTPException(status_code=500, detail=f"Error running workflow: {str(e)}")
|
| 324 |
-
|
| 325 |
-
return WorkflowResponse(**result)
|
| 326 |
except Exception as e:
|
| 327 |
logger.error(f"Error in chat endpoint: {str(e)}", exc_info=True)
|
| 328 |
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
| 290 |
|
| 291 |
@app.post("/chat")
|
| 292 |
async def chat(message: ChatMessage):
|
| 293 |
+
"""Process a chat message."""
|
| 294 |
try:
|
|
|
|
|
|
|
|
|
|
| 295 |
# Get API key
|
| 296 |
tavily_api_key = os.getenv("TAVILY_API_KEY")
|
| 297 |
if not tavily_api_key:
|
|
|
|
| 315 |
context=message.context
|
| 316 |
)
|
| 317 |
logger.info("Workflow completed successfully")
|
| 318 |
+
return result
|
| 319 |
except Exception as e:
|
| 320 |
logger.error(f"Error running workflow: {str(e)}")
|
| 321 |
raise HTTPException(status_code=500, detail=f"Error running workflow: {str(e)}")
|
| 322 |
+
|
|
|
|
| 323 |
except Exception as e:
|
| 324 |
logger.error(f"Error in chat endpoint: {str(e)}", exc_info=True)
|
| 325 |
raise HTTPException(status_code=500, detail=str(e))
|