diff --git a/frontend-web/src/open-canvas/components/ai-writing/CompletedInterventionCard.tsx b/frontend-web/src/open-canvas/components/ai-writing/CompletedInterventionCard.tsx index 70619177..5cbc9d99 100644 --- a/frontend-web/src/open-canvas/components/ai-writing/CompletedInterventionCard.tsx +++ b/frontend-web/src/open-canvas/components/ai-writing/CompletedInterventionCard.tsx @@ -5,7 +5,7 @@ import { } from 'lucide-react'; import { cn } from '@/lib/utils'; import { buildIntranetSourceUrl } from '@/core/config'; -import type { CompletedIntervention } from '../../types/ai-writing'; +import type { AIMaterial, CompletedIntervention } from '../../types/ai-writing'; import { OutlineCard } from './OutlineCard'; import { ReviewCard } from './ReviewCard'; import { ScoreBar } from './ScoreBar'; @@ -65,35 +65,79 @@ function MaterialCompleted({ record, expanded, onToggle }: { record: CompletedIn {expanded && record.materials && record.materials.length > 0 && (
- {record.materials.map((m) => { - const pct = Math.round(m.relevanceScore * 100); - const barColor = - m.relevanceScore >= 0.8 ? 'bg-green-500' - : m.relevanceScore >= 0.5 ? 'bg-orange-400' - : 'bg-red-400'; - return ( -
-

{m.title}

-
- {m.source} - {m.publishedAt && <>·{m.publishedAt}} -
-
-
-
- {pct}% -
- {m.recUuid && ( - - )} -
-
- ); - })} + {record.materials.map((m) => ( + + ))} +
+ )} +
+ ); +} + +function relevanceLabel(score: number): string { + if (score >= 0.8) return '高相关'; + if (score >= 0.5) return '中相关'; + return '低相关'; +} + +function CompletedMaterialItem({ material }: { material: AIMaterial }) { + const [open, setOpen] = useState(false); + const pct = Math.round(material.relevanceScore * 100); + const barColor = + material.relevanceScore >= 0.8 ? 'bg-green-500' + : material.relevanceScore >= 0.5 ? 'bg-orange-400' + : 'bg-red-400'; + const hasDetail = !!material.content || !!material.recUuid; + + return ( +
+ + + {open && hasDetail && ( +
+ {material.content && ( +

+ {material.content.slice(0, 300)} + {material.content.length > 300 && '…'} +

+ )} + {material.recUuid && ( + + )}
)}