feat(ui, react): add resetToolApproval method to useChat#12254
Open
WeiAnAn wants to merge 3 commits intovercel:mainfrom
Open
feat(ui, react): add resetToolApproval method to useChat#12254WeiAnAn wants to merge 3 commits intovercel:mainfrom
resetToolApproval method to useChat#12254WeiAnAn wants to merge 3 commits intovercel:mainfrom
Conversation
Add a new method `resetToolApproval` to the `useChat` hook that resets a tool part's state from `approval-responded` back to `approval-requested`. This allows users to reset a tool approval response and request approval again. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add resetToolApproval to useChat reference docs - Export ChatResetToolApprovalFunction type from ai package - Add Reset button to tool approval example in next-openai Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
resetToolApproval method to useChatresetToolApproval method to useChat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
When using tool approval workflows, users may want to reset a tool approval response back to the requested state. This allows users to change their mind after responding to a tool approval request, without needing to reload the entire chat.
Summary
Added a new
resetToolApprovalmethod to theuseChathook that:idparameter (the approval ID)approval-respondedback toapproval-requestedapprovedandreasonfields from the approval objectManual Verification
Run UI test in

next-openaiexample at http://localhost:3000/test-tool-approvalChecklist
pnpm changesetin the project root)