feat(knowledge): 添加知识条目导出功能和文件上传支持

- 在 KnowledgeItemApplicationService 中新增 exportKnowledgeItems 方法实现知识条目导出
- 添加 export 相关常量配置包括文件名格式、内容类型等
- 在 KnowledgeItemRepository 中新增 findAllBySetId 查询方法
- 在 KnowledgeItemController 中新增 export 接口端点
- 在 KnowledgeItemEditor 组件中添加文件上传功能支持 txt/md/markdown 格式
- 在 KnowledgeSetDetail 页面中添加导出按钮并集成导出 API
- 更新前端 API 文件添加 exportKnowledgeItemsUsingGet 方法
- 配置文件上传验证和自动填充标题内容逻辑
This commit is contained in:
2026-01-26 11:13:21 +08:00
parent be98a9534c
commit a8c7c9404c
7 changed files with 153 additions and 3 deletions

View File

@@ -11,7 +11,7 @@ import {
Tag,
Tooltip,
} from "antd";
import { DeleteOutlined, EditOutlined, EyeOutlined, PlusOutlined } from "@ant-design/icons";
import { DeleteOutlined, DownloadOutlined, EditOutlined, EyeOutlined, PlusOutlined } from "@ant-design/icons";
import { useNavigate, useParams } from "react-router";
import DetailHeader from "@/components/DetailHeader";
import { SearchControls } from "@/components/SearchControls";
@@ -19,6 +19,7 @@ import useFetchData from "@/hooks/useFetchData";
import {
deleteKnowledgeItemByIdUsingDelete,
deleteKnowledgeSetByIdUsingDelete,
exportKnowledgeItemsUsingGet,
queryKnowledgeItemsUsingGet,
queryKnowledgeSetByIdUsingGet,
} from "../knowledge-management.api";
@@ -100,6 +101,12 @@ const KnowledgeSetDetail = () => {
fetchData();
};
const handleExportItems = async () => {
if (!id) return;
await exportKnowledgeItemsUsingGet(id);
message.success("知识条目导出成功");
};
const isReadableItem = (record: KnowledgeItemView) => {
return (
record.contentType === KnowledgeContentType.TEXT ||
@@ -286,6 +293,12 @@ const KnowledgeSetDetail = () => {
onClick: () => setShowEdit(true),
danger: false,
},
{
key: "export",
label: "导出",
icon: <DownloadOutlined />,
onClick: handleExportItems,
},
{
key: "delete",
label: "删除",