chore: preserve frontend concept lab

This commit is contained in:
hailin
2026-07-14 13:39:36 +08:00
parent f46369883e
commit 13b0768dfd
33 changed files with 1987 additions and 192 deletions

View File

@@ -0,0 +1,30 @@
import { Badge } from '@/components/ui/badge'
const sourceLabels: Record<string, string> = {
knowledge_item: '知识条目',
solution: '解决方案',
ticket: '历史工单',
document: '文档'
}
type AppReferenceCardProps = {
title: string
sourceType: string
content: string
score: number
sourceLabel?: string
}
export function AppReferenceCard({ title, sourceType, content, score, sourceLabel }: AppReferenceCardProps) {
return (
<article className="grid gap-2 rounded-md border border-border bg-background p-3">
<div className="flex flex-wrap items-center gap-2">
<p className="font-medium text-foreground">{title}</p>
<Badge variant="secondary">{sourceLabels[sourceType] ?? sourceType}</Badge>
<Badge variant="outline">匹配度 {Math.round(score * 100)}%</Badge>
</div>
<p className="line-clamp-4 whitespace-pre-line text-sm leading-6 text-muted-foreground">{content}</p>
{sourceLabel ? <p className="text-xs text-muted-foreground">来源:{sourceLabel}</p> : null}
</article>
)
}