Skip to content

Commit

Permalink
correctly update session_state.tools
Browse files Browse the repository at this point in the history
  • Loading branch information
x5a committed Nov 21, 2024
1 parent 90e2386 commit 3247733
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions computer-use-demo/computer_use_demo/streamlit.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,15 @@ def maybe_add_interruption_blocks():
block["id"] for block in last_message["content"] if block["type"] == "tool_use"
]
for tool_use_id in previous_tool_use_ids:
tool_result = BetaToolResultBlockParam(
tool_use_id=tool_use_id,
type="tool_result",
content=INTERRUPT_TOOL_ERROR,
is_error=True,
st.session_state.tools[tool_use_id] = ToolResult(error=INTERRUPT_TOOL_ERROR)
result.append(
BetaToolResultBlockParam(
tool_use_id=tool_use_id,
type="tool_result",
content=INTERRUPT_TOOL_ERROR,
is_error=True,
)
)
st.session_state.tools[tool_use_id] = tool_result
result.append(tool_result)
result.append(BetaTextBlockParam(type="text", text=INTERRUPT_TEXT))
return result

Expand Down

0 comments on commit 3247733

Please sign in to comment.