fixed llm issues with response
This commit is contained in:
+2
-13
@@ -42,24 +42,13 @@ async def chat_ai(
|
||||
|
||||
# Get response from DroneBot
|
||||
logger.info("Calling DroneBot.chat()...")
|
||||
result = bot.chat(request.query)
|
||||
result = await bot.chat(request.query)
|
||||
logger.info(f"DroneBot response received: {result}")
|
||||
|
||||
final_message_json = json.loads(result["final_message"])
|
||||
# If JSON parsing fails, create a fallback structure
|
||||
# message = {
|
||||
# "message": final_message_json,
|
||||
# "options": None,
|
||||
# "requires_selection": False,
|
||||
# "end": "in_progress",
|
||||
# "form": {}
|
||||
# }
|
||||
logger.info("Created fallback message structure")
|
||||
|
||||
logger.info(f"Final message to return: {final_message_json}")
|
||||
return ChatResponse(
|
||||
status="success",
|
||||
message=final_message_json
|
||||
message=result
|
||||
)
|
||||
except HTTPException:
|
||||
logger.error("Re-raising HTTPException")
|
||||
|
||||
Reference in New Issue
Block a user