Fixed chats that are too large being sent again and again

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
j-erler 2026-09-20 15:59:19 +02:00
parent c95cc5bacc
commit 03f962ebce
2 changed files with 25 additions and 0 deletions

View File

@ -729,6 +729,30 @@ public abstract class BaseProvider : IProvider, ISecretId
break;
}
//
// Some providers answer an oversized request with 413 instead of describing the
// problem in a 400 body. Handled here rather than below, because this is the one
// failure in this loop which cannot get better by being sent again: without its own
// branch it falls through to the retry delays, which resend the very same oversized
// request for several minutes before the user learns anything at all.
//
if(nextResponse.StatusCode is HttpStatusCode.RequestEntityTooLarge)
{
//
// The reason phrase of a 413 says no more than "Request Entity Too Large", and a
// proxy which refuses the request before the provider sees it sends no body worth
// reading. So we show what the body carries and fall back to the phrase:
//
var tooLargeMessage = ReadProviderErrorMessage(errorBody);
if (string.IsNullOrWhiteSpace(tooLargeMessage))
tooLargeMessage = nextResponse.ReasonPhrase;
await MessageBus.INSTANCE.SendError(new(Icons.Material.Filled.CloudOff, string.Format(TB("We tried to communicate with the LLM provider '{0}' (type={1}). The data of the chat, including all file attachments, is probably too large for the selected model and provider. The provider message is: '{2}'"), this.InstanceName, this.Provider, tooLargeMessage)));
this.logger.LogError("Failed request with status code {ResponseStatusCode} (message = '{ResponseReasonPhrase}', error body = '{ErrorBody}').", nextResponse.StatusCode, nextResponse.ReasonPhrase, errorBody);
errorMessage = nextResponse.ReasonPhrase;
break;
}
if(nextResponse.StatusCode is HttpStatusCode.BadRequest)
{
//

View File

@ -79,5 +79,6 @@
- Fixed AI Studio asking such a server for its models with an empty key attached when you had stored none at all. Servers behind a login turn those requests down.
- Fixed a key that could not be saved going unmentioned for the servers you host yourself. You are now told what went wrong, instead of the settings simply staying open.
- Fixed transcripts quietly losing what was said softly, such as a greeting at the very beginning of a recording. AI Studio compressed recordings so far before sending them to your transcription provider that the model could no longer make out those passages. Recordings now keep enough details for the whole of what you said to arrive.
- Fixed AI Studio seeming to hang for minutes when a chat had grown too large for the model. Some providers turn such a request down in a way AI Studio did not recognize, so it kept sending the very same oversized request again and again before giving up with a message that explained nothing. It now tells you right away that the chat, including its attachments, is too large for the selected model.
- Upgraded the Visual Briefing assistant (in preview) from the prototype to the beta state. The assistant is now completely implemented and is undergoing a deeper testing phase in preparation for release. To try it, open the app settings, allow preview features down to beta, and then enable the Visual Briefing assistant there.
- Upgraded the vector database behind local RAG (Qdrant Edge) to version 0.8.0.