Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Feat: Remove "page index" and "use kg" from chat and retrieval form. (#17627)

balibabu4f058667ff18
diff --git a/web/src/components/toc-enhance-form-field.tsx b/web/src/components/toc-enhance-form-field.tsx
deleted file mode 100644
index 174d76a1d7..0000000000
--- a/web/src/components/toc-enhance-form-field.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-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/components/use-knowledge-graph-item.tsx b/web/src/components/use-knowledge-graph-item.tsx
deleted file mode 100644
index a24f1ee5e3..0000000000
--- a/web/src/components/use-knowledge-graph-item.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { useTranslation } from 'react-i18next';
-import { SwitchFormField } from './switch-fom-field';
-
-interface UseKnowledgeGraphFormFieldProps {
- name: string;
-}
-
-export function UseKnowledgeGraphFormField({
- name,
-}: UseKnowledgeGraphFormFieldProps) {
- const { t } = useTranslation();
-
- return (
- <SwitchFormField
- name={name}
- label={t('chat.useKnowledgeGraph')}
- tooltip={t('chat.useKnowledgeGraphTip')}
- ></SwitchFormField>
- );
-}
diff --git a/web/src/pages/agent/constant/index.tsx b/web/src/pages/agent/constant/index.tsx
index 8474e33817..2ab7360d2f 100644
--- a/web/src/pages/agent/constant/index.tsx
+++ b/web/src/pages/agent/constant/index.tsx
@@ -93,8 +93,6 @@ export const initialRetrievalValues = {
empty_response: '',
...initialSimilarityThresholdValue,
...initialKeywordsSimilarityWeightValue,
- use_kg: false,
- toc_enhance: false,
cross_languages: [],
retrieval_from: RetrievalFrom.Dataset,
outputs: {
diff --git a/web/src/pages/agent/form/retrieval-form/next.tsx b/web/src/pages/agent/form/retrieval-form/next.tsx
index 5392843aee..a68ebc3649 100644
--- a/web/src/pages/agent/form/retrieval-form/next.tsx
+++ b/web/src/pages/agent/form/retrieval-form/next.tsx
@@ -9,7 +9,7 @@ import {
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,
@@ -21,7 +21,7 @@ import {
} from '@/components/ui/form';
import { Radio } from '@/components/ui/radio';
import { Textarea } from '@/components/ui/textarea';
-import { UseKnowledgeGraphFormField } from '@/components/use-knowledge-graph-item';
+
import { zodResolver } from '@hookform/resolvers/zod';
import { memo, useMemo } from 'react';
import {
@@ -51,8 +51,6 @@ export const RetrievalPartialSchema = {
rerank_id: z.string(),
empty_response: z.string(),
cross_languages: z.array(z.string()),
- use_kg: z.boolean(),
- toc_enhance: z.boolean(),
...MetadataFilterSchema,
memory_ids: z.array(z.string()).optional(),
retrieval_from: z.string(),
@@ -188,8 +186,6 @@ function RetrievalForm({ node }: INextOperatorForm) {
{hideKnowledgeGraphField || (
<>
<CrossLanguageFormField name="cross_languages"></CrossLanguageFormField>
- <UseKnowledgeGraphFormField name="use_kg"></UseKnowledgeGraphFormField>
- <TOCEnhanceFormField name="toc_enhance"></TOCEnhanceFormField>
</>
)}
</section>
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.tsx
index 3a2a63e0c9..f77b7b77f7 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,10 +4,10 @@ import { FormContainer } from '@/components/form-container';
import { MetadataFilter } from '@/components/metadata-filter';
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';
+
import { zodResolver } from '@hookform/resolvers/zod';
import { t } from 'i18next';
import { useForm } from 'react-hook-form';
@@ -69,8 +69,6 @@ const RetrievalForm = () => {
{hideKnowledgeGraphField || (
<>
<CrossLanguageFormField name="cross_languages"></CrossLanguageFormField>
- <UseKnowledgeGraphFormField name="use_kg"></UseKnowledgeGraphFormField>
- <TOCEnhanceFormField name="toc_enhance"></TOCEnhanceFormField>
</>
)}
</FormContainer>
diff --git a/web/src/pages/dataset/testing/testing-form.tsx b/web/src/pages/dataset/testing/testing-form.tsx
index 85e69ae8f0..e5d2579666 100644
--- a/web/src/pages/dataset/testing/testing-form.tsx
+++ b/web/src/pages/dataset/testing/testing-form.tsx
@@ -32,7 +32,7 @@ import {
FormMessage,
} from '@/components/ui/form';
import { Textarea } from '@/components/ui/textarea';
-import { UseKnowledgeGraphFormField } from '@/components/use-knowledge-graph-item';
+
import { useTestRetrieval } from '@/hooks/use-knowledge-request';
import { ITestRetrievalRequestBody } from '@/interfaces/request/knowledge';
import { trim } from 'lodash';
@@ -63,7 +63,6 @@ export default function TestingForm({
...similarityThresholdSchema,
...vectorSimilarityWeightSchema,
...topKSchema,
- use_kg: z.boolean().optional(),
dataset_ids: z.array(z.string()).optional(),
...MetadataFilterSchema,
size: z.number().optional(),
@@ -75,7 +74,6 @@ export default function TestingForm({
...initialSimilarityThresholdValue,
...initialVectorSimilarityWeightValue,
...initialTopKValue,
- use_kg: false,
dataset_ids: [knowledgeBaseId],
size: 10,
},
@@ -107,7 +105,6 @@ export default function TestingForm({
<RerankFormFields
ownerTenantId={useKnowledgeBaseContext().knowledgeBase?.tenant_id}
></RerankFormFields>
- <UseKnowledgeGraphFormField name="use_kg"></UseKnowledgeGraphFormField>
<CrossLanguageFormField
name={'cross_languages'}
></CrossLanguageFormField>
diff --git a/web/src/pages/next-chats/chat/app-settings/chat-prompt-engine.tsx b/web/src/pages/next-chats/chat/app-settings/chat-prompt-engine.tsx
index ccf6fd6133..e7eb59642c 100644
--- a/web/src/pages/next-chats/chat/app-settings/chat-prompt-engine.tsx
+++ b/web/src/pages/next-chats/chat/app-settings/chat-prompt-engine.tsx
@@ -7,7 +7,7 @@ import { RerankFormFields } from '@/components/rerank';
import { SimilaritySliderFormField } from '@/components/similarity-slider';
import { SwitchFormField } from '@/components/switch-fom-field';
import { TavilyFormField } from '@/components/tavily-form-field';
-import { TOCEnhanceFormField } from '@/components/toc-enhance-form-field';
+
import { TopNFormField } from '@/components/top-n-item';
import {
FormControl,
@@ -19,7 +19,7 @@ import {
import { MultiSelect } from '@/components/ui/multi-select';
import { Switch } from '@/components/ui/switch';
import { Textarea } from '@/components/ui/textarea';
-import { UseKnowledgeGraphFormField } from '@/components/use-knowledge-graph-item';
+
import { useFetchKnowledgeMetadataKeys } from '@/hooks/use-knowledge-request';
import { prefixName } from '@/utils/form';
import { getDirAttribute } from '@/utils/text-direction';
@@ -127,9 +127,6 @@ export function ChatPromptEngine({ prefix = '' }: ChatPromptEngineProps) {
label={t('chat.tts')}
tooltip={t('chat.ttsTip')}
></SwitchFormField>
- <TOCEnhanceFormField
- name={prefixName(prefix, 'prompt_config.toc_enhance')}
- ></TOCEnhanceFormField>
<TavilyFormField
name={prefixName(prefix, 'prompt_config.tavily_api_key')}
></TavilyFormField>
@@ -221,9 +218,6 @@ export function ChatPromptEngine({ prefix = '' }: ChatPromptEngineProps) {
label={t('chat.multiTurn')}
tooltip={t('chat.multiTurnTip')}
></SwitchFormField>
- <UseKnowledgeGraphFormField
- name={prefixName(prefix, 'prompt_config.use_kg')}
- ></UseKnowledgeGraphFormField>
<RerankFormFields prefix={prefix}></RerankFormFields>
<CrossLanguageFormField
name={prefixName(prefix, 'prompt_config.cross_languages')}
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.tsx
index 4063549ded..db09351335 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
@@ -50,13 +50,11 @@ export function ChatSettings({ hasSingleChatBox }: ChatSettingsProps) {
quote: true,
keyword: false,
tts: false,
- use_kg: false,
refine_multiturn: true,
system: '',
parameters: [],
reasoning: false,
cross_languages: [],
- toc_enhance: false,
reference_metadata: {
include: false,
fields: undefined,
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.tsx
index f80ab79b7b..75181ec7da 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
@@ -23,7 +23,6 @@ export function useChatSettingSchema() {
prologue: z.string().optional(),
system: z.string().min(1, { message: t('systemMessage') }),
refine_multiturn: z.boolean(),
- use_kg: z.boolean(),
parameters: z
.array(
z.object({
@@ -35,7 +34,6 @@ 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(),
reference_metadata: z
.object({
include: z.boolean().optional(),