From a135f9f5b6510f6062a21d95201e97907b616402 Mon Sep 17 00:00:00 2001 From: balibabu Date: Wed, 29 May 2024 16:19:08 +0800 Subject: [PATCH] feat: add rerank models to the project #724 #162 (#966) ### What problem does this PR solve? Vector similarity weight is displayed incorrectly #965 feat: add rerank models to the project #724 #162 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/components/rerank.tsx | 57 +++++++++++++++++++ .../components/similarity-slider/index.tsx | 2 +- web/src/constants/knowledge.ts | 1 + web/src/hooks/llmHooks.ts | 1 + web/src/interfaces/database/chat.ts | 2 + web/src/locales/en.ts | 17 ++++-- web/src/locales/zh-traditional.ts | 14 +++-- web/src/locales/zh.ts | 14 +++-- .../components/knowledge-testing/index.tsx | 5 +- .../testing-control/index.tsx | 9 +++ .../chat/chat-configuration-modal/hooks.ts | 11 ++++ .../chat/chat-configuration-modal/index.tsx | 6 +- .../model-setting.tsx | 8 +-- .../prompt-engine.tsx | 3 +- .../system-model-setting-modal/index.tsx | 7 +++ 15 files changed, 132 insertions(+), 25 deletions(-) create mode 100644 web/src/components/rerank.tsx diff --git a/web/src/components/rerank.tsx b/web/src/components/rerank.tsx new file mode 100644 index 000000000..e78fa3aff --- /dev/null +++ b/web/src/components/rerank.tsx @@ -0,0 +1,57 @@ +import { LlmModelType } from '@/constants/knowledge'; +import { useTranslate } from '@/hooks/commonHooks'; +import { useSelectLlmOptionsByModelType } from '@/hooks/llmHooks'; +import { Form, Select, Slider } from 'antd'; + +type FieldType = { + rerank_id?: string; + top_k?: number; +}; + +export const RerankItem = () => { + const { t } = useTranslate('knowledgeDetails'); + const allOptions = useSelectLlmOptionsByModelType(); + + return ( + + + + +