From fe8e77104db4503d65f13ad66eaa48d631619d7c Mon Sep 17 00:00:00 2001
From: zhaoqingang <zhaoqg0118@163.com>
Date: 星期三, 15 一月 2025 17:28:16 +0800
Subject: [PATCH] tmp

---
 app/service/v2/app_driver/chat_dialog.py |   31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/app/service/v2/app_driver/chat_dialog.py b/app/service/v2/app_driver/chat_dialog.py
index 27807fd..df7a5d1 100644
--- a/app/service/v2/app_driver/chat_dialog.py
+++ b/app/service/v2/app_driver/chat_dialog.py
@@ -6,22 +6,10 @@
 
 class ChatDialog(ChatBase):
 
-
-    def __init__(self, token):
-        self.token = token
-
-
-    async def get_headers(self):
-        return {
-            'Content-Type': 'application/json',
-            'Authorization': f'Bearer {self.token}'
-        }
-
-
     async def chat_completions(self, url, data, headers):
         complete_response = ""
         async for line in self.http_stream(url, data, headers):
-            # logger.error(line)
+            print(line)
             if line.startswith("data:"):
                 complete_response = line.strip("data:").strip()
             else:
@@ -37,6 +25,23 @@
                 logger.info("Invalid JSON data------------------")
                 # print(e)
 
+    async def chat_sessions(self, url, data, headers):
+
+        res = await self.http_post(url, data, headers)
+        if res.status_code == 200:
+            return res.json()
+        else:
+            return {}
+
+
+
+    @staticmethod
+    async def request_data(question, session_id=""):
+        return {
+            "question": question,
+            "stream": True,
+            "session_id": session_id
+        }
 
 
 

--
Gitblit v1.8.0