Files
inkling/tests/integration/ollama-golden.test.ts
altair823 723dccd61d feat(ai): AI-primary due_date flow — rule as prompt candidates only
Flow 반전 (F7-D 채택):
- 기존: rule.iso ?? ai.dueDate (rule 우선)
- 신규: ai.dueDate ?? null (AI 우선)

규칙은 parseAllCandidates 로 모든 매치를 추출 → prompt 에 후보
힌트로 주입. AI 가 종합 판단. AI 실패 시 due_date null (별 fallback 없음).

해결되는 케이스: '내일 모레' → AI 가 ambiguous 인지 → null.

PROMPT_VERSION → 3. GenerateInput.dueDateCandidates 신규.
buildPrompt(rawText, todayKst, candidates) — 빈 배열일 때 hint 섹션 생략.

Tests:
- AiWorker.test.ts — 'rule priority' 테스트 → 'AI dueDate wins' flip
- AiWorker.test.ts — passes todayKst 테스트 확장 (dueDateCandidates 도 검증)
- AiWorker.test.ts — 신규 'passes parseAllCandidates result as dueDateCandidates'
- LocalOllamaProvider.test.ts / ollama-golden.test.ts — generate 호출에 dueDateCandidates: [] 추가

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 13:06:12 +09:00

29 lines
1.1 KiB
TypeScript

import { describe, it, expect, beforeAll } from 'vitest';
import { LocalOllamaProvider } from '@main/ai/LocalOllamaProvider.js';
const skip = process.env.INKLING_INTEGRATION !== '1';
describe.skipIf(skip)('LocalOllamaProvider integration', () => {
const provider = new LocalOllamaProvider({
endpoint: process.env.INKLING_OLLAMA_ENDPOINT
});
beforeAll(async () => {
const h = await provider.healthCheck();
if (!h.ok) throw new Error(`Ollama not ready: ${h.reason}`);
});
const cases = [
'회의 중 A프로젝트 API 타임아웃 문제가 재발했다는 보고를 받음.',
'Stack trace: java.net.SocketTimeoutException at com.inkling.Api.call ... retried 3 times.',
'오늘 점심 김치찌개 맛있었음. 오후에 디자인 미팅 있다.'
];
it.each(cases)('Korean title + 3 lines for: %s', async (input) => {
const r = await provider.generate({ text: input, todayKst: '2026-04-26', dueDateCandidates: [] });
expect(/[가-힣]/.test(r.title)).toBe(true);
expect(r.summary.split('\n')).toHaveLength(3);
for (const t of r.tags) expect(t).toMatch(/^[a-z0-9]+(-[a-z0-9]+)*$/);
}, 180_000);
});