Spaces:
Running on Zero
Running on Zero
Update app.py
Browse filesfix para openai
app.py
CHANGED
|
@@ -170,7 +170,7 @@ def ChatFunc(message, history, LangMode, ChooseLang):
|
|
| 170 |
|
| 171 |
def __call__(self, content, noNewLine = False):
|
| 172 |
if not content:
|
| 173 |
-
|
| 174 |
|
| 175 |
self.Message.content += content;
|
| 176 |
self.LastContent = None;
|
|
@@ -323,10 +323,19 @@ def ChatFunc(message, history, LangMode, ChooseLang):
|
|
| 323 |
yield m.done()
|
| 324 |
|
| 325 |
answer = BotMessage("");
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 330 |
finally:
|
| 331 |
yield m.done()
|
| 332 |
|
|
|
|
| 170 |
|
| 171 |
def __call__(self, content, noNewLine = False):
|
| 172 |
if not content:
|
| 173 |
+
return ChatBotOutput()
|
| 174 |
|
| 175 |
self.Message.content += content;
|
| 176 |
self.LastContent = None;
|
|
|
|
| 323 |
yield m.done()
|
| 324 |
|
| 325 |
answer = BotMessage("");
|
| 326 |
+
|
| 327 |
+
for chunk in llmanswer:
|
| 328 |
+
if not chunk.choices:
|
| 329 |
+
continue
|
| 330 |
+
|
| 331 |
+
content = chunk.choices[0].delta.content
|
| 332 |
+
|
| 333 |
+
if not content:
|
| 334 |
+
continue
|
| 335 |
+
|
| 336 |
+
yield answer(content, noNewLine=True)
|
| 337 |
+
|
| 338 |
+
|
| 339 |
finally:
|
| 340 |
yield m.done()
|
| 341 |
|