zhangqian 1 jaar geleden
bovenliggende
commit
4e8cecd4ca
2 gewijzigde bestanden met toevoegingen van 6 en 1 verwijderingen
  1. 5 0
      app/api/chat.py
  2. 1 1
      app/service/ragflow.py

+ 5 - 0
app/api/chat.py

@@ -56,6 +56,11 @@ async def handle_client(websocket: WebSocket,
                                 await websocket.send_json(result)
                                 await websocket.close()
                                 return
+                        else:
+                            chat_history.append({
+                                "content": message["message"],
+                                "role": "user"
+                            })
                     async for rag_response in ragflow_service.chat(token, chat_id, chat_history):
                         try:
                             print(f"Received from ragflow: {rag_response}")

+ 1 - 1
app/service/ragflow.py

@@ -59,7 +59,7 @@ class RagflowService:
 
         print(data)
         target_url = f"{self.base_url}/v1/conversation/completion"
-        async with httpx.AsyncClient(timeout=10.0) as client:
+        async with httpx.AsyncClient(timeout=300.0) as client:
             headers = {
                 'Content-Type': 'application/json',
                 'Authorization': token