Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -57,7 +57,12 @@ def stream_graph_updates(user_input: str):
|
|
57 |
assistant_reply = ""
|
58 |
for event in graph.stream({"messages": [("user", user_input)]}):
|
59 |
for value in event.values():
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
61 |
return assistant_reply
|
62 |
|
63 |
# Gradio chatbot function using the streaming updates
|
@@ -81,4 +86,4 @@ interface = gr.Interface(
|
|
81 |
)
|
82 |
|
83 |
if __name__ == "__main__":
|
84 |
-
interface.launch()
|
|
|
57 |
assistant_reply = ""
|
58 |
for event in graph.stream({"messages": [("user", user_input)]}):
|
59 |
for value in event.values():
|
60 |
+
if isinstance(value["messages"][-1], dict):
|
61 |
+
# If it's a dict, extract 'content'
|
62 |
+
assistant_reply = value["messages"][-1].get("content", "")
|
63 |
+
elif isinstance(value["messages"][-1], str):
|
64 |
+
# If it's a string, use it directly
|
65 |
+
assistant_reply = value["messages"][-1]
|
66 |
return assistant_reply
|
67 |
|
68 |
# Gradio chatbot function using the streaming updates
|
|
|
86 |
)
|
87 |
|
88 |
if __name__ == "__main__":
|
89 |
+
interface.launch(share=True)
|