RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Feat: Added toc enhance field to chat and retrieval operator configuration #10436 (#10470)
balibabu198e52e990a8
diff --git a/web/src/components/toc-enhance-form-field.tsx b/web/src/components/toc-enhance-form-field.tsxnew file mode 100644index 0000000000..174d76a1d7--- /dev/null+++ b/web/src/components/toc-enhance-form-field.tsx@@ -0,0 +1,16 @@+import { useTranslation } from 'react-i18next';+import { SwitchFormField } from './switch-fom-field';++type Props = { name: string };++export function TOCEnhanceFormField({ name }: Props) {+ const { t } = useTranslation();++ return (+ <SwitchFormField+ name={name}+ label={t('chat.tocEnhance')}+ tooltip={t('chat.tocEnhanceTip')}+ ></SwitchFormField>+ );+}diff --git a/web/src/locales/en.ts b/web/src/locales/en.tsindex 549dd5dfbd..e0628433ad 100644--- a/web/src/locales/en.ts+++ b/web/src/locales/en.ts@@ -537,10 +537,10 @@ This auto-tagging feature enhances retrieval by adding another layer of domain-ssetAnOpener: 'Opening greeting',setAnOpenerInitial: `Hi! I'm your assistant. What can I do for you?`,setAnOpenerTip: 'Set an opening greeting for users.',- knowledgeBases: 'Knowledge bases',+ knowledgeBases: 'Datasets',knowledgeBasesMessage: 'Please select',knowledgeBasesTip:- 'Select the knowledge bases to associate with this chat assistant. An empty knowledge base will not appear in the dropdown list.',+ 'Select the datasets to associate with this chat assistant. An empty knowledge base will not appear in the dropdown list.',system: 'System prompt',systemInitialValue: `You are an intelligent assistant. Please summarize the content of the knowledge base to answer the question. Please list the data in the knowledge base and answer in detail. When all knowledge base content is irrelevant to the question, your answer must include the sentence "The answer you are looking for is not found in the knowledge base!" Answers need to consider chat history.Here is the knowledge base:@@ -668,6 +668,8 @@ This auto-tagging feature enhances retrieval by adding another layer of domain-s},cancel: 'Cancel',chatSetting: 'Chat setting',+ tocEnhance: 'TOC enhance',+ tocEnhanceTip: ` During the parsing of the document, table of contents information was generated (see the 'Enable Table of Contents Extraction' option in the General method). This allows the large model to return table of contents items relevant to the user's query, thereby using these items to retrieve related chunks and apply weighting to these chunks during the sorting process. This approach is derived from mimicking the behavioral logic of how humans search for knowledge in books.`,},setting: {profile: 'Profile',diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.tsindex d13f3db6cc..3c15e2df77 100644--- a/web/src/locales/zh.ts+++ b/web/src/locales/zh.ts@@ -660,6 +660,8 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于chatSetting: '聊天设置',avatarHidden: '隐藏头像',locale: '地区',+ tocEnhance: '目录增强',+ tocEnhanceTip: `解析文档时生成了目录信息(见General方法的‘启用目录抽取’),让大模型返回和用户问题相关的目录项,从而利用目录项拿到相关chunk,对这些chunk在排序中进行加权。这种方法来源于模仿人类查询书本中知识的行为逻辑`,},setting: {profile: '概要',diff --git a/web/src/pages/agent/constant.tsx b/web/src/pages/agent/constant.tsxindex b40b42e178..3079f3b1a2 100644--- a/web/src/pages/agent/constant.tsx+++ b/web/src/pages/agent/constant.tsx@@ -254,6 +254,7 @@ export const initialRetrievalValues = {...initialSimilarityThresholdValue,...initialKeywordsSimilarityWeightValue,use_kg: false,+ toc_enhance: false,cross_languages: [],outputs: {formalized_content: {diff --git a/web/src/pages/agent/form/retrieval-form/next.tsx b/web/src/pages/agent/form/retrieval-form/next.tsxindex 69204d4da5..67322b2b55 100644--- a/web/src/pages/agent/form/retrieval-form/next.tsx+++ b/web/src/pages/agent/form/retrieval-form/next.tsx@@ -5,6 +5,7 @@ import { KnowledgeBaseFormField } from '@/components/knowledge-base-item';import { RAGFlowFormItem } from '@/components/ragflow-form';import { RerankFormFields } from '@/components/rerank';import { SimilaritySliderFormField } from '@/components/similarity-slider';+import { TOCEnhanceFormField } from '@/components/toc-enhance-form-field';import { TopNFormField } from '@/components/top-n-item';import {Form,@@ -39,6 +40,7 @@ export const RetrievalPartialSchema = {empty_response: z.string(),cross_languages: z.array(z.string()),use_kg: z.boolean(),+ toc_enhance: z.boolean(),};export const FormSchema = z.object({@@ -119,6 +121,7 @@ function RetrievalForm({ node }: INextOperatorForm) {<EmptyResponseField></EmptyResponseField><CrossLanguageFormField name="cross_languages"></CrossLanguageFormField><UseKnowledgeGraphFormField name="use_kg"></UseKnowledgeGraphFormField>+ <TOCEnhanceFormField name="toc_enhance"></TOCEnhanceFormField></FormContainer></Collapse><Output list={outputList}></Output>diff --git a/web/src/pages/agent/form/tool-form/retrieval-form/index.tsx b/web/src/pages/agent/form/tool-form/retrieval-form/index.tsxindex bf187a6bf7..c1031081ec 100644--- a/web/src/pages/agent/form/tool-form/retrieval-form/index.tsx+++ b/web/src/pages/agent/form/tool-form/retrieval-form/index.tsx@@ -4,6 +4,7 @@ import { FormContainer } from '@/components/form-container';import { KnowledgeBaseFormField } from '@/components/knowledge-base-item';import { RerankFormFields } from '@/components/rerank';import { SimilaritySliderFormField } from '@/components/similarity-slider';+import { TOCEnhanceFormField } from '@/components/toc-enhance-form-field';import { TopNFormField } from '@/components/top-n-item';import { Form } from '@/components/ui/form';import { UseKnowledgeGraphFormField } from '@/components/use-knowledge-graph-item';@@ -53,6 +54,7 @@ const RetrievalForm = () => {<EmptyResponseField></EmptyResponseField><CrossLanguageFormField name="cross_languages"></CrossLanguageFormField><UseKnowledgeGraphFormField name="use_kg"></UseKnowledgeGraphFormField>+ <TOCEnhanceFormField name="toc_enhance"></TOCEnhanceFormField></FormContainer></Collapse></FormWrapper>diff --git a/web/src/pages/data-flow/form/parser-form/video-form-fields.tsx b/web/src/pages/data-flow/form/parser-form/video-form-fields.tsxindex d1ca8c68d5..3529588671 100644--- a/web/src/pages/data-flow/form/parser-form/video-form-fields.tsx+++ b/web/src/pages/data-flow/form/parser-form/video-form-fields.tsx@@ -7,8 +7,6 @@ import {export function VideoFormFields({ prefix }: OutputFormatFormFieldProps) {const modelOptions = useComposeLlmOptionsByModelTypes([- LlmModelType.Chat,- LlmModelType.Image2text,LlmModelType.Speech2text,]);diff --git a/web/src/pages/data-flow/form/retrieval-form/next.tsx b/web/src/pages/data-flow/form/retrieval-form/next.tsxdeleted file mode 100644index e69de29bb2..0000000000diff --git a/web/src/pages/next-chats/chat/app-settings/chat-basic-settings.tsx b/web/src/pages/next-chats/chat/app-settings/chat-basic-settings.tsxindex d945f78418..3f06e1818e 100644--- a/web/src/pages/next-chats/chat/app-settings/chat-basic-settings.tsx+++ b/web/src/pages/next-chats/chat/app-settings/chat-basic-settings.tsx@@ -5,6 +5,7 @@ import { KnowledgeBaseFormField } from '@/components/knowledge-base-item';import { MetadataFilter } from '@/components/metadata-filter';import { SwitchFormField } from '@/components/switch-fom-field';import { TavilyFormField } from '@/components/tavily-form-field';+import { TOCEnhanceFormField } from '@/components/toc-enhance-form-field';import {FormControl,FormField,@@ -109,6 +110,7 @@ export default function ChatBasicSetting() {label={t('tts')}tooltip={t('ttsTip')}></SwitchFormField>+ <TOCEnhanceFormField name="prompt_config.toc_enhance"></TOCEnhanceFormField><TavilyFormField></TavilyFormField><KnowledgeBaseFormField></KnowledgeBaseFormField><MetadataFilter></MetadataFilter>diff --git a/web/src/pages/next-chats/chat/app-settings/chat-settings.tsx b/web/src/pages/next-chats/chat/app-settings/chat-settings.tsxindex 50fe9dd850..215285e5df 100644--- a/web/src/pages/next-chats/chat/app-settings/chat-settings.tsx+++ b/web/src/pages/next-chats/chat/app-settings/chat-settings.tsx@@ -49,6 +49,7 @@ export function ChatSettings({ switchSettingVisible }: ChatSettingsProps) {parameters: [],reasoning: false,cross_languages: [],+ toc_enhance: false,},top_n: 8,similarity_threshold: 0.2,diff --git a/web/src/pages/next-chats/chat/app-settings/use-chat-setting-schema.tsx b/web/src/pages/next-chats/chat/app-settings/use-chat-setting-schema.tsxindex 105b880b08..226400775a 100644--- a/web/src/pages/next-chats/chat/app-settings/use-chat-setting-schema.tsx+++ b/web/src/pages/next-chats/chat/app-settings/use-chat-setting-schema.tsx@@ -33,6 +33,7 @@ export function useChatSettingSchema() {tavily_api_key: z.string().optional(),reasoning: z.boolean().optional(),cross_languages: z.array(z.string()).optional(),+ toc_enhance: z.boolean().optional(),});const formSchema = z.object({diff --git a/web/src/pages/next-chats/hooks/use-rename-chat.ts b/web/src/pages/next-chats/hooks/use-rename-chat.tsindex 41f81232d8..bf8fc2fe6c 100644--- a/web/src/pages/next-chats/hooks/use-rename-chat.ts+++ b/web/src/pages/next-chats/hooks/use-rename-chat.ts@@ -34,6 +34,7 @@ export const useRenameChat = () => {use_kg: false,reasoning: false,parameters: [{ key: 'knowledge', optional: false }],+ toc_enhance: false,},llm_id: tenantInfo.data.llm_id,llm_setting: {},