Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +7 -7
src/streamlit_app.py
CHANGED
|
@@ -149,17 +149,17 @@ if "current_chat_id" in st.session_state:
|
|
| 149 |
config=set_config()):
|
| 150 |
# The output of a streaming node is the key of the node itself
|
| 151 |
if "llmresponse" in chunk:
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
|
| 156 |
# Handle tool calls if they appear in the stream
|
| 157 |
elif "tool_node" in chunk:
|
| 158 |
# Since we are streaming, render the tool message right away
|
| 159 |
# And clear the response placeholder for the next text chunk
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
|
| 165 |
response_placeholder.markdown(full_response) # Final update without cursor
|
|
|
|
| 149 |
config=set_config()):
|
| 150 |
# The output of a streaming node is the key of the node itself
|
| 151 |
if "llmresponse" in chunk:
|
| 152 |
+
ai_message = chunk["llmresponse"]["messages"][-1]
|
| 153 |
+
full_response += ai_message.content
|
| 154 |
+
response_placeholder.markdown(full_response + "▌") # Add a cursor effect
|
| 155 |
|
| 156 |
# Handle tool calls if they appear in the stream
|
| 157 |
elif "tool_node" in chunk:
|
| 158 |
# Since we are streaming, render the tool message right away
|
| 159 |
# And clear the response placeholder for the next text chunk
|
| 160 |
+
response_placeholder.empty()
|
| 161 |
+
tool_messages = chunk["tool_node"]["messages"]
|
| 162 |
+
for tool_message in tool_messages:
|
| 163 |
+
render_tool_message(tool_message)
|
| 164 |
|
| 165 |
response_placeholder.markdown(full_response) # Final update without cursor
|