Ali2206 commited on
Commit
44b7197
·
verified ·
1 Parent(s): b6c520b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -143,15 +143,18 @@ def create_agent():
143
 
144
  def respond(message, history, temperature, max_new_tokens, max_tokens, multi_agent, conversation, max_round):
145
  updated_history = history + [{"role": "user", "content": message}]
146
- response_generator = agent.run_gradio_chat(updated_history, temperature, max_new_tokens, max_tokens, multi_agent, conversation, max_round)
 
 
 
147
  collected = ""
148
  for chunk in response_generator:
149
  if isinstance(chunk, dict):
150
  collected += chunk.get("content", "")
151
  else:
152
  collected += str(chunk)
153
- updated_history.append({"role": "assistant", "content": collected})
154
- return updated_history
155
 
156
  def create_demo(agent):
157
  with gr.Blocks(css=chat_css) as demo:
 
143
 
144
  def respond(message, history, temperature, max_new_tokens, max_tokens, multi_agent, conversation, max_round):
145
  updated_history = history + [{"role": "user", "content": message}]
146
+ response_generator = agent.run_gradio_chat(
147
+ updated_history, temperature, max_new_tokens, max_tokens, multi_agent, conversation, max_round
148
+ )
149
+
150
  collected = ""
151
  for chunk in response_generator:
152
  if isinstance(chunk, dict):
153
  collected += chunk.get("content", "")
154
  else:
155
  collected += str(chunk)
156
+
157
+ return history + [{"role": "user", "content": message}, {"role": "assistant", "content": collected}]
158
 
159
  def create_demo(agent):
160
  with gr.Blocks(css=chat_css) as demo: