zhaoqingang
2024-11-21 ae30d9a75407c912649f11c4f44ff15c869a4f98
app/api/chat.py
@@ -209,7 +209,8 @@
                    session_id=chat_id,
                    name=question,
                    agent_id=agent_id,
                    agent_type=AgentType.BASIC
                    agent_type=AgentType.BASIC,
                    user_id=current_user.id
                )
                if not question:
                    await websocket.send_json({"message": "Invalid request", "type": "error"})
@@ -232,6 +233,7 @@
                                if file_name:
                                    excel_url = f"/api/files/download/?agent_id=basic_question_talk&file_id={file_name}&file_type=word"
                                result = {"message": output, "type": "message", "file_url": excel_url}
                                SessionService(db).update_session(session_id=chat_id, is_incr=1, message={"role":"assistant", "content": result})
                                await websocket.send_json(result | data)
                            except json.JSONDecodeError as e:
                                print(f"Error decoding JSON: {e}")