common chat code
Browse files- App/Chat/utils/Summarize.py +10 -3
App/Chat/utils/Summarize.py
CHANGED
@@ -8,7 +8,7 @@ from poe_api_wrapper import PoeApi
|
|
8 |
import pprint
|
9 |
client = PoeApi("sXvCnfYy8CHnXNTRlxhmVg==")
|
10 |
bot = "Assistant"
|
11 |
-
|
12 |
|
13 |
PALM_API = ""
|
14 |
API_KEY = os.environ.get("PALM_API", PALM_API)
|
@@ -81,8 +81,15 @@ def count_tokens(text):
|
|
81 |
|
82 |
|
83 |
async def PalmTextModel(message):
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
return chunk["text"]
|
87 |
|
88 |
async def Summarizer(essay):
|
|
|
8 |
import pprint
|
9 |
client = PoeApi("sXvCnfYy8CHnXNTRlxhmVg==")
|
10 |
bot = "Assistant"
|
11 |
+
CHAT_CODE=''
|
12 |
|
13 |
PALM_API = ""
|
14 |
API_KEY = os.environ.get("PALM_API", PALM_API)
|
|
|
81 |
|
82 |
|
83 |
async def PalmTextModel(message):
|
84 |
+
global CHAT_CODE
|
85 |
+
if CHAT_CODE == '':
|
86 |
+
for chunk in client.send_message(bot, message):
|
87 |
+
pass
|
88 |
+
CHAT_CODE=chunk['chatCode']
|
89 |
+
else:
|
90 |
+
for chunk in client.send_message(bot, message,chatCode=CHAT_CODE):
|
91 |
+
pass
|
92 |
+
|
93 |
return chunk["text"]
|
94 |
|
95 |
async def Summarizer(essay):
|