rrg92 commited on
Commit
6f9be9e
·
verified ·
1 Parent(s): db0dc73

Update app.py

Browse files

fix para openai

Files changed (1) hide show
  1. app.py +14 -5
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
- return;
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
- for chunk in llmanswer:
328
- content = chunk.choices[0].delta.content
329
- yield answer(content, noNewLine = True)
 
 
 
 
 
 
 
 
 
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