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
Fix: After clearing the data in the agent list, the corresponding filter data must also be cleared. (#19336)
balibabub4acb95cbdf0
diff --git a/web/src/components/list-filter-bar/use-handle-filter-submit.ts b/web/src/components/list-filter-bar/use-handle-filter-submit.tsindex aa3ec41304..6fced36903 100644--- a/web/src/components/list-filter-bar/use-handle-filter-submit.ts+++ b/web/src/components/list-filter-bar/use-handle-filter-submit.ts@@ -15,6 +15,7 @@*/import { useGetPaginationWithRouter } from '@/hooks/logic-hooks';+import { isEqual } from 'lodash';import { useCallback, useState } from 'react';import {FilterChange,@@ -42,13 +43,19 @@ const mergeFilterValue = (filterValue: FilterValue,ids: string[],): FilterValue => {- const value = {} as FilterValue;+ const value: FilterValue = {};for (const key in filterValue) {- if (Array.isArray(filterValue[key])) {- const keyIds = filterValue[key] as string[];- value[key] = ids.filter((id) => keyIds.includes(id));- } else if (typeof filterValue[key] === 'object') {- value[key] = mergeFilterValue(filterValue[key], ids);+ const fieldValue = filterValue[key];+ if (Array.isArray(fieldValue)) {+ value[key] = ids.filter((id) => fieldValue.includes(id));+ } else {+ const nestedValue: Record<string, string[]> = {};+ for (const nestedKey in fieldValue) {+ nestedValue[nestedKey] = ids.filter((id) =>+ fieldValue[nestedKey].includes(id),+ );+ }+ value[key] = nestedValue;}}return value;@@ -81,7 +88,7 @@ export function useHandleFilterSubmit() {if (!preValue) return preValue;const newValue: FilterValue = mergeFilterValue(preValue, validFields);- return newValue;+ return isEqual(newValue, preValue) ? preValue : newValue;});}, []);diff --git a/web/src/hooks/use-agent-request.ts b/web/src/hooks/use-agent-request.tsindex f471a1b52a..3d4e89f986 100644--- a/web/src/hooks/use-agent-request.ts+++ b/web/src/hooks/use-agent-request.ts@@ -176,7 +176,7 @@ export const useFetchAgentListByPage = () => {useHandleSearchChange();const { pagination, setPagination } = useGetPaginationWithRouter();const debouncedSearchString = useDebounce(searchString, { wait: 500 });- const { filterValue, setFilterValue, handleFilterSubmit } =+ const { filterValue, setFilterValue, handleFilterSubmit, checkValue } =useHandleFilterSubmit();const canvasCategoryIds = Array.isArray(filterValue.canvasCategory)? (filterValue.canvasCategory as string[])@@ -240,6 +240,7 @@ export const useFetchAgentListByPage = () => {filterValue,setFilterValue,handleFilterSubmit,+ checkValue,};};diff --git a/web/src/locales/en.ts b/web/src/locales/en.tsindex 8f9e6897e1..86d665914f 100644--- a/web/src/locales/en.ts+++ b/web/src/locales/en.ts@@ -2364,7 +2364,7 @@ Example: Virtual Hosted Style`,compilationTitleSuffix: "' dataset",llmWiki: 'Wiki',skills: 'To Skills',- navTree: 'Tree/Page index',+ navTree: 'Tree/PageIndex',graph: 'Graph',structureMindmap: 'Mind map',structureTimeline: 'Timeline',diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.tsindex 7b03bc9958..a78098d885 100644--- a/web/src/locales/zh.ts+++ b/web/src/locales/zh.ts@@ -1987,7 +1987,7 @@ NER:使用 spaCy NER 和基于规则的关键词提取来抽取 Entities 和 RcompilationTitleSuffix: '的数据集',llmWiki: 'Wiki',skills: 'To Skills',- navTree: 'Tree/Page index',+ navTree: 'Tree/PageIndex',graph: 'Graph',structureMindmap: 'Mindmap',structureTimeline: 'Timeline',diff --git a/web/src/pages/agents/hooks/use-select-filters.ts b/web/src/pages/agents/hooks/use-select-filters.tsindex 7a2a448641..a8aec4300d 100644--- a/web/src/pages/agents/hooks/use-select-filters.ts+++ b/web/src/pages/agents/hooks/use-select-filters.ts@@ -23,48 +23,52 @@ export function useSelectFilters() {[tagCounts],);- const filters: FilterCollection[] = [- {- field: 'owner',- list: agentFilters?.owner,- label: t('common.owner'),- },- {- field: 'canvasCategory',- list: [- {- id: AgentCategory.DataflowCanvas,- label: t('flow.tabList.ingestionPipeline'),- count:- agentFilters?.canvas_category.find(- (item) => item.id === AgentCategory.DataflowCanvas,- )?.count ?? 0,- },- {- id: AgentListItemType.CompilationTemplateGroup,- label: t('flow.tabList.compilationOperator'),- count:- agentFilters?.canvas_category.find(- (item) => item.id === AgentListItemType.CompilationTemplateGroup,- )?.count ?? 0,- },- {- id: AgentCategory.AgentCanvas,- label: t('flow.tabList.workflow'),- count:- agentFilters?.canvas_category.find(- (item) => item.id === AgentCategory.AgentCanvas,- )?.count ?? 0,- },- ],- label: t('flow.canvasCategory'),- },- {- field: 'tags',- list: tagList,- label: t('flow.tags'),- },- ];+ const filters: FilterCollection[] = useMemo(+ () => [+ {+ field: 'owner',+ list: agentFilters?.owner,+ label: t('common.owner'),+ },+ {+ field: 'canvasCategory',+ list: [+ {+ id: AgentCategory.DataflowCanvas,+ label: t('flow.tabList.ingestionPipeline'),+ count:+ agentFilters?.canvas_category.find(+ (item) => item.id === AgentCategory.DataflowCanvas,+ )?.count ?? 0,+ },+ {+ id: AgentListItemType.CompilationTemplateGroup,+ label: t('flow.tabList.compilationOperator'),+ count:+ agentFilters?.canvas_category.find(+ (item) =>+ item.id === AgentListItemType.CompilationTemplateGroup,+ )?.count ?? 0,+ },+ {+ id: AgentCategory.AgentCanvas,+ label: t('flow.tabList.workflow'),+ count:+ agentFilters?.canvas_category.find(+ (item) => item.id === AgentCategory.AgentCanvas,+ )?.count ?? 0,+ },+ ],+ label: t('flow.canvasCategory'),+ },+ {+ field: 'tags',+ list: tagList,+ label: t('flow.tags'),+ },+ ],+ [agentFilters, tagList, t],+ );return filters;}diff --git a/web/src/pages/agents/index.tsx b/web/src/pages/agents/index.tsxindex 65efc4be32..7eb189d6aa 100644--- a/web/src/pages/agents/index.tsx+++ b/web/src/pages/agents/index.tsx@@ -47,6 +47,7 @@ export default function Agents() {filterValue,setFilterValue,handleFilterSubmit,+ checkValue,} = useFetchAgentListByPage();const { navigateToAgentTemplates } = useNavigatePage();@@ -80,6 +81,10 @@ export default function Agents() {const filters = useSelectFilters();+ useEffect(() => {+ checkValue(filters);+ }, [filters, checkValue]);+const handlePageChange = useCallback((page: number, pageSize?: number) => {setPagination({ page, pageSize });