Skip to content

Commit

Permalink
[Obs AI Assistant] Avoid showing error toast when action is aborted b… (
Browse files Browse the repository at this point in the history
#195331)

Closes #186794

## Summary

### Problem
When the user clicks on "Stop generating" while the AI Assistant is
generating an answer, an error toast is shown with the error message
"Aborted". This is unnecessary as the user knows they aborted their
action.

### Solution
Do not show an error toast if the action is aborted by the user.
  • Loading branch information
viduni94 authored Oct 8, 2024
1 parent 336f824 commit 43a3d4a
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ function useChatWithoutContext({
(error: Error) => {
if (error instanceof AbortError) {
setChatState(ChatState.Aborted);
} else {
setChatState(ChatState.Error);
return;
}

setChatState(ChatState.Error);

if (isTokenLimitReachedError(error)) {
setMessages((msgs) => [
...msgs,
Expand Down

0 comments on commit 43a3d4a

Please sign in to comment.