From 5ef590b70cc8e2de16083af2ee2d977daae5587c Mon Sep 17 00:00:00 2001 From: zhaoqingang <zhaoqg0118@163.com> Date: 星期二, 19 十一月 2024 16:34:29 +0800 Subject: [PATCH] 会话缓存本地数据库 --- app/service/ragflow.py | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/app/service/ragflow.py b/app/service/ragflow.py index 6d6012d..769631d 100644 --- a/app/service/ragflow.py +++ b/app/service/ragflow.py @@ -146,12 +146,15 @@ } ] if data else [] - async def get_session_history(self, token: str, chat_id: str) -> list: + async def get_session_history(self, token: str, chat_id: str, is_all: int=0): url = f"{self.base_url}/v1/conversation/get?conversation_id={chat_id}" headers = {"Authorization": token} async with httpx.AsyncClient() as client: response = await client.get(url, headers=headers) data = self._handle_response(response) + # print("----------------data----------------------:", data) + if is_all: + return data return data.get("message", []) async def upload_and_parse(self, token: str, chat_id: str, filename: str, file: bytes) -> str: @@ -172,6 +175,7 @@ data = {"email": email, "user_id": user_id} async with httpx.AsyncClient(timeout=60) as client: response = await client.post(url, headers=headers, json=data) + print(response) if response.status_code != 200: raise Exception(f"Ragflow add user to tenant failed: {response.text}") -- Gitblit v1.8.0