zxsipola123456 commited on
Commit
f466697
·
verified ·
1 Parent(s): a7cfcbe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -20,8 +20,12 @@ def generate_response(question, model_name, endpoint, api_key):
20
  result=""
21
  for chunk in response:
22
  if chunk.choices[0].delta.content is not None:
23
- result +=chunk.choices[0].delta.content
24
- yield result
 
 
 
 
25
  except Exception as e:
26
  return f"响应生成失败: {str(e)}"
27
 
 
20
  result=""
21
  for chunk in response:
22
  if chunk.choices[0].delta.content is not None:
23
+ # result +=chunk.choices[0].delta.content
24
+ # yield result
25
+ content = chunk.choices[0].delta.content
26
+ for char in content:
27
+ result += char
28
+ yield result
29
  except Exception as e:
30
  return f"响应生成失败: {str(e)}"
31