Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
d2c89cb
fix: add validation rules for knowledge base name input
Dallas98 Mar 16, 2026
7daece4
fix: adjust pagination settings and clean up unused components in Kno…
Dallas98 Mar 16, 2026
5265c04
fix: improve pagination controls and enhance chunk display in Knowled…
Dallas98 Mar 16, 2026
f743c6a
fix: enhance chunk display messages in KnowledgeBaseFileDetail
Dallas98 Mar 16, 2026
a69c3bb
fix: replace metadata display with syntax highlighter in KnowledgeBas…
Dallas98 Mar 16, 2026
cbfad01
fix: add chunk update and delete functionality with user feedback in …
Dallas98 Mar 16, 2026
c6f2f76
fix: enhance user feedback and validation messages in KnowledgeBaseFi…
Dallas98 Mar 16, 2026
5df7327
fix: update breadcrumb and default file name in KnowledgeBaseFileDetail
Dallas98 Mar 16, 2026
f842cb3
fix: update breadcrumb and default file name in KnowledgeBaseFileDetail
Dallas98 Mar 16, 2026
36c9337
fix: enhance metadata validation and add action buttons in KnowledgeB…
Dallas98 Mar 16, 2026
39a717e
fix: enhance chunk deletion process and return rag_file_id in delete_…
Dallas98 Mar 16, 2026
dc77451
fix: implement batched chunk deletion by rag_file_id in store.py
Dallas98 Mar 16, 2026
99b7e5e
fix: add confirmation modal for file deletion in KnowledgeBase compon…
Dallas98 Mar 16, 2026
a8c5e57
fix: replace Popconfirm with Modal for confirmation in DetailHeader a…
Dallas98 Mar 16, 2026
187e025
fix: enhance delete confirmation message in DatasetDetail with item name
Dallas98 Mar 16, 2026
b39975c
Merge origin/main into fix/rag and add centered to delete modal
Dallas98 Mar 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/src/components/DeleteConfirmModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export default function DeleteConfirmModal({
okType="danger"
okText={t("components.deleteConfirm.confirm")}
cancelText={t("components.deleteConfirm.cancel")}
centered
>
<p>{defaultMessage}</p>
</Modal>
Expand Down
39 changes: 23 additions & 16 deletions frontend/src/components/DetailHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useLayoutEffect, useEffect, useRef, useState, useCallback, useMemo } from "react";
import { Database } from "lucide-react";
import { Card, Button, Tag, Tooltip, Popconfirm, Popover } from "antd";
import { Card, Button, Tag, Tooltip, Modal } from "antd";
import type { ItemType } from "antd/es/menu/interface";
import AddTagPopover from "./AddTagPopover";
import ActionDropdown from "./ActionDropdown";
Expand Down Expand Up @@ -291,23 +291,30 @@ function DetailHeader<T>({
);
}
if (op.confirm) {
const showConfirmModal = () => {
Modal.confirm({
title: op.confirm?.title,
content: op.confirm?.description,
okText: op.confirm?.okText,
okType: op.danger ? "danger" : "primary",
cancelText: op.confirm?.cancelText,
centered: true,
onOk: () => {
if (op.onClick) {
op.onClick();
} else {
op?.confirm?.onConfirm?.();
}
},
});
};
return (
<Tooltip key={op.key} title={op.label}>
<Popconfirm
key={op.key}
{...op.confirm}
onConfirm={() => {
if (op.onClick) {
op.onClick()
} else {
op?.confirm?.onConfirm?.();
}
}}
okType={op.danger ? "danger" : "primary"}
overlayStyle={{ zIndex: 9999 }}
>
<Button icon={op.icon} danger={op.danger} />
</Popconfirm>
<Button
icon={op.icon}
danger={op.danger}
onClick={showConfirmModal}
/>
</Tooltip>
);
}
Expand Down
41 changes: 36 additions & 5 deletions frontend/src/i18n/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,8 @@
"confirm": {
"deleteTitle": "Confirm deletion of this knowledge base?",
"deleteDescription": "It cannot be recovered after deletion. Please operate with caution.",
"deleteFileTitle": "Confirm deletion of this file?",
"deleteFileDescription": "Are you sure you want to delete \"{{name}}\"? This action cannot be undone.",
"okText": "Delete",
"cancelText": "Cancel"
},
Expand Down Expand Up @@ -1684,7 +1686,8 @@
"noProperties": "No properties"
},
"breadcrumb": {
"kbList": "Knowledge Bases"
"kbList": "Knowledge Bases",
"kbDetail": "Knowledge Base Detail"
},
"searchPlaceholder": "Search file name..."
},
Expand All @@ -1698,16 +1701,38 @@
"actions": {
"download": "Download",
"save": "Save",
"cancel": "Cancel"
"cancel": "Cancel",
"confirm": "Confirm",
"formatJson": "Format",
"view": "View",
"edit": "Edit",
"delete": "Delete"
},
"messages": {
"noChunks": "No chunk data",
"chunkCount": "chunks",
"totalChunks": "Total {{count}} chunks",
"showingRange": "showing {{start}}-{{end}}",
"ready": "Ready",
"previousPage": "Previous Page",
"nextPage": "Next Page",
"chunkLabel": "Chunk",
"loadFailed": "Load failed"
"loadFailed": "Load failed",
"updateSuccess": "Chunk updated successfully",
"updateFailed": "Failed to update chunk",
"deleteSuccess": "Chunk deleted successfully",
"deleteFailed": "Failed to delete chunk",
"invalidMetadata": "Invalid metadata JSON format",
"invalidMetadataFormat": "Metadata is not valid JSON format",
"textRequired": "Chunk content cannot be empty",
"formatSuccess": "JSON formatted successfully",
"metadataHint": "Please enter valid JSON format. Click 'Format' button to auto-format.",
"jsonValid": "Valid JSON",
"jsonInvalid": "Invalid JSON"
},
"placeholders": {
"chunkContent": "Enter chunk content",
"metadata": "Enter metadata (JSON format)"
},
"modal": {
"sliceTraceTitle": "Knowledge Slice Trace",
Expand All @@ -1722,12 +1747,16 @@
"position": "Position",
"tokenCount": "Token Count",
"pageNumber": "Page Number",
"chapter": "Chapter"
"chapter": "Chapter",
"deleteConfirmTitle": "Confirm Delete Chunk",
"deleteConfirmMessage": "Are you sure you want to delete this chunk? This will also delete the vector data in Milvus and cannot be undone.",
"editChunkTitle": "Edit Chunk"
},
"breadcrumb": {
"kbList": "Knowledge Bases",
"kbDetail": "Knowledge Base Detail"
}
},
"defaultFileName": "File {{id}}"
},
"create": {
"title": "Create Knowledge Base",
Expand All @@ -1740,6 +1769,8 @@
"nameLabel": "Knowledge Base Name",
"namePlaceholder": "Please enter knowledge base name",
"nameRequired": "Please enter knowledge base name",
"nameMaxLength": "Knowledge base name cannot exceed 255 characters",
"namePattern": "Knowledge base name must start with a letter and can only contain letters, numbers, and underscores",
"descriptionLabel": "Description",
"descriptionPlaceholder": "Please enter knowledge base description (optional)",
"embeddingModelLabel": "Embedding Model",
Expand Down
38 changes: 34 additions & 4 deletions frontend/src/i18n/locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,8 @@
"confirm": {
"deleteTitle": "确认删除该知识库吗?",
"deleteDescription": "删除后将无法恢复,请谨慎操作。",
"deleteFileTitle": "确认删除该文件吗?",
"deleteFileDescription": "确定要删除文件「{{name}}」吗?删除后将无法恢复。",
"okText": "删除",
"cancelText": "取消"
},
Expand Down Expand Up @@ -1698,16 +1700,38 @@
"actions": {
"download": "下载",
"save": "保存",
"cancel": "取消"
"cancel": "取消",
"confirm": "确认",
"formatJson": "格式化",
"view": "查看",
"edit": "编辑",
"delete": "删除"
},
"messages": {
"noChunks": "暂无分块数据",
"chunkCount": "个分块",
"totalChunks": "共 {{count}} 个分块",
"showingRange": "当前显示第 {{start}}-{{end}} 个",
"ready": "就绪",
"previousPage": "上一页",
"nextPage": "下一页",
"chunkLabel": "分块",
"loadFailed": "加载失败"
"loadFailed": "加载失败",
"updateSuccess": "分块更新成功",
"updateFailed": "分块更新失败",
"deleteSuccess": "分块删除成功",
"deleteFailed": "分块删除失败",
"invalidMetadata": "元数据JSON格式无效",
"invalidMetadataFormat": "元数据不是有效的JSON格式",
"textRequired": "分块内容不能为空",
"formatSuccess": "JSON格式化成功",
"metadataHint": "请输入有效的JSON格式数据,点击\"格式化\"按钮可自动整理格式",
"jsonValid": "JSON格式正确",
"jsonInvalid": "JSON格式错误"
},
"placeholders": {
"chunkContent": "请输入分块内容",
"metadata": "请输入元数据(JSON格式)"
},
"modal": {
"sliceTraceTitle": "知识切片回溯",
Expand All @@ -1722,12 +1746,16 @@
"position": "位置",
"tokenCount": "Token数量",
"pageNumber": "页码",
"chapter": "章节"
"chapter": "章节",
"deleteConfirmTitle": "确认删除分块",
"deleteConfirmMessage": "确定要删除这个分块吗?此操作将同时删除Milvus中的向量数据,且无法恢复。",
"editChunkTitle": "编辑分块"
},
"breadcrumb": {
"kbList": "知识库",
"kbDetail": "知识库详情"
}
},
"defaultFileName": "文件 {{id}}"
},
"create": {
"title": "创建知识库",
Expand All @@ -1740,6 +1768,8 @@
"nameLabel": "知识库名称",
"namePlaceholder": "请输入知识库名称",
"nameRequired": "请输入知识库名称",
"nameMaxLength": "知识库名称长度不能超过255个字符",
"namePattern": "知识库名称必须以字母开头,只能包含字母、数字和下划线",
"descriptionLabel": "描述",
"descriptionPlaceholder": "请输入知识库描述(可选)",
"embeddingModelLabel": "索引模型",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/pages/DataManagement/Detail/DatasetDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ export default function DatasetDetail() {
okText={t("dataManagement.confirm.deleteConfirm")}
cancelText={t("dataManagement.confirm.deleteCancel")}
okButtonProps={{ danger: true }}
centered
>
<p>{t("dataManagement.confirm.deleteDatasetDesc", { itemName: dataset.name || t("dataManagement.detail.title") })}</p>
</Modal>
Expand Down
16 changes: 14 additions & 2 deletions frontend/src/pages/KnowledgeBase/Detail/KnowledgeBaseDetail.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type React from "react";
import { useEffect, useState } from "react";
import { Table, Badge, Button, Breadcrumb, Tooltip, App, Card, Input, Empty, Spin, Tag } from "antd";
import { Table, Badge, Button, Breadcrumb, Tooltip, App, Card, Input, Empty, Spin, Tag, Modal } from "antd";
import { ExclamationCircleOutlined } from "@ant-design/icons";
import ReactMarkdown from "react-markdown";
import remarkGfm from "remark-gfm";
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
Expand Down Expand Up @@ -154,6 +155,7 @@ const KnowledgeBaseDetailPage: React.FC = () => {
});
message.success(t("knowledgeBase.detail.messages.fileDeleted"));
fetchFiles();
fetchKnowledgeBaseDetails(knowledgeBase!.id);
} catch {
message.error(t("knowledgeBase.detail.messages.fileDeleteFailed"));
}
Expand Down Expand Up @@ -263,7 +265,17 @@ const KnowledgeBaseDetailPage: React.FC = () => {
label: t("knowledgeBase.detail.actions.deleteFile"),
icon: <DeleteOutlined className="w-4 h-4" />,
danger: true,
onClick: handleDeleteFile,
onClick: (file: KBFile) => {
Modal.confirm({
title: t("knowledgeBase.detail.confirm.deleteFileTitle"),
content: t("knowledgeBase.detail.confirm.deleteFileDescription", { name: file.name }),
okText: t("knowledgeBase.detail.confirm.okText"),
okType: "danger",
cancelText: t("knowledgeBase.detail.confirm.cancelText"),
centered: true,
onOk: () => handleDeleteFile(file),
});
},
},
];

Expand Down
Loading
Loading