fix: abortError handle

This commit is contained in:
MyPrototypeWhat 2025-03-12 20:19:48 +08:00 committed by GitHub
parent 1de54caa7e
commit 647ecbfa61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -73,16 +73,12 @@ export const isAbortError = (error: any): boolean => {
if (error instanceof DOMException && error.name === 'AbortError') {
return true
}
console.log(
typeof error === 'object',
error.message === 'Request was aborted.' || error?.message?.includes('signal is aborted without reason')
)
// 检查 OpenAI 特定的错误结构
if (
(error &&
typeof error === 'object' &&
(error.message === 'Request was aborted.' || error?.message?.includes('signal is aborted without reason'))) ||
error.stack?.includes('OpenAI.makeRequest')
error &&
typeof error === 'object' &&
(error.message === 'Request was aborted.' || error?.message?.includes('signal is aborted without reason'))
) {
return true
}