zhaoqingang
2025-02-12 7fd4d498da8b89af0557716b6921b0a0ab14ff0d
app/service/ragflow.py
@@ -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": email if email else f"{username}@example.com", "password": password}
            )
            if response.status_code != 200:
                raise Exception(f"Ragflow login failed: {response.text}")