eeenn commited on
Commit
3c79fc4
·
verified ·
1 Parent(s): 52cdd46

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -15,12 +15,13 @@ agent = CodeAgent(
15
  # 定义 Gradio 接口
16
  def chat_fn(message, history):
17
  result = agent.run(message)
18
- history = history + [(message, result)]
 
19
  return history, history
20
 
21
  demo = gr.ChatInterface(
22
  fn=chat_fn,
23
- chatbot=gr.Chatbot(),
24
  textbox=gr.Textbox(placeholder="Ask Alfred to help plan your party..."),
25
  title="Alfred Party Planner Agent",
26
  )
 
15
  # 定义 Gradio 接口
16
  def chat_fn(message, history):
17
  result = agent.run(message)
18
+ history.append({"role": "user", "content": message})
19
+ history.append({"role": "assistant", "content": result})
20
  return history, history
21
 
22
  demo = gr.ChatInterface(
23
  fn=chat_fn,
24
+ chatbot = gr.Chatbot(type="messages")
25
  textbox=gr.Textbox(placeholder="Ask Alfred to help plan your party..."),
26
  title="Alfred Party Planner Agent",
27
  )