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