awacke1 commited on
Commit
9bd4a23
·
1 Parent(s): 8b6fc03

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -169,11 +169,12 @@ def chat_with_model(prompt, document_section, model_choice='gpt-3.5-turbo'):
169
  messages=conversation,
170
  stream=True,
171
  )
 
172
  for part in stream:
173
  chunk_message = (part.choices[0].delta.content or "")
174
  collected_messages.append(chunk_message) # save the message
175
- #content=part["choices"][0].get("delta",{}).get("content")
176
  content=part.choices[0].delta.content
 
177
  try:
178
  report.append(content)
179
  if len(content) > 0:
@@ -181,7 +182,7 @@ def chat_with_model(prompt, document_section, model_choice='gpt-3.5-turbo'):
181
  res_box.markdown(f'*{result}*')
182
  except:
183
  st.write(' ')
184
- full_reply_content = ''.join([m.get('content', '') for m in collected_messages])
185
 
186
 
187
  #for chunk in client.chat.completions.create(
 
169
  messages=conversation,
170
  stream=True,
171
  )
172
+ all_content = "" # Initialize an empty string to hold all content
173
  for part in stream:
174
  chunk_message = (part.choices[0].delta.content or "")
175
  collected_messages.append(chunk_message) # save the message
 
176
  content=part.choices[0].delta.content
177
+ all_content += content
178
  try:
179
  report.append(content)
180
  if len(content) > 0:
 
182
  res_box.markdown(f'*{result}*')
183
  except:
184
  st.write(' ')
185
+ full_reply_content = all_content
186
 
187
 
188
  #for chunk in client.chat.completions.create(