fix(chat): make sendMessage calls fire-and-forget with error handling
This commit is contained in:
@@ -494,7 +494,7 @@ export const ChatInput: React.FC<ChatInputProps> = ({ onOpenSettings, scrollToBo
|
|||||||
...additionalParts.flatMap(p => p.attachments ?? []),
|
...additionalParts.flatMap(p => p.attachments ?? []),
|
||||||
];
|
];
|
||||||
|
|
||||||
await sendMessage(
|
void sendMessage(
|
||||||
primaryText,
|
primaryText,
|
||||||
currentProviderId,
|
currentProviderId,
|
||||||
currentModelId,
|
currentModelId,
|
||||||
|
|||||||
@@ -418,8 +418,7 @@ export const FilesView: React.FC = () => {
|
|||||||
setLineSelection(null);
|
setLineSelection(null);
|
||||||
setActiveMainTab('chat');
|
setActiveMainTab('chat');
|
||||||
|
|
||||||
try {
|
void sendMessage(
|
||||||
await sendMessage(
|
|
||||||
message,
|
message,
|
||||||
effectiveProviderId,
|
effectiveProviderId,
|
||||||
effectiveModelId,
|
effectiveModelId,
|
||||||
@@ -428,10 +427,9 @@ export const FilesView: React.FC = () => {
|
|||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
effectiveVariant
|
effectiveVariant
|
||||||
);
|
).catch((e) => {
|
||||||
} catch (e) {
|
|
||||||
console.error('Failed to send comment', e);
|
console.error('Failed to send comment', e);
|
||||||
}
|
});
|
||||||
}, [lineSelection, commentText, selectedFile, fileContent, currentSessionId, currentProviderId, currentModelId, currentAgentName, currentVariant, extractSelectedCode, sendMessage, setActiveMainTab, getSessionAgentSelection, getAgentModelForSession, getAgentModelVariantForSession]);
|
}, [lineSelection, commentText, selectedFile, fileContent, currentSessionId, currentProviderId, currentModelId, currentAgentName, currentVariant, extractSelectedCode, sendMessage, setActiveMainTab, getSessionAgentSelection, getAgentModelForSession, getAgentModelVariantForSession]);
|
||||||
|
|
||||||
const mapDirectoryEntries = React.useCallback((dirPath: string, entries: Array<{ name: string; path: string; isDirectory: boolean }>): FileNode[] => {
|
const mapDirectoryEntries = React.useCallback((dirPath: string, entries: Array<{ name: string; path: string; isDirectory: boolean }>): FileNode[] => {
|
||||||
|
|||||||
@@ -277,8 +277,7 @@ export const PierreDiffViewer: React.FC<PierreDiffViewerProps> = ({
|
|||||||
setSelection(null);
|
setSelection(null);
|
||||||
setActiveMainTab('chat');
|
setActiveMainTab('chat');
|
||||||
|
|
||||||
try {
|
void sendMessage(
|
||||||
await sendMessage(
|
|
||||||
message,
|
message,
|
||||||
effectiveProviderId,
|
effectiveProviderId,
|
||||||
effectiveModelId,
|
effectiveModelId,
|
||||||
@@ -287,10 +286,9 @@ export const PierreDiffViewer: React.FC<PierreDiffViewerProps> = ({
|
|||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
effectiveVariant
|
effectiveVariant
|
||||||
);
|
).catch((e) => {
|
||||||
} catch (e) {
|
console.error('Failed to send comment', e);
|
||||||
console.error("Failed to send comment", e);
|
});
|
||||||
}
|
|
||||||
}, [selection, commentText, original, modified, fileName, language, sendMessage, currentSessionId, currentProviderId, currentModelId, currentAgentName, currentVariant, setActiveMainTab, getSessionAgentSelection, getAgentModelForSession, getAgentModelVariantForSession]);
|
}, [selection, commentText, original, modified, fileName, language, sendMessage, currentSessionId, currentProviderId, currentModelId, currentAgentName, currentVariant, setActiveMainTab, getSessionAgentSelection, getAgentModelForSession, getAgentModelVariantForSession]);
|
||||||
|
|
||||||
ensureFlexokiThemesRegistered();
|
ensureFlexokiThemesRegistered();
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ export const PullRequestSection: React.FC<{
|
|||||||
failedChecks: failed,
|
failedChecks: failed,
|
||||||
}, null, 2)}`;
|
}, null, 2)}`;
|
||||||
|
|
||||||
await useMessageStore.getState().sendMessage(
|
void useMessageStore.getState().sendMessage(
|
||||||
visibleText,
|
visibleText,
|
||||||
providerID,
|
providerID,
|
||||||
modelID,
|
modelID,
|
||||||
@@ -257,7 +257,10 @@ export const PullRequestSection: React.FC<{
|
|||||||
{ text: payloadText, synthetic: true },
|
{ text: payloadText, synthetic: true },
|
||||||
],
|
],
|
||||||
currentVariant
|
currentVariant
|
||||||
);
|
).catch((e) => {
|
||||||
|
const message = e instanceof Error ? e.message : String(e);
|
||||||
|
toast.error('Failed to send message', { description: message });
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const message = e instanceof Error ? e.message : String(e);
|
const message = e instanceof Error ? e.message : String(e);
|
||||||
toast.error('Failed to load checks', { description: message });
|
toast.error('Failed to load checks', { description: message });
|
||||||
@@ -309,7 +312,7 @@ export const PullRequestSection: React.FC<{
|
|||||||
reviewComments,
|
reviewComments,
|
||||||
}, null, 2)}`;
|
}, null, 2)}`;
|
||||||
|
|
||||||
await useMessageStore.getState().sendMessage(
|
void useMessageStore.getState().sendMessage(
|
||||||
visibleText,
|
visibleText,
|
||||||
providerID,
|
providerID,
|
||||||
modelID,
|
modelID,
|
||||||
@@ -322,7 +325,10 @@ export const PullRequestSection: React.FC<{
|
|||||||
{ text: payloadText, synthetic: true },
|
{ text: payloadText, synthetic: true },
|
||||||
],
|
],
|
||||||
currentVariant
|
currentVariant
|
||||||
);
|
).catch((e) => {
|
||||||
|
const message = e instanceof Error ? e.message : String(e);
|
||||||
|
toast.error('Failed to send message', { description: message });
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const message = e instanceof Error ? e.message : String(e);
|
const message = e instanceof Error ? e.message : String(e);
|
||||||
toast.error('Failed to load PR comments', { description: message });
|
toast.error('Failed to load PR comments', { description: message });
|
||||||
|
|||||||
Reference in New Issue
Block a user