feat(review): 人物塑造 advisory 审(第五审,仅建议不阻断验收)
写→审链新增第五审「人物塑造」(灵感③/D2):advisory 单维——仅建议、不阻断
验收(不进 conflicts、不碰 assert_conflicts_resolved、不入 REVIEW_RESERVED_NAMES);
只做人物塑造、不做氛围。
- SPEC characterization_spec(analyst,reads=("characters",),writes=())+
prompts/characterization.md(只读、显式忽略文本长度与辞藻华丽度、引用逐字片段+置信度)
- schema CharacterizationReview{issues[...]}(全字段默认值守解析韧性)+ 注册 catalog
- 计数三处 22→23 + regen prompt_hashes.json(仅加一条)
- DB chapter_reviews 加 characterization JSONB nullable 列(迁移 f6a7b8c9d0e1)
- 接线:graph REVIEW_SPECS 追加 · chain ReviewRecordRepo · collect(extract/record) ·
review_repo(Protocol/Sql/_to_view/ReviewView) · sse(event/factory/section) · normalize 自动纳入
- 契约 ReviewHistoryItem 加 characterization(gen:api 已重生成)
- 前端 sse/history/useReviewStream + CharacterizationPanel(只展示无裁决 UI、置信度降序+低置信折叠)+ ReviewReport 挂面板
- 测试 test_characterization_does_not_block_accept + 计数/golden + collect/normalize + 前端 reducer/normalize/parse
守不变量 #2/#3/#9;依赖 ⑧(motive/appearance 作客观锚点)。
This commit is contained in:
@@ -32,6 +32,7 @@ import {
|
||||
} from "@/lib/review/decisions";
|
||||
import {
|
||||
latestReview,
|
||||
normalizeCharacterization,
|
||||
normalizeConflicts,
|
||||
normalizeForeshadowSug,
|
||||
normalizePace,
|
||||
@@ -56,6 +57,7 @@ import { useToast } from "@/components/Toast";
|
||||
import { ThinkingIndicator } from "@/components/ThinkingIndicator";
|
||||
import { AcceptPanel } from "./AcceptPanel";
|
||||
import { AnnotatedText } from "./AnnotatedText";
|
||||
import { CharacterizationPanel } from "./CharacterizationPanel";
|
||||
import { ConflictCard } from "./ConflictCard";
|
||||
import { ForeshadowSuggestions } from "./ForeshadowSuggestions";
|
||||
import { PacePanel } from "./PacePanel";
|
||||
@@ -128,6 +130,10 @@ export function ReviewReport({
|
||||
() => normalizeStyleDrift(initialReview),
|
||||
[initialReview],
|
||||
);
|
||||
const seededCharacterization = useMemo(
|
||||
() => normalizeCharacterization(initialReview),
|
||||
[initialReview],
|
||||
);
|
||||
useEffect(() => {
|
||||
if (seededRef.current) return;
|
||||
seededRef.current = true;
|
||||
@@ -135,22 +141,32 @@ export function ReviewReport({
|
||||
seededConflicts.length > 0 ||
|
||||
seededForeshadow.length > 0 ||
|
||||
seededPace !== null ||
|
||||
seededStyle !== null;
|
||||
seededStyle !== null ||
|
||||
seededCharacterization !== null;
|
||||
if (hasSeed) {
|
||||
review.seed({
|
||||
conflicts: seededConflicts,
|
||||
foreshadow: seededForeshadow,
|
||||
pace: seededPace,
|
||||
style: seededStyle,
|
||||
characterization: seededCharacterization,
|
||||
});
|
||||
}
|
||||
}, [review, seededConflicts, seededForeshadow, seededPace, seededStyle]);
|
||||
}, [
|
||||
review,
|
||||
seededConflicts,
|
||||
seededForeshadow,
|
||||
seededPace,
|
||||
seededStyle,
|
||||
seededCharacterization,
|
||||
]);
|
||||
|
||||
// 当前生效冲突 = 流状态(重审后即时更新,否则种入的历史)。
|
||||
const conflicts: ReviewConflict[] = review.state.conflicts;
|
||||
const foreshadow = review.state.foreshadow;
|
||||
const pace = review.state.pace;
|
||||
const style = review.state.style;
|
||||
const characterization = review.state.characterization;
|
||||
// 伏笔徽标/验收预览统一用「仍待处理数」(随登记/回收递减);未上报前回退原始建议数。
|
||||
const foreshadowOpen = foreshadowRemaining ?? foreshadow.length;
|
||||
const sectionStatus = (name: string): string | undefined =>
|
||||
@@ -359,7 +375,7 @@ export function ReviewReport({
|
||||
const fresh = normalizeConflicts(latestReview(data?.reviews));
|
||||
setMissing(new Set(outcome.missingIndices));
|
||||
if (fresh.length > 0) {
|
||||
review.seed({ conflicts: fresh, foreshadow, pace, style });
|
||||
review.seed({ conflicts: fresh, foreshadow, pace, style, characterization });
|
||||
setDrafts(emptyDecisions(fresh.length));
|
||||
toast("审稿报告已刷新:检测到未裁决冲突,请裁决后再验收", "error");
|
||||
} else {
|
||||
@@ -405,7 +421,8 @@ export function ReviewReport({
|
||||
seededConflicts.length > 0 ||
|
||||
foreshadow.length > 0 ||
|
||||
pace !== null ||
|
||||
style !== null;
|
||||
style !== null ||
|
||||
characterization !== null;
|
||||
|
||||
return (
|
||||
<AppShell
|
||||
@@ -671,6 +688,35 @@ export function ReviewReport({
|
||||
onRefine={onRefineSegment}
|
||||
/>
|
||||
</ReviewSectionPanel>
|
||||
<ReviewSectionPanel
|
||||
title="人物塑造"
|
||||
statusLabel={
|
||||
sectionStatus("characterization") === "incomplete"
|
||||
? "未完成"
|
||||
: characterization && characterization.issues.length > 0
|
||||
? `${characterization.issues.length} 建议`
|
||||
: characterization
|
||||
? "无明显问题"
|
||||
: "无报告"
|
||||
}
|
||||
statusVariant={
|
||||
sectionStatus("characterization") === "incomplete"
|
||||
? "warning"
|
||||
: characterization && characterization.issues.length > 0
|
||||
? "accent"
|
||||
: characterization
|
||||
? "success"
|
||||
: "neutral"
|
||||
}
|
||||
defaultOpen={
|
||||
characterization !== null && characterization.issues.length > 0
|
||||
}
|
||||
>
|
||||
<CharacterizationPanel
|
||||
characterization={characterization}
|
||||
incomplete={sectionStatus("characterization") === "incomplete"}
|
||||
/>
|
||||
</ReviewSectionPanel>
|
||||
{refineText !== null ? (
|
||||
<RefineView
|
||||
projectId={project.id}
|
||||
|
||||
Reference in New Issue
Block a user