Compare commits

...
Author SHA1 Message Date
Chad Curtis e74d423e7a Remove redundant conversation length handler, simplify "prompt too large" response. 2026-01-30 21:22:15 +00:00
Chad Curtis 5c7cf54d67 fix: add user-friendly error handling for prompt length exceeded errors
Previously, when users exceeded the 200k token limit, they received a
generic 400/413 error message that didn't clearly explain the issue.

This commit adds specific error handling in the Quilly component to:
- Detect prompt length errors from API responses (400/413 status codes
  with 'prompt is too long' message)
- Display clear, actionable error messages to users
- Offer two solutions: start a new chat or switch to a model with a
  larger context window

The error handling covers two cases:
1. Specific prompt length errors with message content check
2. Generic 413 (Payload Too Large) status codes

This improves UX by helping users understand why their request failed
and providing clear next steps to resolve the issue.
2026-01-30 20:51:24 +00:00
+6
View File
@@ -158,6 +158,12 @@ function QuillyContent({ error, onDismiss, onNewChat, onOpenModelSelector, onTry
}], }],
}; };
case error.status === 413:
return {
message: 'Your request is too large for the AI provider. Try sending a shorter message.',
actions: [],
};
case error.status === 400: case error.status === 400:
return { 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.', 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.',