From 24ca1bc7a7294ba6578373e450455e2c67443768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E9=98=BF=E6=B1=9F=28Relakkes?= =?UTF-8?q?=29?= Date: Tue, 29 Sep 2026 16:18:47 +0800 Subject: [PATCH] fix(desktop): describe request-too-large rejections accurately The localized copy for a request-too-large rejection blamed the selected model and told users to delete large files. The limit belongs to the provider or relay, and the runtime now removes earlier images and documents by itself on the next message, so say that and point to compacting or a new session if the request still fails. Refs #1399 --- .../src/components/chat/MessageList.test.tsx | 37 +++++++++++++++++++ desktop/src/i18n/locales/en.ts | 2 +- desktop/src/i18n/locales/jp.ts | 2 +- desktop/src/i18n/locales/kr.ts | 2 +- desktop/src/i18n/locales/zh-TW.ts | 2 +- desktop/src/i18n/locales/zh.ts | 2 +- 6 files changed, 42 insertions(+), 5 deletions(-) diff --git a/desktop/src/components/chat/MessageList.test.tsx b/desktop/src/components/chat/MessageList.test.tsx index 127d958b..c5292da7 100644 --- a/desktop/src/components/chat/MessageList.test.tsx +++ b/desktop/src/components/chat/MessageList.test.tsx @@ -7942,6 +7942,43 @@ describe('MessageList nested tool calls', () => { expect(screen.queryByText(/This model does not support images/)).toBeNull() }) + it.each([ + ['en', /too large for your provider or relay/, /removed automatically/], + ['zh', /服务商或中转站允许的大小/, /自动移除/], + ] as const)( + 'explains a request-too-large rejection as a provider limit and the recovery that follows (%s)', + (locale, limit, recovery) => { + useSettingsStore.setState({ locale }) + useChatStore.setState({ + sessions: { + [ACTIVE_TAB]: makeSessionState({ + messages: [ + { + id: 'error-1', + type: 'error', + code: 'invalid_request', + businessErrorCode: 'request_too_large', + message: + 'Request too large: your provider or relay rejected it (HTTP 413). This conversation is about 24MB.', + timestamp: 1, + }, + ], + }), + }, + }) + + render() + + expect(screen.getByText(limit)).toBeTruthy() + expect(screen.getByText(recovery)).toBeTruthy() + // The old copy blamed the selected model and asked users to delete files + // by hand, although the limit belongs to the provider and old media is + // now dropped automatically. + expect(screen.queryByText(/selected model|当前模型/)).toBeNull() + expect(screen.queryByText(/Remove large files|移除大文件/)).toBeNull() + }, + ) + it('restores opener focus without scrolling when its render item remains fully visible', async () => { useChatStore.setState({ sessions: { diff --git a/desktop/src/i18n/locales/en.ts b/desktop/src/i18n/locales/en.ts index cf625384..c9f2ed1d 100644 --- a/desktop/src/i18n/locales/en.ts +++ b/desktop/src/i18n/locales/en.ts @@ -3622,7 +3622,7 @@ Row 9, all 8 cells: continuing from straight down, turning left through lower-le 'businessError.pdf_invalid': 'The PDF file is not valid. Convert it to text or send a different file.', 'businessError.image_too_large': 'The image is too large for the selected model. Resize it or send a smaller image.', 'businessError.image_unsupported': 'This model does not support images. Continue with text, or switch to a vision-capable model and send the image again.', - 'businessError.request_too_large': 'The request is too large for the selected model. Remove large files or retry with a smaller message.', + 'businessError.request_too_large': 'The request is too large for your provider or relay. Earlier images and documents are removed automatically on your next message; if it still fails, compact the conversation or start a new session.', 'businessError.prompt_too_long': 'The prompt is too long for the selected model. Compact the conversation or retry with less context.', 'businessError.auto_mode_unavailable': 'Auto mode is unavailable for your current plan.', diff --git a/desktop/src/i18n/locales/jp.ts b/desktop/src/i18n/locales/jp.ts index 1fb4f81e..54052c22 100644 --- a/desktop/src/i18n/locales/jp.ts +++ b/desktop/src/i18n/locales/jp.ts @@ -3623,7 +3623,7 @@ export const jp: Record = { 'businessError.pdf_invalid': 'PDF ファイルが無効です。テキストに変換するか、別のファイルを送信してください。', 'businessError.image_too_large': '画像が選択したモデルには大きすぎます。サイズを変更するか、より小さい画像を送信してください。', 'businessError.image_unsupported': 'このモデルは画像をサポートしていません。テキストで続行するか、ビジョン対応モデルに切り替えて画像を再送信してください。', - 'businessError.request_too_large': 'リクエストが選択したモデルには大きすぎます。大きなファイルを削除するか、より短いメッセージで再試行してください。', + 'businessError.request_too_large': 'リクエストがプロバイダーまたは中継サービスの許容サイズを超えました。次のメッセージで以前の画像とドキュメントが自動的に削除されます。それでも失敗する場合は、会話を圧縮するか、新しいセッションを開始してください。', 'businessError.prompt_too_long': 'プロンプトが選択したモデルには長すぎます。会話を圧縮するか、コンテキストを減らして再試行してください。', 'businessError.auto_mode_unavailable': '自動モードは現在のプランでは利用できません。', diff --git a/desktop/src/i18n/locales/kr.ts b/desktop/src/i18n/locales/kr.ts index 89373906..f1a0956e 100644 --- a/desktop/src/i18n/locales/kr.ts +++ b/desktop/src/i18n/locales/kr.ts @@ -3625,7 +3625,7 @@ export const kr: Record = { 'businessError.pdf_invalid': 'PDF 파일이 유효하지 않습니다. 텍스트로 변환하거나 다른 파일을 보내세요.', 'businessError.image_too_large': '이미지가 선택한 모델에 비해 너무 큽니다. 크기를 조정하거나 더 작은 이미지를 보내세요.', 'businessError.image_unsupported': '이 모델은 이미지를 지원하지 않습니다. 텍스트로 계속하거나, 비전 지원 모델로 전환하여 이미지를 다시 보내세요.', - 'businessError.request_too_large': '요청이 선택한 모델에 비해 너무 큽니다. 큰 파일을 제거하거나 더 짧은 메시지로 다시 시도하세요.', + 'businessError.request_too_large': '요청이 공급자 또는 중계 서버가 허용하는 크기를 초과했습니다. 다음 메시지에서 이전 이미지와 문서가 자동으로 제거됩니다. 그래도 실패하면 대화를 압축하거나 새 세션을 시작하세요.', 'businessError.prompt_too_long': '프롬프트가 선택한 모델에 비해 너무 깁니다. 대화를 압축하거나 컨텍스트를 줄여 다시 시도하세요.', 'businessError.auto_mode_unavailable': '자동 모드는 현재 요금제에서 사용할 수 없습니다.', diff --git a/desktop/src/i18n/locales/zh-TW.ts b/desktop/src/i18n/locales/zh-TW.ts index 27831c77..36170619 100644 --- a/desktop/src/i18n/locales/zh-TW.ts +++ b/desktop/src/i18n/locales/zh-TW.ts @@ -3622,7 +3622,7 @@ export const zh: Record = { 'businessError.pdf_invalid': '這個 PDF 檔案無效。請先轉成文字,或換一個檔案傳送。', 'businessError.image_too_large': '這張圖片超出了當前模型可處理的大小。請壓縮圖片,或換一張更小的圖片。', 'businessError.image_unsupported': '當前模型不支援圖片。請繼續使用文字,或切換到支援視覺的模型後重新傳送圖片。', - 'businessError.request_too_large': '這次請求超出了當前模型可處理的大小。請移除大檔案,或縮短訊息後重試。', + 'businessError.request_too_large': '這次請求超出了服務商或中轉站允許的大小。下一則訊息會自動移除較早的圖片和文件;如果仍然失敗,請壓縮會話或新開會話。', 'businessError.prompt_too_long': '當前上下文超出了模型限制。請先壓縮會話,或減少上下文後重試。', 'businessError.auto_mode_unavailable': '當前套餐不支援自動模式。', diff --git a/desktop/src/i18n/locales/zh.ts b/desktop/src/i18n/locales/zh.ts index 6cd47d2e..624a6dd0 100644 --- a/desktop/src/i18n/locales/zh.ts +++ b/desktop/src/i18n/locales/zh.ts @@ -3621,7 +3621,7 @@ export const zh: Record = { 'businessError.pdf_invalid': '这个 PDF 文件无效。请先转成文本,或换一个文件发送。', 'businessError.image_too_large': '这张图片超出了当前模型可处理的大小。请压缩图片,或换一张更小的图片。', 'businessError.image_unsupported': '当前模型不支持图片。请继续使用文字,或切换到支持视觉的模型后重新发送图片。', - 'businessError.request_too_large': '这次请求超出了当前模型可处理的大小。请移除大文件,或缩短消息后重试。', + 'businessError.request_too_large': '这次请求超出了服务商或中转站允许的大小。下一条消息会自动移除较早的图片和文档;如果仍然失败,请压缩会话或新开会话。', 'businessError.prompt_too_long': '当前上下文超出了模型限制。请先压缩会话,或减少上下文后重试。', 'businessError.auto_mode_unavailable': '当前套餐不支持自动模式。',