Skip to content

Commit

Permalink
fix: abort error
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo committed Apr 13, 2024
1 parent 16949cd commit cac3314
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/services/languageModel/llmWorker/llamaCpp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,16 @@ export function runLLama(
export function abortLLama(conversationID: string) {
const abortController = runnerAbortControllers.get(conversationID);
if (abortController !== undefined) {
abortController.abort();
try {
abortController.abort();
runnerAbortControllers.delete(conversationID);
} catch (error) {
const message = `${(error as Error).message} ${(error as Error).stack ?? 'no stack'}`;
if (message.includes('AbortError')) {
console.info('abortLLama', conversationID);
} else {
throw error;
}
}
}
}

0 comments on commit cac3314

Please sign in to comment.