"use client"; import type { HumanCopyCaseInputPayload, HumanCopyResultVersionPayload, OptimizationResultVersion, } from "../../lib/cases/types"; interface HumanCopyCaseDetailProps { input: unknown; version: OptimizationResultVersion | null; } const intensityLabels: Record = { light: "轻微整理", medium: "适度润色", conversational: "更口语自然", }; export function HumanCopyCaseDetail({ input, version, }: HumanCopyCaseDetailProps) { const payload = isHumanCopyInput(input) ? input : null; const result = isHumanCopyResult(version?.payload) ? version.payload : null; return ( <>
原始文案
{payload ? ( <>
{payload.source_text}
) : (

没有保存输入。

)}
优化后文案
{result ? ( <>
{result.optimized_text}

改动说明

{result.change_notes.length > 0 ? (
    {result.change_notes.map((note, index) => (
  • {note.reason}

    原句:{note.original} 改后:{note.revised} {note.revertible ? 这处可还原。 : null}
  • ))}
) : (

没有改动说明。

)}

AI 味检查

{result.ai_taste_checks.length > 0 ? (
    {result.ai_taste_checks.map((check) => (
  • {check.rule_id} {check.status}
    {check.evidence} {check.suggestion ? {check.suggestion} : null}
  • ))}
) : (

没有 AI 味检查记录。

)}
{result.warnings.length > 0 ? ( ) : null} ) : (

{version?.error_summary ?? "当前版本没有优化结果。"}

)}
); } function MetaItem({ label, value }: { label: string; value: string }) { return (
{label} {value}
); } function isHumanCopyInput(value: unknown): value is HumanCopyCaseInputPayload { return ( value !== null && typeof value === "object" && "source_text" in value && "goal" in value ); } function isHumanCopyResult(value: unknown): value is HumanCopyResultVersionPayload { return ( value !== null && typeof value === "object" && "optimized_text" in value && "change_notes" in value ); }