diff --git a/src/components/Quilly.tsx b/src/components/Quilly.tsx index cad55379..2a06cc1f 100644 --- a/src/components/Quilly.tsx +++ b/src/components/Quilly.tsx @@ -146,6 +146,21 @@ function QuillyContent({ error, onDismiss, onNewChat, onOpenModelSelector, onTry }], }; + // Check for prompt length errors (413 or 400 with specific message) + case (error.status === 413 || error.status === 400) && + (error.message?.toLowerCase().includes('prompt is too long') || + error.message?.toLowerCase().includes('prompt') && error.message?.toLowerCase().includes('too long')): + return { + message: 'Your conversation has grown too long for this model. Try starting a new chat or switching to a model with a larger context window.', + actions: [{ + label: 'New chat', + onClick: onNewChat, + }, { + label: 'Change model', + onClick: onOpenModelSelector, + }], + }; + case error.status === 403: return { message: `It seems your API key has been used up. Check your API provider's settings, or try a different API key or different provider/model combo:`, @@ -158,6 +173,18 @@ function QuillyContent({ error, onDismiss, onNewChat, onOpenModelSelector, onTry }], }; + case error.status === 413: + return { + message: 'Your request is too large for the AI provider. Try starting a new chat to reduce the conversation size.', + actions: [{ + label: 'New chat', + onClick: onNewChat, + }, { + label: 'Change model', + onClick: onOpenModelSelector, + }], + }; + case error.status === 400: return { message: 'The AI provider did not understand the message / data it got. If it persists, try stating a new conversation or using a different model.',