seawolf2357 commited on
Commit
cb0435d
·
verified ·
1 Parent(s): eae202a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -26,8 +26,10 @@ def chat_stream(messages):
26
  )
27
 
28
  for chunk in stream:
29
- if chunk.choices[0].delta.content:
30
- yield chunk.choices[0].delta.content
 
 
31
 
32
  def chat_respond(message, history):
33
  """
@@ -212,7 +214,7 @@ with gr.Blocks(fill_height=True) as demo:
212
 
213
  # Header Title
214
  gr.Markdown("""# GLM-4.7 CHAT""", elem_classes="header-text")
215
- gr.Markdown("""<p class="subtitle">Zhipu AI's Latest Open Source Model - Powerful Reasoning & Coding Capabilities</p>""")
216
 
217
  # Model Info Box
218
  gr.HTML("""
 
26
  )
27
 
28
  for chunk in stream:
29
+ if chunk.choices and len(chunk.choices) > 0:
30
+ delta = chunk.choices[0].delta
31
+ if hasattr(delta, 'content') and delta.content:
32
+ yield delta.content
33
 
34
  def chat_respond(message, history):
35
  """
 
214
 
215
  # Header Title
216
  gr.Markdown("""# GLM-4.7 CHAT""", elem_classes="header-text")
217
+ gr.Markdown("""<p class="subtitle">Zhipu AI's Latest Open Source Model - Powerful Reasoning and Coding Capabilities</p>""")
218
 
219
  # Model Info Box
220
  gr.HTML("""