diff --git a/web/src/hooks/document-hooks.ts b/web/src/hooks/document-hooks.ts index 215d9b1d75..621dd83692 100644 --- a/web/src/hooks/document-hooks.ts +++ b/web/src/hooks/document-hooks.ts @@ -313,13 +313,16 @@ export const useRunNextDocument = () => { mutationFn: async ({ documentIds, run, + shouldDelete, }: { documentIds: string[]; run: number; + shouldDelete: boolean; }) => { const ret = await kbService.document_run({ doc_ids: documentIds, run, + delete: shouldDelete, }); const code = get(ret, 'data.code'); if (code === 0) { diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index 8f6c76e794..2bcc887f8a 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -165,6 +165,7 @@ export default { autoKeywordsTip: `Automatically extract N keywords for each chunk to increase their ranking for queries containing those keywords. You can check or update the added keywords for a chunk from the chunk list. Be aware that extra tokens will be consumed by the LLM specified in 'System model settings'.`, autoQuestions: 'Auto-question', autoQuestionsTip: `Automatically extract N questions for each chunk to increase their ranking for queries containing those questions. You can check or update the added questions for a chunk from the chunk list. This feature will not disrupt the chunking process if an error occurs, except that it may add an empty result to the original chunk. Be aware that extra tokens will be consumed by the LLM specified in 'System model settings'.`, + redo: 'Do you want to clear the existing {{chunkNum}} chunks?', }, knowledgeConfiguration: { titleDescription: diff --git a/web/src/locales/zh-traditional.ts b/web/src/locales/zh-traditional.ts index 06b1c4ae39..615c34151f 100644 --- a/web/src/locales/zh-traditional.ts +++ b/web/src/locales/zh-traditional.ts @@ -161,6 +161,7 @@ export default { autoKeywordsTip: `在查詢此類關鍵字時,為每個區塊提取 N 個關鍵字以提高其排名分數。在「系統模型設定」中設定的 LLM 將消耗額外的 token。您可以在區塊清單中查看結果。 `, autoQuestions: '自動問題', autoQuestionsTip: `在查詢此類問題時,為每個區塊提取 N 個問題以提高其排名分數。在「系統模型設定」中設定的 LLM 將消耗額外的 token。您可以在區塊清單中查看結果。如果發生錯誤,此功能不會破壞整個分塊過程,除了將空結果新增至原始區塊。 `, + redo: '是否清空已有 {{chunkNum}}個 chunk?', }, knowledgeConfiguration: { titleDescription: '在這裡更新您的知識庫詳細信息,尤其是解析方法。', diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts index 18668cecc2..f798658f1d 100644 --- a/web/src/locales/zh.ts +++ b/web/src/locales/zh.ts @@ -162,6 +162,7 @@ export default { autoKeywordsTip: `在查询此类关键词时,为每个块提取 N 个关键词以提高其排名得分。在“系统模型设置”中设置的 LLM 将消耗额外的 token。您可以在块列表中查看结果。`, autoQuestions: '自动问题', autoQuestionsTip: `在查询此类问题时,为每个块提取 N 个问题以提高其排名得分。在“系统模型设置”中设置的 LLM 将消耗额外的 token。您可以在块列表中查看结果。如果发生错误,此功能不会破坏整个分块过程,除了将空结果添加到原始块。`, + redo: '是否清空已有 {{chunkNum}}个 chunk?', }, knowledgeConfiguration: { titleDescription: '在这里更新您的知识库详细信息,尤其是解析方法。', diff --git a/web/src/pages/add-knowledge/components/knowledge-file/hooks.ts b/web/src/pages/add-knowledge/components/knowledge-file/hooks.ts index d156213020..432607b121 100644 --- a/web/src/pages/add-knowledge/components/knowledge-file/hooks.ts +++ b/web/src/pages/add-knowledge/components/knowledge-file/hooks.ts @@ -213,6 +213,7 @@ export const useHandleRunDocumentByIds = (id: string) => { const handleRunDocumentByIds = async ( documentId: string, isRunning: boolean, + shouldDelete: boolean = false, ) => { if (isLoading) { return; @@ -222,6 +223,7 @@ export const useHandleRunDocumentByIds = (id: string) => { await runDocumentByIds({ documentIds: [documentId], run: isRunning ? 2 : 1, + shouldDelete, }); setCurrentId(''); } catch (error) { diff --git a/web/src/pages/add-knowledge/components/knowledge-file/parsing-status-cell/index.tsx b/web/src/pages/add-knowledge/components/knowledge-file/parsing-status-cell/index.tsx index 14c3d99261..0de71d4f8c 100644 --- a/web/src/pages/add-knowledge/components/knowledge-file/parsing-status-cell/index.tsx +++ b/web/src/pages/add-knowledge/components/knowledge-file/parsing-status-cell/index.tsx @@ -3,7 +3,15 @@ import { ReactComponent as RefreshIcon } from '@/assets/svg/refresh.svg'; import { ReactComponent as RunIcon } from '@/assets/svg/run.svg'; import { useTranslate } from '@/hooks/common-hooks'; import { IDocumentInfo } from '@/interfaces/database/document'; -import { Badge, DescriptionsProps, Flex, Popover, Space, Tag } from 'antd'; +import { + Badge, + DescriptionsProps, + Flex, + Popconfirm, + Popover, + Space, + Tag, +} from 'antd'; import classNames from 'classnames'; import { useTranslation } from 'react-i18next'; import reactStringReplace from 'react-string-replace'; @@ -92,9 +100,11 @@ export const ParsingStatusCell = ({ record }: IProps) => { const label = t(`knowledgeDetails.runningStatus${text}`); - const handleOperationIconClick = () => { - handleRunDocumentByIds(record.id, isRunning); - }; + const handleOperationIconClick = + (shouldDelete: boolean = false) => + () => { + handleRunDocumentByIds(record.id, isRunning, shouldDelete); + }; return record.type === DocumentType.Virtual ? null : ( @@ -111,14 +121,25 @@ export const ParsingStatusCell = ({ record }: IProps) => { )} -
- -
+
{} + } + > + +
+
); };