| | |
| | | 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, |
| | |
| | | response = await client.post( |
| | | f"{self.base_url}/v1/user/login", |
| | | headers={'Content-Type': 'application/json'}, |
| | | json={"email": email if email else 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}") |
| | |
| | | } |
| | | 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 [ |
| | | { |