diff --git a/ui/src/api/API_README.md b/ui/src/api/API_README.md index 11446e7f425..fd40b9a8663 100644 --- a/ui/src/api/API_README.md +++ b/ui/src/api/API_README.md @@ -548,7 +548,8 @@ Workspace 共享 Paragraph API 仅 getParagraphPage、getParagraphDetail,不 Workspace、System 资源管理、System 共享提供完整问题 API: `postProblems` 直接提交内容字符串数组,`putProblem` 提交 `{ content }`,单项 DELETE 使用问题 ID, `putBatchDeleteProblems` 直接提交问题 ID 数组;单个问题内容最多 256 字符。 -`getProblemDetail` 返回 `ProblemParagraph[]`,包含分段字段及 knowledge_id、document_name。 +`getProblemDetail` 返回 `ProblemParagraph[]`,包含分段字段及 knowledge_id、document_name、knowledge_type、 +document_resource_type、document_image_id;来源元数据由后端补齐,图片详情使用 document_image_id 读取原图。 取消关联复用 Paragraph API 的 `putUnassociateParagraphProblem`,不调用问题或分段删除接口。 Workspace 共享仅有 `getProblemsPage`,不补造详情或写接口,不回退其他范围。 diff --git a/ui/src/api/types/paragraph.ts b/ui/src/api/types/paragraph.ts index c84fd35ae1f..2481ef92e80 100644 --- a/ui/src/api/types/paragraph.ts +++ b/ui/src/api/types/paragraph.ts @@ -1,4 +1,5 @@ -import type { RelatedQuestionsConfig } from './knowledge' +import type { KnowledgeType, RelatedQuestionsConfig } from './knowledge' +import type { DocumentResourceType } from './document' /** 文档分段的查询响应与新增载荷。 */ export interface ParagraphItem { @@ -29,10 +30,13 @@ export interface ProblemItem extends ParagraphProblem { update_time: string } -/** 从问题详情查询到的关联分段,额外携带所属知识库与文档名称。 */ +/** 从问题详情查询到的关联分段,包含所属知识库、文档及图片来源信息。 */ export interface ProblemParagraph extends ParagraphItem { knowledge_id: string document_name: string + knowledge_type: KnowledgeType | null + document_resource_type: DocumentResourceType + document_image_id: string | null } /** 批量将问题关联到文档分段时使用的分段引用。 */ diff --git a/ui/src/views/VIEW_README.md b/ui/src/views/VIEW_README.md index 9f82635b22e..06988ec4fa7 100644 --- a/ui/src/views/VIEW_README.md +++ b/ui/src/views/VIEW_README.md @@ -45,7 +45,7 @@ | `knowledge-detail/library/document/`、`tags/` | 文档及标签维护 | | `knowledge-detail/library/image/` | 图片列表,复用文档操作 | | `knowledge-detail/hit-test/` | 召回测试参数、文本/图片查询及结果展示 | -| `knowledge-detail/question/` | 问题管理占位页 | +| `knowledge-detail/problem/` | 问题查询、维护与分段关联 | | `knowledge-detail/termbase/` | 知识库自定义分词维护 | | `knowledge-detail/chat-user/`、`external-retrieval/` | 对话授权与外部检索配置 | | `knowledge-detail/setting/base/`、`document-strategy/`、`scheduled-sync/` | 基础设置、文档策略、定时同步与日志 | @@ -246,14 +246,17 @@ System 资源管理或 System 共享 Knowledge API 的 `postKnowledgeHitTest`; ### 问题管理 -`question/` 使用 `resourceApi.problem`,默认每页 20 条,不提供表头排序,搜索将 content 传给后端。 +`problem/` 使用 `resourceApi.problem`,默认每页 20 条,不提供表头排序,搜索将 content 传给后端。 `ButtonCreateProblem` 内聚创建按钮和多行输入弹窗;快捷创建使用 `MkQuickCreate`,每个问题最多 256 字符。 单项与批量删除直接提交,删除后末页为空时回退到最后有效页;名称编辑复用 `MkEditName`。 点击数据行打开 `ProblemDetailDrawer`,勾选、名称编辑和操作按钮不触发行详情。 详情支持问题名称快捷编辑、关联分段卡片和跨页上一个/下一个;卡片复用 `.mk-paragraph-card` 样式, 点击打开已有 `ParagraphDialog`,悬浮取消关联按钮仅解除当前关联,成功刷新卡片与列表计数。 -分段详情关闭后重查关联,保持编辑与解除关联后的数据一致。 -单项、批量、详情的“关联分段”入口暂时禁用,待交互确认后接入,不创建关联弹窗或发送关联请求。 +分段详情关闭后重查关联,保持编辑与解除关联后的数据一致。关联卡片按接口来源字段显示图片、Web 或文件图标, +图片原图引用同时传给分段详情;加载失败支持重试。抽屉暴露 `refresh()`,由问题页在批量关联成功后刷新当前关联分段。 +单项、批量、详情的“关联分段”入口统一使用 `AssociateParagraphDialog`,勾选仅维护本次选择, +跨文档、图片类型及搜索保留选择;确认后通过 `putBatchAssociateProblems` 一次提交问题与分段列表, +成功关闭并刷新问题列表,失败保留选择,取消不提交。弹窗不回填既有关联或执行解除关联,解除关联仍由问题详情维护。 Workspace 共享只展示和搜索问题列表,不显示维护入口,也不打开缺少查询接口的问题详情。 ## 文档分段 diff --git a/ui/src/views/knowledge-detail/problem/components/AssociateParagraphDialog.vue b/ui/src/views/knowledge-detail/problem/components/AssociateParagraphDialog.vue index 9063d0f9e13..37e9b1dc5ec 100644 --- a/ui/src/views/knowledge-detail/problem/components/AssociateParagraphDialog.vue +++ b/ui/src/views/knowledge-detail/problem/components/AssociateParagraphDialog.vue @@ -1,15 +1,15 @@ - + + + + 重新加载 + diff --git a/ui/src/views/knowledge-detail/problem/index.vue b/ui/src/views/knowledge-detail/problem/index.vue index af473d1ca1c..b53cf2d4094 100644 --- a/ui/src/views/knowledge-detail/problem/index.vue +++ b/ui/src/views/knowledge-detail/problem/index.vue @@ -28,6 +28,7 @@ const selectedProblems = ref([]) const problemTableRef = ref<{ clearSelection: () => void }>() const quickCreateRef = ref>() const associateParagraphDialogRef = ref>() +const problemDetailDrawerRef = ref>() const detailProblem = ref() const currentIndex = computed(() => problems.value.findIndex(({ id }) => id === detailProblem.value?.id)) const hasPrevious = computed(() => currentIndex.value > 0 || (currentIndex.value === 0 && paginationConfig.value.currentPage > 1)) @@ -154,7 +155,7 @@ function handleOpenAssociateParagraphs(problemIds: string[]) { function handleAssociateParagraphsSuccess() { clearSelection() - return loadProblems() + return Promise.all([loadProblems(), problemDetailDrawerRef.value?.refresh()]) } function handleOpenProblem(problem: ProblemItem, column: TableColumnCtx | null) { @@ -264,6 +265,7 @@ onMounted(() => loadProblems())