tianlong12 commited on
Commit
3f8b380
1 Parent(s): 81cd868

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -4
app.py CHANGED
@@ -72,7 +72,6 @@ def chat_completions():
72
  def generate():
73
  nonlocal messages
74
  full_response = ""
75
- is_first_response = True
76
  while True:
77
  conversation = "\n".join([f"{msg['role']}: {msg['content']}" for msg in messages])
78
  conversation += "\n请关注并回复user最近的消息并避免总结对话历史的回答"
@@ -93,9 +92,6 @@ def chat_completions():
93
  full_response = data['text']
94
 
95
  if new_content:
96
- if is_first_response:
97
- yield f"data: {json.dumps(format_openai_response({'role': 'assistant'}))}\n\n"
98
- is_first_response = False
99
  yield f"data: {json.dumps(format_openai_response(new_content))}\n\n"
100
 
101
  elif '"final":true' in event.data:
 
72
  def generate():
73
  nonlocal messages
74
  full_response = ""
 
75
  while True:
76
  conversation = "\n".join([f"{msg['role']}: {msg['content']}" for msg in messages])
77
  conversation += "\n请关注并回复user最近的消息并避免总结对话历史的回答"
 
92
  full_response = data['text']
93
 
94
  if new_content:
 
 
 
95
  yield f"data: {json.dumps(format_openai_response(new_content))}\n\n"
96
 
97
  elif '"final":true' in event.data: