feat(knowledge): 工单验收自动生成草稿,核对后发布,来源可追

- knowledge_doc 与 item 1:1,除 source_kind=manual 外必须有来源(库级约束)
- 状态机 draft/in_review/published/archived,发布要 owner/admin;非法动作回 allowed_from 与 allowed_actions
- 工单验收通过自动落 postmortem 草稿(generated_by=rule),同一来源只生成一次
- 接口:列表/详情/手记/改内容/状态动作/从事项沉淀;已发布禁改,改内容带乐观锁
- Web 知识页 + 详情抽屉;任务与工单详情里可「沉淀成知识」
- 8 个后端用例 + e2e 7 项断言(沉淀 → 待核对 → 发布)
This commit is contained in:
dadao
2026-10-28 14:02:35 +08:00
parent 3471b07ac1
commit e9addeed25
17 changed files with 1957 additions and 1 deletions
+28
View File
@@ -112,3 +112,31 @@ export interface Notification {
read_at: string | null;
created_at: string;
}
export type KnowledgeStatus = "draft" | "in_review" | "published" | "archived";
export interface KnowledgeInfo {
doc_type: string;
summary: string;
status_hint: KnowledgeStatus;
source_kind: "manual" | "task" | "ticket";
source_item_id: string | null;
generated_by: "human" | "rule";
published_at: string | null;
archived_at: string | null;
chunk_count: number;
author_id: string;
}
export interface KnowledgeSource {
id: string;
kind: string;
title: string;
status: string;
}
export interface Knowledge extends Item {
knowledge: KnowledgeInfo;
source: KnowledgeSource | null;
activities?: Activity[];
}