690519:1631 224 to 226 AI #01
CI / CD Pipeline / build (push) Failing after 3m57s
CI / CD Pipeline / deploy (push) Has been skipped

This commit is contained in:
2026-05-19 16:31:50 +07:00
parent 3e25097470
commit ea5499123e
127 changed files with 12387 additions and 42 deletions
@@ -0,0 +1,71 @@
// File: components/ai/intent-classification/analytics/intent-breakdown-table.tsx
// Change Log
// - 2026-05-19: สร้าง Intent Breakdown Table สำหรับ Analytics Dashboard (T036, US3).
'use client';
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from '@/components/ui/table';
import { Progress } from '@/components/ui/progress';
import type { IntentStats } from '@/lib/services/ai-intent.service';
interface IntentBreakdownTableProps {
data: IntentStats[];
}
/**
* ตารางแสดงสถิติแยกตาม intent code พร้อม bar แสดง pattern vs llm
*/
export function IntentBreakdownTable({ data }: IntentBreakdownTableProps) {
if (data.length === 0) {
return <p className="text-sm text-muted-foreground"></p>;
}
return (
<Table>
<TableHeader>
<TableRow>
<TableHead>Intent Code</TableHead>
<TableHead className="text-right">Total</TableHead>
<TableHead className="text-right">Pattern</TableHead>
<TableHead className="text-right">LLM</TableHead>
<TableHead className="text-right">Avg Confidence</TableHead>
<TableHead className="w-[120px]">Pattern Rate</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{data.map((row) => {
const patternRate =
row.count > 0 ? (row.patternHits / row.count) * 100 : 0;
return (
<TableRow key={row.intentCode}>
<TableCell className="font-mono text-sm">
{row.intentCode}
</TableCell>
<TableCell className="text-right">{row.count}</TableCell>
<TableCell className="text-right">{row.patternHits}</TableCell>
<TableCell className="text-right">{row.llmHits}</TableCell>
<TableCell className="text-right">
{row.avgConfidence.toFixed(2)}
</TableCell>
<TableCell>
<div className="flex items-center gap-2">
<Progress value={patternRate} className="h-2" />
<span className="text-xs text-muted-foreground w-10 text-right">
{patternRate.toFixed(0)}%
</span>
</div>
</TableCell>
</TableRow>
);
})}
</TableBody>
</Table>
);
}