feat(ai写作): 历史回看右侧成稿可编辑并保存回历史记录

- 后端新增 PUT /api/ai-writing/sessions/{id}/draft(属主校验,draft_title 可选)
- 前端历史模式放开只读,工具栏新增「保存」按钮持久化修改
- 实时写作完成态保持原样(仅导出,不落库)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
fengxiangdebaoziandClaude Opus 4.8 committed 2026-06-24 18:32:11 +08:00
1 parent 304e1b637a
commit 42f55251f2
7 files changed
+126 -6

No files matched your search

@@ -24,6 +24,8 @@ interface TextArtifactRendererProps {
isStreaming?: boolean;
/** 完成态只读(如历史回看):保留目录 + 排版,禁用编辑与 AI 润色 */
readOnly?: boolean;
/** 历史回看可编辑场景:提供后工具栏出现「保存」按钮,把修改持久化回会话 */
onSaveDraft?: (markdown: string, title?: string) => Promise<void>;
}
interface PanelPos {
@@ -40,7 +42,7 @@ interface LastAction {
customInstruction?: string;
}
export function TextArtifactRenderer({ content, isStreaming, readOnly = false }: TextArtifactRendererProps) {
export function TextArtifactRenderer({ content, isStreaming, readOnly = false, onSaveDraft }: TextArtifactRendererProps) {
const { artifact, setArtifact } = useCanvasGraphContext();
const { writingSelection } = useCanvasUIContext();
@@ -280,6 +282,7 @@ export function TextArtifactRenderer({ content, isStreaming, readOnly = false }:
markdown={content.fullMarkdown}
title={content.title}
readOnly={readOnly}
onSave={onSaveDraft}
/>
<div className="flex-1 flex min-h-0 overflow-hidden">