From 37cc673098284746703e2fcd5106a199c5dc9940 Mon Sep 17 00:00:00 2001 From: balibabu Date: Thu, 28 Mar 2024 11:42:40 +0800 Subject: [PATCH] feat: set the object-fit attribute of the chunk image to contain so that the image is not stretched and if the chunk number of the knowledge base is greater than 0, set the embedding model to disabled (#160) * feat: if the chunk number of the knowledge base is greater than 0, set the embedding model to disabled * feat: set the object-fit attribute of the chunk image to contain so that the image is not stretched --- web/src/components/max-token-number.tsx | 2 +- .../knowledge-chunk/components/chunk-card/index.less | 6 ++++-- .../knowledge-chunk/components/chunk-card/index.tsx | 2 +- .../components/knowledge-setting/configuration.tsx | 5 +++-- .../add-knowledge/components/knowledge-setting/hooks.ts | 8 +++++--- web/src/pages/chat/chat-container/index.less | 8 ++++++-- web/src/pages/chat/chat-container/index.tsx | 2 +- 7 files changed, 21 insertions(+), 12 deletions(-) diff --git a/web/src/components/max-token-number.tsx b/web/src/components/max-token-number.tsx index 70eb44c198..43618be4fc 100644 --- a/web/src/components/max-token-number.tsx +++ b/web/src/components/max-token-number.tsx @@ -3,7 +3,7 @@ import { Flex, Form, InputNumber, Slider } from 'antd'; const MaxTokenNumber = () => { return ( diff --git a/web/src/pages/add-knowledge/components/knowledge-chunk/components/chunk-card/index.less b/web/src/pages/add-knowledge/components/knowledge-chunk/components/chunk-card/index.less index 956caaa73a..9bb4f5b4a1 100644 --- a/web/src/pages/add-knowledge/components/knowledge-chunk/components/chunk-card/index.less +++ b/web/src/pages/add-knowledge/components/knowledge-chunk/components/chunk-card/index.less @@ -1,10 +1,12 @@ .image { width: 100px !important; - min-width: 100px; + object-fit: contain; } .imagePreview { - width: 600px; + max-width: 50vw; + max-height: 50vh; + object-fit: contain; } .content { diff --git a/web/src/pages/add-knowledge/components/knowledge-chunk/components/chunk-card/index.tsx b/web/src/pages/add-knowledge/components/knowledge-chunk/components/chunk-card/index.tsx index c1aaf2c73c..d1d9106da5 100644 --- a/web/src/pages/add-knowledge/components/knowledge-chunk/components/chunk-card/index.tsx +++ b/web/src/pages/add-knowledge/components/knowledge-chunk/components/chunk-card/index.tsx @@ -55,7 +55,7 @@ const ChunkCard = ({ {item.img_id && ( } diff --git a/web/src/pages/add-knowledge/components/knowledge-setting/configuration.tsx b/web/src/pages/add-knowledge/components/knowledge-setting/configuration.tsx index 96991c5723..f772eb25ae 100644 --- a/web/src/pages/add-knowledge/components/knowledge-setting/configuration.tsx +++ b/web/src/pages/add-knowledge/components/knowledge-setting/configuration.tsx @@ -15,7 +15,7 @@ const { Option } = Select; const ConfigurationForm = ({ form }: { form: FormInstance }) => { const { submitKnowledgeConfiguration, submitLoading } = useSubmitKnowledgeConfiguration(); - const { parserList, embeddingModelOptions } = + const { parserList, embeddingModelOptions, disabled } = useFetchKnowledgeConfigurationOnMount(form); const onFinishFailed = (errorInfo: any) => { @@ -90,6 +90,7 @@ const ConfigurationForm = ({ form }: { form: FormInstance }) => { { tooltip="The instruction is at right." rules={[{ required: true }]} > - {parserList.map((x) => (