Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,16 +15,18 @@ agent = CodeAgent(
|
|
| 15 |
# 定义 Gradio 接口
|
| 16 |
def chat_fn(message, history):
|
| 17 |
result = agent.run(message)
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
return
|
|
|
|
| 21 |
|
| 22 |
demo = gr.ChatInterface(
|
| 23 |
fn=chat_fn,
|
| 24 |
-
chatbot
|
| 25 |
textbox=gr.Textbox(placeholder="Ask Alfred to help plan your party..."),
|
| 26 |
title="Alfred Party Planner Agent",
|
| 27 |
)
|
| 28 |
|
|
|
|
| 29 |
if __name__ == "__main__":
|
| 30 |
demo.launch()
|
|
|
|
| 15 |
# 定义 Gradio 接口
|
| 16 |
def chat_fn(message, history):
|
| 17 |
result = agent.run(message)
|
| 18 |
+
if not isinstance(result, str):
|
| 19 |
+
result = str(result)
|
| 20 |
+
return result # ✅ 只返回助手的回复
|
| 21 |
+
|
| 22 |
|
| 23 |
demo = gr.ChatInterface(
|
| 24 |
fn=chat_fn,
|
| 25 |
+
chatbot=gr.Chatbot(type="messages"),
|
| 26 |
textbox=gr.Textbox(placeholder="Ask Alfred to help plan your party..."),
|
| 27 |
title="Alfred Party Planner Agent",
|
| 28 |
)
|
| 29 |
|
| 30 |
+
|
| 31 |
if __name__ == "__main__":
|
| 32 |
demo.launch()
|