Skip to content

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

fix(web): show builtin chunk methods in file pipeline dialog under Go backend (#17169)

euvrea81b5057bba0
diff --git a/web/src/components/chunk-method-dialog/hooks.ts b/web/src/components/chunk-method-dialog/hooks.ts
index 0dd5a7fee3..ef24872f2a 100644
--- a/web/src/components/chunk-method-dialog/hooks.ts
+++ b/web/src/components/chunk-method-dialog/hooks.ts
@@ -1,108 +1,4 @@
-import { useSelectParserList } from '@/hooks/use-user-setting-request';
-import { useCallback, useMemo } from 'react';
-
-const ParserListMap = new Map([
- [
- ['pdf'],
- [
- 'naive',
- 'resume',
- 'manual',
- 'paper',
- 'book',
- 'laws',
- 'presentation',
- 'one',
- 'qa',
- 'knowledge_graph',
- ],
- ],
- [
- ['doc', 'docx'],
- [
- 'naive',
- 'resume',
- 'book',
- 'laws',
- 'one',
- 'qa',
- 'manual',
- 'knowledge_graph',
- ],
- ],
- [
- ['xlsx', 'xls'],
- ['naive', 'qa', 'table', 'one', 'knowledge_graph'],
- ],
- [['ppt', 'pptx'], ['presentation']],
- [
- ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'tif', 'tiff', 'webp', 'svg', 'ico'],
- ['picture'],
- ],
- [
- ['txt'],
- [
- 'naive',
- 'resume',
- 'book',
- 'laws',
- 'one',
- 'qa',
- 'table',
- 'knowledge_graph',
- ],
- ],
- [
- ['csv'],
- [
- 'naive',
- 'resume',
- 'book',
- 'laws',
- 'one',
- 'qa',
- 'table',
- 'knowledge_graph',
- ],
- ],
- [
- ['md', 'mdx'],
- ['naive', 'qa', 'knowledge_graph'],
- ],
- [['json'], ['naive', 'knowledge_graph']],
- [['eml'], ['email']],
-]);
-
-const getParserList = (
- values: string[],
- parserList: Array<{
- value: string;
- label: string;
- }>,
-) => {
- return parserList.filter((x) => values?.some((y) => y === x.value));
-};
-
-export const useFetchParserListOnMount = (documentExtension: string) => {
- const parserList = useSelectParserList();
-
- const nextParserList = useMemo(() => {
- const key = [...ParserListMap.keys()].find((x) =>
- x.some((y) => y === documentExtension),
- );
- if (key) {
- const values = ParserListMap.get(key);
- return getParserList(values ?? [], parserList);
- }
-
- return getParserList(
- ['naive', 'resume', 'book', 'laws', 'one', 'qa', 'table'],
- parserList,
- );
- }, [parserList, documentExtension]);
-
- return { parserList: nextParserList };
-};
+import { useCallback } from 'react';
const hideAutoKeywords = ['qa', 'table', 'resume', 'knowledge_graph', 'tag'];
diff --git a/web/src/hooks/use-user-setting-request.tsx b/web/src/hooks/use-user-setting-request.tsx
index 35b957c519..0e3162a631 100644
--- a/web/src/hooks/use-user-setting-request.tsx
+++ b/web/src/hooks/use-user-setting-request.tsx
@@ -163,12 +163,15 @@ export const useSelectParserList = (): Array<{
const parserList = useMemo(() => {
// Go backend: prefer the dynamic pipeline catalog from the API.
+ // GET /api/v1/pipelines?type=builtin responds with
+ // { code, data: { canvas: [{ id, title, description, filename }], total } }.
if (backendLang === 'go') {
const pipelineList: Array<{
- parser_id: string;
+ id: string;
title: string;
- dsl: Record<string, any>;
- }> = pipelineListData?.data ?? [];
+ description?: string;
+ filename?: string;
+ }> = pipelineListData?.data?.canvas ?? [];
if (pipelineList.length > 0) {
const labelFromAPI = (parserId: string, title: string) => {
const key = `knowledgeConfiguration.parserLabel.${parserId}`;
@@ -176,8 +179,8 @@ export const useSelectParserList = (): Array<{
return translated !== key ? translated : title;
};
return pipelineList.map((item) => ({
- value: item.parser_id,
- label: labelFromAPI(item.parser_id, item.title),
+ value: item.id,
+ label: labelFromAPI(item.id, item.title),
}));
}
}