mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-08-14 12:10:31 +08:00
feat: user-friendly hint of exceeded maximum context length (#122)
This commit is contained in:
@@ -119,8 +119,15 @@ Browser.runtime.onConnect.addListener((port) => {
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
if (!err.message.includes('aborted')) {
|
||||
port.postMessage({ error: err.message })
|
||||
cache.delete(KEY_ACCESS_TOKEN)
|
||||
|
||||
if (
|
||||
['message you submitted was too long', 'maximum context length'].some((m) =>
|
||||
err.message.includes(m),
|
||||
)
|
||||
)
|
||||
port.postMessage({ error: t('Exceeded maximum context length') })
|
||||
else port.postMessage({ error: err.message })
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user