From 8c9831177a9353d7e0a54616288fe69c023d4628 Mon Sep 17 00:00:00 2001 From: Zixuan Cheng <61724187+Theysua@users.noreply.github.com> Date: Thu, 19 Mar 2026 19:49:12 -0700 Subject: [PATCH 1/4] fix(api): preserve citation metadata in web responses (#33778) Co-authored-by: AI Assistant --- .../base_app_generate_response_converter.py | 11 +++++++ ..._agent_chat_generate_response_converter.py | 33 +++++++++++++++++++ ..._completion_generate_response_converter.py | 16 +++++++++ 3 files changed, 60 insertions(+) diff --git a/api/core/app/apps/base_app_generate_response_converter.py b/api/core/app/apps/base_app_generate_response_converter.py index 77950a832a..a92e3dd2ea 100644 --- a/api/core/app/apps/base_app_generate_response_converter.py +++ b/api/core/app/apps/base_app_generate_response_converter.py @@ -74,11 +74,22 @@ class AppGenerateResponseConverter(ABC): for resource in metadata["retriever_resources"]: updated_resources.append( { + "dataset_id": resource.get("dataset_id"), + "dataset_name": resource.get("dataset_name"), + "document_id": resource.get("document_id"), "segment_id": resource.get("segment_id", ""), "position": resource["position"], + "data_source_type": resource.get("data_source_type"), "document_name": resource["document_name"], "score": resource["score"], + "hit_count": resource.get("hit_count"), + "word_count": resource.get("word_count"), + "segment_position": resource.get("segment_position"), + "index_node_hash": resource.get("index_node_hash"), "content": resource["content"], + "page": resource.get("page"), + "title": resource.get("title"), + "files": resource.get("files"), "summary": resource.get("summary"), } ) diff --git a/api/tests/unit_tests/core/app/apps/agent_chat/test_agent_chat_generate_response_converter.py b/api/tests/unit_tests/core/app/apps/agent_chat/test_agent_chat_generate_response_converter.py index 02a1e04c98..e861a0c684 100644 --- a/api/tests/unit_tests/core/app/apps/agent_chat/test_agent_chat_generate_response_converter.py +++ b/api/tests/unit_tests/core/app/apps/agent_chat/test_agent_chat_generate_response_converter.py @@ -44,11 +44,22 @@ class TestAgentChatAppGenerateResponseConverterBlocking: metadata={ "retriever_resources": [ { + "dataset_id": "dataset-1", + "dataset_name": "Dataset 1", + "document_id": "document-1", "segment_id": "s1", "position": 1, + "data_source_type": "file", "document_name": "doc", "score": 0.9, + "hit_count": 2, + "word_count": 128, + "segment_position": 3, + "index_node_hash": "abc1234", "content": "content", + "page": 5, + "title": "Citation Title", + "files": [{"id": "file-1"}], } ], "annotation_reply": {"id": "a"}, @@ -107,11 +118,22 @@ class TestAgentChatAppGenerateResponseConverterStream: metadata={ "retriever_resources": [ { + "dataset_id": "dataset-1", + "dataset_name": "Dataset 1", + "document_id": "document-1", "segment_id": "s1", "position": 1, + "data_source_type": "file", "document_name": "doc", "score": 0.9, + "hit_count": 2, + "word_count": 128, + "segment_position": 3, + "index_node_hash": "abc1234", "content": "content", + "page": 5, + "title": "Citation Title", + "files": [{"id": "file-1"}], "summary": "summary", "extra": "ignored", } @@ -151,11 +173,22 @@ class TestAgentChatAppGenerateResponseConverterStream: assert "usage" not in metadata assert metadata["retriever_resources"] == [ { + "dataset_id": "dataset-1", + "dataset_name": "Dataset 1", + "document_id": "document-1", "segment_id": "s1", "position": 1, + "data_source_type": "file", "document_name": "doc", "score": 0.9, + "hit_count": 2, + "word_count": 128, + "segment_position": 3, + "index_node_hash": "abc1234", "content": "content", + "page": 5, + "title": "Citation Title", + "files": [{"id": "file-1"}], "summary": "summary", } ] diff --git a/api/tests/unit_tests/core/app/apps/completion/test_completion_generate_response_converter.py b/api/tests/unit_tests/core/app/apps/completion/test_completion_generate_response_converter.py index cf473dfbeb..0136dbf5ad 100644 --- a/api/tests/unit_tests/core/app/apps/completion/test_completion_generate_response_converter.py +++ b/api/tests/unit_tests/core/app/apps/completion/test_completion_generate_response_converter.py @@ -38,11 +38,22 @@ class TestCompletionAppGenerateResponseConverter: metadata = { "retriever_resources": [ { + "dataset_id": "dataset-1", + "dataset_name": "Dataset 1", + "document_id": "document-1", "segment_id": "s", "position": 1, + "data_source_type": "file", "document_name": "doc", "score": 0.9, + "hit_count": 2, + "word_count": 128, + "segment_position": 3, + "index_node_hash": "abc1234", "content": "c", + "page": 5, + "title": "Citation Title", + "files": [{"id": "file-1"}], "summary": "sum", "extra": "x", } @@ -66,7 +77,12 @@ class TestCompletionAppGenerateResponseConverter: assert "annotation_reply" not in result["metadata"] assert "usage" not in result["metadata"] + assert result["metadata"]["retriever_resources"][0]["dataset_id"] == "dataset-1" + assert result["metadata"]["retriever_resources"][0]["document_id"] == "document-1" assert result["metadata"]["retriever_resources"][0]["segment_id"] == "s" + assert result["metadata"]["retriever_resources"][0]["data_source_type"] == "file" + assert result["metadata"]["retriever_resources"][0]["segment_position"] == 3 + assert result["metadata"]["retriever_resources"][0]["index_node_hash"] == "abc1234" assert "extra" not in result["metadata"]["retriever_resources"][0] def test_convert_blocking_simple_response_metadata_not_dict(self): From 40eacf8f3252e023ef089830cb3af7cc7c8e82d0 Mon Sep 17 00:00:00 2001 From: Lubrsy Date: Fri, 20 Mar 2026 11:03:35 +0800 Subject: [PATCH 2/4] fix: stop think block timer in historical conversations (#33083) Co-authored-by: Claude Opus 4.6 --- .../__tests__/think-block.spec.tsx | 17 ++++------------- .../base/markdown-blocks/think-block.tsx | 10 +++++----- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/web/app/components/base/markdown-blocks/__tests__/think-block.spec.tsx b/web/app/components/base/markdown-blocks/__tests__/think-block.spec.tsx index e8b956cbbf..4f22468157 100644 --- a/web/app/components/base/markdown-blocks/__tests__/think-block.spec.tsx +++ b/web/app/components/base/markdown-blocks/__tests__/think-block.spec.tsx @@ -163,25 +163,16 @@ describe('ThinkBlock', () => { expect(screen.getByText(/Thought/)).toBeInTheDocument() }) - it('should NOT stop timer when isResponding is undefined (outside ChatContextProvider)', () => { - // Render without ChatContextProvider + it('should stop timer when isResponding is undefined (historical conversation outside active response)', () => { + // Render without ChatContextProvider — simulates historical conversation render(

Content without ENDTHINKFLAG

, ) - // Initial state should show "Thinking..." - expect(screen.getByText(/Thinking\.\.\./)).toBeInTheDocument() - - // Advance timer - act(() => { - vi.advanceTimersByTime(2000) - }) - - // Timer should still be running (showing "Thinking..." not "Thought") - expect(screen.getByText(/Thinking\.\.\./)).toBeInTheDocument() - expect(screen.getByText(/\(2\.0s\)/)).toBeInTheDocument() + // Timer should be stopped immediately — isResponding undefined means not in active response + expect(screen.getByText(/Thought/)).toBeInTheDocument() }) }) diff --git a/web/app/components/base/markdown-blocks/think-block.tsx b/web/app/components/base/markdown-blocks/think-block.tsx index f920218152..184ed89274 100644 --- a/web/app/components/base/markdown-blocks/think-block.tsx +++ b/web/app/components/base/markdown-blocks/think-block.tsx @@ -39,9 +39,10 @@ const removeEndThink = (children: any): any => { const useThinkTimer = (children: any) => { const { isResponding } = useChatContext() + const endThinkDetected = hasEndThink(children) const [startTime] = useState(() => Date.now()) const [elapsedTime, setElapsedTime] = useState(0) - const [isComplete, setIsComplete] = useState(false) + const [isComplete, setIsComplete] = useState(() => endThinkDetected) const timerRef = useRef(null) useEffect(() => { @@ -61,11 +62,10 @@ const useThinkTimer = (children: any) => { useEffect(() => { // Stop timer when: // 1. Content has [ENDTHINKFLAG] marker (normal completion) - // 2. isResponding is explicitly false (user clicked stop button) - // Note: Don't stop when isResponding is undefined (component used outside ChatContextProvider) - if (hasEndThink(children) || isResponding === false) + // 2. isResponding is not true (false = user clicked stop, undefined = historical conversation) + if (endThinkDetected || !isResponding) setIsComplete(true) - }, [children, isResponding]) + }, [endThinkDetected, isResponding]) return { elapsedTime, isComplete } } From a0135e9e38472e35cc348c7a2e34ffaa49791d14 Mon Sep 17 00:00:00 2001 From: yyh <92089059+lyzno1@users.noreply.github.com> Date: Fri, 20 Mar 2026 11:15:22 +0800 Subject: [PATCH 3/4] refactor: migrate tag filter overlay and remove dead z-index override prop (#33791) --- .../tag-management/__tests__/filter.spec.tsx | 25 +--- .../components/base/tag-management/filter.tsx | 112 ++++++++---------- .../model-selector/index.tsx | 3 - web/eslint.constants.mjs | 1 - 4 files changed, 54 insertions(+), 87 deletions(-) diff --git a/web/app/components/base/tag-management/__tests__/filter.spec.tsx b/web/app/components/base/tag-management/__tests__/filter.spec.tsx index 3cffac29b2..a455d1a791 100644 --- a/web/app/components/base/tag-management/__tests__/filter.spec.tsx +++ b/web/app/components/base/tag-management/__tests__/filter.spec.tsx @@ -14,23 +14,11 @@ vi.mock('@/service/tag', () => ({ fetchTagList, })) -// Mock ahooks to avoid timer-related issues in tests vi.mock('ahooks', () => { return { - useDebounceFn: (fn: (...args: unknown[]) => void) => { - const ref = React.useRef(fn) - ref.current = fn - const stableRun = React.useRef((...args: unknown[]) => { - // Schedule to run after current event handler finishes, - // allowing React to process pending state updates first - Promise.resolve().then(() => ref.current(...args)) - }) - return { run: stableRun.current } - }, useMount: (fn: () => void) => { React.useEffect(() => { fn() - // eslint-disable-next-line react-hooks/exhaustive-deps }, []) }, } @@ -228,7 +216,6 @@ describe('TagFilter', () => { const searchInput = screen.getByRole('textbox') await user.type(searchInput, 'Front') - // With debounce mocked to be synchronous, results should be immediate expect(screen.getByText('Frontend')).toBeInTheDocument() expect(screen.queryByText('Backend')).not.toBeInTheDocument() expect(screen.queryByText('API Design')).not.toBeInTheDocument() @@ -257,22 +244,14 @@ describe('TagFilter', () => { const searchInput = screen.getByRole('textbox') await user.type(searchInput, 'Front') - // Wait for the debounced search to filter - await waitFor(() => { - expect(screen.queryByText('Backend')).not.toBeInTheDocument() - }) + expect(screen.queryByText('Backend')).not.toBeInTheDocument() - // Clear the search using the Input's clear button const clearButton = screen.getByTestId('input-clear') await user.click(clearButton) - // The input value should be cleared expect(searchInput).toHaveValue('') - // After the clear + microtask re-render, all app tags should be visible again - await waitFor(() => { - expect(screen.getByText('Backend')).toBeInTheDocument() - }) + expect(screen.getByText('Backend')).toBeInTheDocument() expect(screen.getByText('Frontend')).toBeInTheDocument() expect(screen.getByText('API Design')).toBeInTheDocument() }) diff --git a/web/app/components/base/tag-management/filter.tsx b/web/app/components/base/tag-management/filter.tsx index ad71334ddb..fcd59bcf7d 100644 --- a/web/app/components/base/tag-management/filter.tsx +++ b/web/app/components/base/tag-management/filter.tsx @@ -1,15 +1,15 @@ import type { FC } from 'react' import type { Tag } from '@/app/components/base/tag-management/constant' -import { useDebounceFn, useMount } from 'ahooks' +import { useMount } from 'ahooks' import { useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import { Tag01, Tag03 } from '@/app/components/base/icons/src/vender/line/financeAndECommerce' import Input from '@/app/components/base/input' import { - PortalToFollowElem, - PortalToFollowElemContent, - PortalToFollowElemTrigger, -} from '@/app/components/base/portal-to-follow-elem' + Popover, + PopoverContent, + PopoverTrigger, +} from '@/app/components/base/ui/popover' import { fetchTagList } from '@/service/tag' import { cn } from '@/utils/classnames' @@ -33,18 +33,10 @@ const TagFilter: FC = ({ const setShowTagManagementModal = useTagStore(s => s.setShowTagManagementModal) const [keywords, setKeywords] = useState('') - const [searchKeywords, setSearchKeywords] = useState('') - const { run: handleSearch } = useDebounceFn(() => { - setSearchKeywords(keywords) - }, { wait: 500 }) - const handleKeywordsChange = (value: string) => { - setKeywords(value) - handleSearch() - } const filteredTagList = useMemo(() => { - return tagList.filter(tag => tag.type === type && tag.name.includes(searchKeywords)) - }, [type, tagList, searchKeywords]) + return tagList.filter(tag => tag.type === type && tag.name.includes(keywords)) + }, [type, tagList, keywords]) const currentTag = useMemo(() => { return tagList.find(tag => tag.id === value[0]) @@ -64,61 +56,61 @@ const TagFilter: FC = ({ }) return ( -
- setOpen(v => !v)} - className="block" - > -
-
- -
-
- {!value.length && t('tag.placeholder', { ns: 'common' })} - {!!value.length && currentTag?.name} -
- {value.length > 1 && ( -
{`+${value.length - 1}`}
- )} - {!value.length && ( +
- +
- )} - {!!value.length && ( -
{ - e.stopPropagation() - onChange([]) - }} - data-testid="tag-filter-clear-button" - > - +
+ {!value.length && t('tag.placeholder', { ns: 'common' })} + {!!value.length && currentTag?.name}
- )} -
- - -
+ {value.length > 1 && ( +
{`+${value.length - 1}`}
+ )} + {!value.length && ( +
+ +
+ )} + + )} + /> + {!!value.length && ( + + )} + +
handleKeywordsChange(e.target.value)} - onClear={() => handleKeywordsChange('')} + onChange={e => setKeywords(e.target.value)} + onClear={() => setKeywords('')} />
@@ -155,9 +147,9 @@ const TagFilter: FC = ({
-
+
- + ) } diff --git a/web/app/components/plugins/plugin-detail-panel/model-selector/index.tsx b/web/app/components/plugins/plugin-detail-panel/model-selector/index.tsx index 761b7a12f4..04b78f98b7 100644 --- a/web/app/components/plugins/plugin-detail-panel/model-selector/index.tsx +++ b/web/app/components/plugins/plugin-detail-panel/model-selector/index.tsx @@ -31,7 +31,6 @@ import TTSParamsPanel from './tts-params-panel' export type ModelParameterModalProps = { popupClassName?: string - portalToFollowElemContentClassName?: string isAdvancedMode: boolean value: any setModel: (model: any) => void @@ -44,7 +43,6 @@ export type ModelParameterModalProps = { const ModelParameterModal: FC = ({ popupClassName, - portalToFollowElemContentClassName, isAdvancedMode, value, setModel, @@ -230,7 +228,6 @@ const ModelParameterModal: FC = ({
diff --git a/web/eslint.constants.mjs b/web/eslint.constants.mjs index ce19b99c9b..9992d94f36 100644 --- a/web/eslint.constants.mjs +++ b/web/eslint.constants.mjs @@ -116,7 +116,6 @@ export const OVERLAY_MIGRATION_LEGACY_BASE_FILES = [ 'app/components/base/select/index.tsx', 'app/components/base/select/pure.tsx', 'app/components/base/sort/index.tsx', - 'app/components/base/tag-management/filter.tsx', 'app/components/base/theme-selector.tsx', 'app/components/base/tooltip/index.tsx', ] From aa71784627fafe252e8bb246e7abed38171e48b3 Mon Sep 17 00:00:00 2001 From: yyh <92089059+lyzno1@users.noreply.github.com> Date: Fri, 20 Mar 2026 12:17:27 +0800 Subject: [PATCH 4/4] refactor(toast): migrate dataset-pipeline to new ui toast API and extract i18n (#33794) --- .../create-from-pipeline/list/create-card.tsx | 10 ++++---- .../list/template-card/edit-pipeline-info.tsx | 6 ++--- .../list/template-card/index.tsx | 22 +++++++++--------- .../data-source/online-documents/index.tsx | 6 ++--- .../data-source/online-drive/index.tsx | 6 ++--- .../website-crawl/base/options/index.tsx | 6 ++--- .../preview/online-document-preview.tsx | 6 ++--- .../process-documents/form.tsx | 6 ++--- web/eslint-suppressions.json | 23 +------------------ web/i18n/en-US/dataset-pipeline.json | 1 + 10 files changed, 36 insertions(+), 56 deletions(-) diff --git a/web/app/components/datasets/create-from-pipeline/list/create-card.tsx b/web/app/components/datasets/create-from-pipeline/list/create-card.tsx index f6a20c50e0..018a655e0b 100644 --- a/web/app/components/datasets/create-from-pipeline/list/create-card.tsx +++ b/web/app/components/datasets/create-from-pipeline/list/create-card.tsx @@ -3,7 +3,7 @@ import * as React from 'react' import { useCallback } from 'react' import { useTranslation } from 'react-i18next' import { trackEvent } from '@/app/components/base/amplitude' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { useRouter } from '@/next/navigation' import { useCreatePipelineDataset } from '@/service/knowledge/use-create-dataset' import { useInvalidDatasetList } from '@/service/knowledge/use-dataset' @@ -20,9 +20,9 @@ const CreateCard = () => { onSuccess: (data) => { if (data) { const { id } = data - Toast.notify({ + toast.add({ type: 'success', - message: t('creation.successTip', { ns: 'datasetPipeline' }), + title: t('creation.successTip', { ns: 'datasetPipeline' }), }) invalidDatasetList() trackEvent('create_datasets_from_scratch', { @@ -32,9 +32,9 @@ const CreateCard = () => { } }, onError: () => { - Toast.notify({ + toast.add({ type: 'error', - message: t('creation.errorTip', { ns: 'datasetPipeline' }), + title: t('creation.errorTip', { ns: 'datasetPipeline' }), }) }, }) diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/edit-pipeline-info.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/edit-pipeline-info.tsx index 69f8f470d0..b09486bee3 100644 --- a/web/app/components/datasets/create-from-pipeline/list/template-card/edit-pipeline-info.tsx +++ b/web/app/components/datasets/create-from-pipeline/list/template-card/edit-pipeline-info.tsx @@ -9,7 +9,7 @@ import AppIconPicker from '@/app/components/base/app-icon-picker' import Button from '@/app/components/base/button' import Input from '@/app/components/base/input' import Textarea from '@/app/components/base/textarea' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { useInvalidCustomizedTemplateList, useUpdateTemplateInfo } from '@/service/use-pipeline' type EditPipelineInfoProps = { @@ -67,9 +67,9 @@ const EditPipelineInfo = ({ const handleSave = useCallback(async () => { if (!name) { - Toast.notify({ + toast.add({ type: 'error', - message: 'Please enter a name for the Knowledge Base.', + title: t('editPipelineInfoNameRequired', { ns: 'datasetPipeline' }), }) return } diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsx index 7684e924b6..7e2683d781 100644 --- a/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsx +++ b/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsx @@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next' import { trackEvent } from '@/app/components/base/amplitude' import Confirm from '@/app/components/base/confirm' import Modal from '@/app/components/base/modal' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { usePluginDependencies } from '@/app/components/workflow/plugin-dependency/hooks' import { useRouter } from '@/next/navigation' import { useCreatePipelineDatasetFromCustomized } from '@/service/knowledge/use-create-dataset' @@ -50,9 +50,9 @@ const TemplateCard = ({ const handleUseTemplate = useCallback(async () => { const { data: pipelineTemplateInfo } = await getPipelineTemplateInfo() if (!pipelineTemplateInfo) { - Toast.notify({ + toast.add({ type: 'error', - message: t('creation.errorTip', { ns: 'datasetPipeline' }), + title: t('creation.errorTip', { ns: 'datasetPipeline' }), }) return } @@ -61,9 +61,9 @@ const TemplateCard = ({ } await createDataset(request, { onSuccess: async (newDataset) => { - Toast.notify({ + toast.add({ type: 'success', - message: t('creation.successTip', { ns: 'datasetPipeline' }), + title: t('creation.successTip', { ns: 'datasetPipeline' }), }) invalidDatasetList() if (newDataset.pipeline_id) @@ -76,9 +76,9 @@ const TemplateCard = ({ push(`/datasets/${newDataset.dataset_id}/pipeline`) }, onError: () => { - Toast.notify({ + toast.add({ type: 'error', - message: t('creation.errorTip', { ns: 'datasetPipeline' }), + title: t('creation.errorTip', { ns: 'datasetPipeline' }), }) }, }) @@ -109,15 +109,15 @@ const TemplateCard = ({ onSuccess: (res) => { const blob = new Blob([res.data], { type: 'application/yaml' }) downloadBlob({ data: blob, fileName: `${pipeline.name}.pipeline` }) - Toast.notify({ + toast.add({ type: 'success', - message: t('exportDSL.successTip', { ns: 'datasetPipeline' }), + title: t('exportDSL.successTip', { ns: 'datasetPipeline' }), }) }, onError: () => { - Toast.notify({ + toast.add({ type: 'error', - message: t('exportDSL.errorTip', { ns: 'datasetPipeline' }), + title: t('exportDSL.errorTip', { ns: 'datasetPipeline' }), }) }, }) diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsx index 4bdaac895b..414d2a5756 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsx @@ -5,7 +5,7 @@ import { useCallback, useEffect, useMemo } from 'react' import { useShallow } from 'zustand/react/shallow' import Loading from '@/app/components/base/loading' import SearchInput from '@/app/components/base/notion-page-selector/search-input' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { ACCOUNT_SETTING_TAB } from '@/app/components/header/account-setting/constants' import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail' import { useDocLink } from '@/context/i18n' @@ -96,9 +96,9 @@ const OnlineDocuments = ({ setDocumentsData(documentsData.data as DataSourceNotionWorkspace[]) }, onDataSourceNodeError: (error: DataSourceNodeErrorResponse) => { - Toast.notify({ + toast.add({ type: 'error', - message: error.error, + title: error.error, }) }, }, diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/index.tsx index 4346a2d0af..74fad58d19 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/index.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/index.tsx @@ -4,7 +4,7 @@ import type { DataSourceNodeCompletedResponse, DataSourceNodeErrorResponse } fro import { produce } from 'immer' import { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { useShallow } from 'zustand/react/shallow' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { ACCOUNT_SETTING_TAB } from '@/app/components/header/account-setting/constants' import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail' import { useDocLink } from '@/context/i18n' @@ -105,9 +105,9 @@ const OnlineDrive = ({ isLoadingRef.current = false }, onDataSourceNodeError: (error: DataSourceNodeErrorResponse) => { - Toast.notify({ + toast.add({ type: 'error', - message: error.error, + title: error.error, }) setIsLoading(false) isLoadingRef.current = false diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsx index eb8cceb3e5..2cd5fdf3c3 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsx @@ -8,7 +8,7 @@ import { useAppForm } from '@/app/components/base/form' import BaseField from '@/app/components/base/form/form-scenarios/base/field' import { generateZodSchema } from '@/app/components/base/form/form-scenarios/base/utils' import { ArrowDownRoundFill } from '@/app/components/base/icons/src/vender/solid/general' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { useConfigurations, useInitialData } from '@/app/components/rag-pipeline/hooks/use-input-fields' import { CrawlStep } from '@/models/datasets' import { cn } from '@/utils/classnames' @@ -44,9 +44,9 @@ const Options = ({ const issues = result.error.issues const firstIssue = issues[0] const errorMessage = `"${firstIssue.path.join('.')}" ${firstIssue.message}` - Toast.notify({ + toast.add({ type: 'error', - message: errorMessage, + title: errorMessage, }) return errorMessage } diff --git a/web/app/components/datasets/documents/create-from-pipeline/preview/online-document-preview.tsx b/web/app/components/datasets/documents/create-from-pipeline/preview/online-document-preview.tsx index 1e3019d427..5cdbc713d6 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/preview/online-document-preview.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/preview/online-document-preview.tsx @@ -6,7 +6,7 @@ import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { Notion } from '@/app/components/base/icons/src/public/common' import { Markdown } from '@/app/components/base/markdown' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail' import { usePreviewOnlineDocument } from '@/service/use-pipeline' import { formatNumberAbbreviated } from '@/utils/format' @@ -44,9 +44,9 @@ const OnlineDocumentPreview = ({ setContent(data.content) }, onError(error) { - Toast.notify({ + toast.add({ type: 'error', - message: error.message, + title: error.message, }) }, }) diff --git a/web/app/components/datasets/documents/create-from-pipeline/process-documents/form.tsx b/web/app/components/datasets/documents/create-from-pipeline/process-documents/form.tsx index 4873931e8d..ca01f7f628 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/process-documents/form.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/process-documents/form.tsx @@ -3,7 +3,7 @@ import type { BaseConfiguration } from '@/app/components/base/form/form-scenario import { useCallback, useImperativeHandle } from 'react' import { useAppForm } from '@/app/components/base/form' import BaseField from '@/app/components/base/form/form-scenarios/base/field' -import Toast from '@/app/components/base/toast' +import { toast } from '@/app/components/base/ui/toast' import Header from './header' type OptionsProps = { @@ -34,9 +34,9 @@ const Form = ({ const issues = result.error.issues const firstIssue = issues[0] const errorMessage = `"${firstIssue.path.join('.')}" ${firstIssue.message}` - Toast.notify({ + toast.add({ type: 'error', - message: errorMessage, + title: errorMessage, }) return errorMessage } diff --git a/web/eslint-suppressions.json b/web/eslint-suppressions.json index 681e430f55..92774e8d60 100644 --- a/web/eslint-suppressions.json +++ b/web/eslint-suppressions.json @@ -3076,9 +3076,6 @@ } }, "app/components/datasets/create-from-pipeline/list/create-card.tsx": { - "no-restricted-imports": { - "count": 1 - }, "tailwindcss/enforce-consistent-class-order": { "count": 2 } @@ -3112,16 +3109,13 @@ } }, "app/components/datasets/create-from-pipeline/list/template-card/edit-pipeline-info.tsx": { - "no-restricted-imports": { - "count": 1 - }, "tailwindcss/enforce-consistent-class-order": { "count": 3 } }, "app/components/datasets/create-from-pipeline/list/template-card/index.tsx": { "no-restricted-imports": { - "count": 3 + "count": 2 } }, "app/components/datasets/create-from-pipeline/list/template-card/operations.tsx": { @@ -3403,9 +3397,6 @@ } }, "app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsx": { - "no-restricted-imports": { - "count": 1 - }, "ts/no-explicit-any": { "count": 1 } @@ -3482,9 +3473,6 @@ } }, "app/components/datasets/documents/create-from-pipeline/data-source/online-drive/index.tsx": { - "no-restricted-imports": { - "count": 1 - }, "react-hooks-extra/no-direct-set-state-in-use-effect": { "count": 5 } @@ -3533,9 +3521,6 @@ } }, "app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsx": { - "no-restricted-imports": { - "count": 1 - }, "tailwindcss/enforce-consistent-class-order": { "count": 1 }, @@ -3562,9 +3547,6 @@ } }, "app/components/datasets/documents/create-from-pipeline/preview/online-document-preview.tsx": { - "no-restricted-imports": { - "count": 1 - }, "tailwindcss/enforce-consistent-class-order": { "count": 4 } @@ -3578,9 +3560,6 @@ } }, "app/components/datasets/documents/create-from-pipeline/process-documents/form.tsx": { - "no-restricted-imports": { - "count": 1 - }, "ts/no-explicit-any": { "count": 3 } diff --git a/web/i18n/en-US/dataset-pipeline.json b/web/i18n/en-US/dataset-pipeline.json index 00bd68a519..b1b58516bf 100644 --- a/web/i18n/en-US/dataset-pipeline.json +++ b/web/i18n/en-US/dataset-pipeline.json @@ -35,6 +35,7 @@ "details.structureTooltip": "Chunk Structure determines how documents are split and indexed—offering General, Parent-Child, and Q&A modes—and is unique to each knowledge base.", "documentSettings.title": "Document Settings", "editPipelineInfo": "Edit pipeline info", + "editPipelineInfoNameRequired": "Please enter a name for the Knowledge Base.", "exportDSL.errorTip": "Failed to export pipeline DSL", "exportDSL.successTip": "Export pipeline DSL successfully", "inputField": "Input Field",