Skip to content

Commit

Permalink
added UI Error display for failed retry on message (#733)
Browse files Browse the repository at this point in the history
* added UI Error display for failed retry on message

* implement request changes
  • Loading branch information
hpatel292-seneca authored Nov 16, 2024
1 parent a5c88b3 commit d6e5cb0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/Message/AiMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ function AiMessage(props: AiMessageProps) {
const [message, setMessage] = useState(props.message);
const [retrying, setRetrying] = useState(false);
const { settings } = useSettings();
const { error } = useAlert();

useEffect(() => {
setMessage(props.message);
Expand Down Expand Up @@ -127,14 +128,17 @@ function AiMessage(props: AiMessageProps) {
message.addVersion(version);
message.switchVersion(version.id);
await message.save(chat.id);
} catch (err) {
// TODO: UI error handling
} catch (err: any) {
error({
title: `Retry Error`,
message: err.message,
});
console.warn("Unable to retry message", { model, err });
} finally {
setRetrying(false);
}
},
[props.chatId, settings.currentProvider.apiKey, message, callChatApi]
[props.chatId, settings.currentProvider.apiKey, message, callChatApi, error]
);

// While we're streaming in a new version, use a different display
Expand Down

0 comments on commit d6e5cb0

Please sign in to comment.