From 0650b889a36d9b9fd42415b9b9819676f839ae9b Mon Sep 17 00:00:00 2001
From: zhaoqingang <zhaoqg0118@163.com>
Date: 星期二, 08 四月 2025 09:54:09 +0800
Subject: [PATCH] 首页会话-模型修改
---
app/service/ragflow.py | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/app/service/ragflow.py b/app/service/ragflow.py
index f10902f..45961a6 100644
--- a/app/service/ragflow.py
+++ b/app/service/ragflow.py
@@ -19,7 +19,7 @@
return {}
data = response.json()
- ret_code = data.get("retcode")
+ ret_code = data.get("retcode", data.get("code"))
if ret_code == 401:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
@@ -48,13 +48,13 @@
raise Exception(f"Ragflow registration failed: {response.text}")
return self._handle_response(response)
- async def login(self, username: str, password: str) -> str:
+ async def login(self, username: str, password: str, email="") -> str:
password = RagflowCrypto(settings.PUBLIC_KEY, settings.PRIVATE_KEY).encrypt(password)
async with httpx.AsyncClient() as client:
response = await client.post(
f"{self.base_url}/v1/user/login",
headers={'Content-Type': 'application/json'},
- json={"email": f"{username}@example.com", "password": password}
+ json={"email": username if "@" in username else f"{username}@example.com", "password": password}
)
if response.status_code != 200:
raise Exception(f"Ragflow login failed: {response.text}")
@@ -136,6 +136,8 @@
}
async with httpx.AsyncClient() as client:
response = await client.post(url, headers=headers, json=data)
+ print(response.status_code)
+ print(response.text)
data = self._handle_response(response)
return [
{
--
Gitblit v1.8.0