update: 更新伏笔管理删除和同步逻辑,避免重复引入

This commit is contained in:
xiamuceer
2026-04-09 09:15:11 +08:00
parent 5968a3d29e
commit 425aab9eec
6 changed files with 357 additions and 19 deletions
+73 -1
View File
@@ -333,7 +333,14 @@ export default function ChapterAnalysis({ chapterId, visible, onClose }: Chapter
const renderAnalysisResult = () => {
if (!analysis) return null;
const { analysis: analysis_data, memories } = analysis;
const { analysis: analysis_data, memories, entity_changes } = analysis;
const hasEntityChanges = Boolean(
entity_changes && (
(entity_changes.careers?.changes?.length || 0) > 0 ||
(entity_changes.character_states?.changes?.length || 0) > 0 ||
(entity_changes.organization_states?.changes?.length || 0) > 0
)
);
return (
<Tabs
@@ -411,6 +418,71 @@ export default function ChapterAnalysis({ chapterId, visible, onClose }: Chapter
</Card>
)}
{hasEntityChanges && entity_changes && (
<Card title="实体联动更新" style={{ marginBottom: 16 }} size={isMobile ? 'small' : 'default'}>
<Row gutter={isMobile ? 8 : 16} style={{ marginBottom: 16 }}>
<Col span={isMobile ? 24 : 8}>
<Statistic
title="职业更新"
value={entity_changes.careers?.updated_count || 0}
/>
</Col>
<Col span={isMobile ? 24 : 8}>
<Statistic
title="角色状态/关系更新"
value={
(entity_changes.character_states?.state_updated_count || 0) +
(entity_changes.character_states?.relationship_created_count || 0) +
(entity_changes.character_states?.relationship_updated_count || 0) +
(entity_changes.character_states?.org_updated_count || 0)
}
/>
</Col>
<Col span={isMobile ? 24 : 8}>
<Statistic
title="组织状态更新"
value={entity_changes.organization_states?.updated_count || 0}
/>
</Col>
</Row>
{entity_changes.careers?.changes?.length ? (
<div style={{ marginBottom: 12 }}>
<strong></strong>
<div style={{ marginTop: 8 }}>
{entity_changes.careers.changes.map((change, index) => (
<Tag key={`career-${index}`} color="blue" style={{ marginBottom: 8 }}>
{change}
</Tag>
))}
</div>
</div>
) : null}
{entity_changes.character_states?.changes?.length ? (
<div style={{ marginBottom: 12 }}>
<strong>/</strong>
<List
size="small"
dataSource={entity_changes.character_states.changes}
renderItem={(item) => <List.Item>{item}</List.Item>}
/>
</div>
) : null}
{entity_changes.organization_states?.changes?.length ? (
<div>
<strong></strong>
<List
size="small"
dataSource={entity_changes.organization_states.changes}
renderItem={(item) => <List.Item>{item}</List.Item>}
/>
</div>
) : null}
</Card>
)}
{analysis_data.suggestions && analysis_data.suggestions.length > 0 && (
<Card title={<><BulbOutlined /> </>} size={isMobile ? 'small' : 'default'}>
<List
+14
View File
@@ -744,12 +744,26 @@ export interface StoryMemory {
is_foreshadow: 0 | 1 | 2; // 0=普通, 1=已埋下, 2=已回收
}
export interface EntityChangesSummaryItem {
updated_count?: number;
state_updated_count?: number;
relationship_created_count?: number;
relationship_updated_count?: number;
org_updated_count?: number;
changes: string[];
}
// 章节分析结果响应 - 匹配后端API返回
export interface ChapterAnalysisResponse {
chapter_id: string;
analysis: AnalysisData; // 注意:后端返回的是analysis而不是analysis_data
memories: StoryMemory[];
created_at: string;
entity_changes?: {
careers: EntityChangesSummaryItem;
character_states: EntityChangesSummaryItem;
organization_states: EntityChangesSummaryItem;
};
}
// 手动触发分析响应