Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -62,16 +62,17 @@ graph = workflow.compile()
|
|
62 |
# Define the function to run the graph
|
63 |
def run_langgraph(user_input):
|
64 |
# Start with user input
|
65 |
-
|
66 |
{"messages": [("user", user_input)]},
|
67 |
{"recursion_limit": 150}
|
68 |
)
|
69 |
-
|
70 |
-
|
71 |
for event in events:
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
75 |
|
76 |
# Create Gradio interface
|
77 |
def process_input(user_input):
|
|
|
62 |
# Define the function to run the graph
|
63 |
def run_langgraph(user_input):
|
64 |
# Start with user input
|
65 |
+
events = graph.stream(
|
66 |
{"messages": [("user", user_input)]},
|
67 |
{"recursion_limit": 150}
|
68 |
)
|
69 |
+
|
70 |
+
final_message = None
|
71 |
for event in events:
|
72 |
+
if "messages" in event and event["messages"]:
|
73 |
+
final_message = event["messages"][-1].content
|
74 |
+
|
75 |
+
return final_message or "No output generated"
|
76 |
|
77 |
# Create Gradio interface
|
78 |
def process_input(user_input):
|