From ae30d9a75407c912649f11c4f44ff15c869a4f98 Mon Sep 17 00:00:00 2001
From: zhaoqingang <zhaoqg0118@163.com>
Date: 星期四, 21 十一月 2024 15:42:42 +0800
Subject: [PATCH] 自研agent会话保存和查询

---
 app/service/basic.py |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/app/service/basic.py b/app/service/basic.py
index 93adf6c..f3e5db5 100644
--- a/app/service/basic.py
+++ b/app/service/basic.py
@@ -65,10 +65,26 @@
                 if response.status_code == 200:
                     try:
                         async for answer in response.aiter_text():
-                            print(f"response of ragflow chat: {answer}")
+                            print(f"response of excel_talk chat: {answer}")
                             yield answer
                     except GeneratorExit as e:
                         print(e)
                         return
                 else:
-                    yield f"Error: {response.status_code}"
\ No newline at end of file
+                    yield f"Error: {response.status_code}"
+
+    async def questions_talk(self, chat_id: str):
+        url = f"{self.base_url}/questions/talk"
+        params = {'chat_id': chat_id}
+        headers = {'Content-Type': 'text/plain'}
+        async with httpx.AsyncClient() as client:
+            response = await client.post(
+                url,
+                headers=headers,
+                params=params
+            )
+            return self._check_response(response)
+
+    async def questions_talk_word_download(self, file_id: str):
+        url = f"{self.base_url}/questions/download/word"
+        return await self.download_from_url(url, params={'excel_name': file_id})
\ No newline at end of file

--
Gitblit v1.8.0