Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,12 +15,13 @@ agent = CodeAgent(
|
|
| 15 |
# 定义 Gradio 接口
|
| 16 |
def chat_fn(message, history):
|
| 17 |
result = agent.run(message)
|
| 18 |
-
history
|
|
|
|
| 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 |
)
|