From 2beafdc457fce09bc7b67cb9d16d69dc0f1f50b1 Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 23 Jul 2026 18:01:43 +0800 Subject: [PATCH] fix: chat not pass doc if not support vision (#39461) --- .../configuration/config/config-document.tsx | 4 +-- .../__tests__/index.spec.tsx | 33 ++++++++++++++++--- .../debug/debug-with-single-model/index.tsx | 10 +----- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/web/app/components/app/configuration/config/config-document.tsx b/web/app/components/app/configuration/config/config-document.tsx index 47ee9ef4f3b..33c81eb34b6 100644 --- a/web/app/components/app/configuration/config/config-document.tsx +++ b/web/app/components/app/configuration/config/config-document.tsx @@ -45,7 +45,7 @@ const ConfigDocument: FC = () => { if (!isShowDocumentConfig || (readonly && !isDocumentEnabled)) return null return ( -
+
@@ -64,7 +64,7 @@ const ConfigDocument: FC = () => {
{!readonly && (
-
+
)} diff --git a/web/app/components/app/configuration/debug/debug-with-single-model/__tests__/index.spec.tsx b/web/app/components/app/configuration/debug/debug-with-single-model/__tests__/index.spec.tsx index dfe38c7cc0b..e2b9e16c4af 100644 --- a/web/app/components/app/configuration/debug/debug-with-single-model/__tests__/index.spec.tsx +++ b/web/app/components/app/configuration/debug/debug-with-single-model/__tests__/index.spec.tsx @@ -16,6 +16,7 @@ import { ModelTypeEnum, } from '@/app/components/header/account-setting/model-provider-page/declarations' import { CollectionType } from '@/app/components/tools/types' +import { SupportUploadFileTypes } from '@/app/components/workflow/types' import { PromptMode } from '@/models/debug' import { renderWithAccountProfile as render } from '@/test/console/account-profile' import { AgentStrategy, AppModeEnum, ModelModeType, Resolution, TransferMethod } from '@/types/app' @@ -461,6 +462,16 @@ const mockFile: FileEntity = { supportFileType: 'image', } +const mockDocumentFile: FileEntity = { + id: 'file-2', + name: 'test.pdf', + size: 456, + type: 'application/pdf', + progress: 100, + transferMethod: TransferMethod.local_file, + supportFileType: SupportUploadFileTypes.document, +} + // Mock Chat component (complex with many dependencies) // This is a pragmatic mock that tests the integration at DebugWithSingleModel level vi.mock('@/app/components/base/chat/chat', () => ({ @@ -519,6 +530,13 @@ vi.mock('@/app/components/base/chat/chat', () => ({ > Send With Files + {isResponding && (