This commit is contained in:
董宏凯 committed 2026-05-17 13:08:45 +08:00
1 parent 4533755704
commit cc8703577d
42 files changed
+5909 -5

No files matched your search

@@ -0,0 +1,46 @@
import type { ProgressEvent } from '../../types/ai-writing';
import { TimelineStep } from './TimelineStep';
interface AIWritingTimelineProps {
events: ProgressEvent[];
/**
* 各干预点的专属内容插槽。
* 在阶段四/五/六填充素材卡、大纲卡、审核卡等组件。
*/
interventionSlot?: React.ReactNode;
}
const DISPLAYED_TYPES = new Set([
'step_start',
'step_done',
'materials_ready',
'outline_ready',
'draft_ready',
'review_ready',
'await_user',
'resumed',
'done',
'error',
]);
export function AIWritingTimeline({ events, interventionSlot }: AIWritingTimelineProps) {
const visible = events.filter((e) => DISPLAYED_TYPES.has(e.type));
if (visible.length === 0) return null;
return (
<div className="px-4 py-3 space-y-0">
{visible.map((event, idx) => {
const isLast = idx === visible.length - 1;
// 在最后一个 await_user 事件后插入干预插槽
const showSlot = isLast && event.type === 'await_user' && interventionSlot;
return (
<TimelineStep key={idx} event={event} isLast={isLast && !showSlot}>
{showSlot ? interventionSlot : null}
</TimelineStep>
);
})}
</div>
);
}