teams_planner_bot/scripts/smokeTestClassifier.ts
윤정민 fd504738eb
All checks were successful
Build and Deploy Teams Planner Bot / build-and-run (push) Successful in 14s
initial: teams planner bot with gemini classifier and docker deploy
2026-05-15 16:53:08 +09:00

65 lines
2.0 KiB
TypeScript

/**
* Run with: npx ts-node scripts/smokeTestClassifier.ts
* Verifies the LLM classifier (selected by LLM_PROVIDER) returns valid
* ClassifiedAction objects against canned plan/task fixtures.
*/
import { createClassifier } from "../src/llm/factory";
import { ClassifierInput } from "../src/llm/types";
const fixtures: { name: string; utterance: string }[] = [
{ name: "create — 새 작업 시작", utterance: "오늘 견적서 초안 작성 시작했어" },
{ name: "update — 진행률 80%", utterance: "API 통합 작업 80%까지 진행했어" },
{ name: "update — 완료", utterance: "디자인 검토 다 끝냈어" },
{ name: "ambiguous — 되묻기 기대", utterance: "그거 했어" },
];
const baseInput: Omit<ClassifierInput, "utterance"> = {
nowIso: new Date().toISOString(),
plans: [
{
planId: "plan-eng-001",
planTitle: "엔지니어링",
buckets: [
{ bucketId: "bkt-eng-todo", bucketTitle: "할 일" },
{ bucketId: "bkt-eng-doing", bucketTitle: "진행 중" },
],
},
{
planId: "plan-sales-001",
planTitle: "영업",
buckets: [{ bucketId: "bkt-sales-todo", bucketTitle: "견적/제안" }],
},
],
recentTasks: [
{
taskId: "task-api-1",
title: "API 통합 작업",
planId: "plan-eng-001",
bucketId: "bkt-eng-doing",
percentComplete: 50,
},
{
taskId: "task-design-1",
title: "디자인 검토",
planId: "plan-eng-001",
bucketId: "bkt-eng-doing",
percentComplete: 70,
},
],
};
async function main() {
const classifier = createClassifier();
for (const f of fixtures) {
process.stdout.write(`\n— ${f.name}\n 발화: "${f.utterance}"\n`);
try {
const result = await classifier.classify({ ...baseInput, utterance: f.utterance });
console.log(" 결과:", JSON.stringify(result, null, 2).replace(/\n/g, "\n "));
} catch (err) {
console.log(" ❌ ERROR:", (err as Error).message);
}
}
}
main();