| | |
| | | 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}") |
| | |
| | | |
| | | 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 |