Some checks failed
ci / 정본·보안·린트·타입·테스트 (push) Has been cancelled
deploy-site / deploy (push) Has been cancelled
ci / 워크스페이스 빌드 검증 (push) Has been cancelled
ci / 모바일 린트·타입·Jest (push) Has been cancelled
ci / Supabase Edge Functions + Cloudflare Worker (push) Has been cancelled
ci / .NET API 서버 테스트 (push) Has been cancelled
Typo auto-correct (INPUT-19) - TypoCorrectionService + core typo-correction: 2-set Korean layout mistypes both ways, always-wrong spellings, near-misses of the user's frequent words, optional model check re-validated in core; applied by backspace N + paste and cancelled on new keys or window change. Prediction quality (INPUT-20/21) - gemma models are sent raw with the user's unfinished sentence pre-filled into the model turn, so the model truly continues the text (mid-word joins and spacing exact). Other models keep the instruction prompt. - Context: text before the caret (opening lines and a fact list of names, dates, amounts outside the 400-char window), messages just sent in the same chat window (memory only, 30 min), personal-graph follow-ups and IDF-ranked related sentences with Korean stemming. - Guards: first sentence only, restated-prefix stripping (also fixes the instruction path), repeat drop, no invented dates/names/numbers (one retry), plain -다 register, no emoji unless the user uses them, search-box keywords. Fill loop mixes instruction prompts for variety. - Opt-in real-model probe: tests/integration/suggestion-quality.ollama.test.ts Suggestions now actually show up - Terminal (Claude Code): caret trust from the input line, not the whole screen (status line below the box blocked every keystroke); Korean composition counts as typing at the end; a grey placeholder filling the empty box at once is not user text. - Chrome: UIA focus flicker while typing no longer resets "edited". - KakaoTalk/RichEdit: trailing paragraph mark ignored for edit position and stripped so accepted text keeps its separating space. - While the overlay is visible the suggestion shortcuts are captured so Ctrl+Alt+Enter no longer also types a newline; released when hidden. - nut-js preloaded after boot (first accept waited 4.8 s).
77 lines
3.6 KiB
TypeScript
77 lines
3.6 KiB
TypeScript
// tests/main/services/personal-graph-context.test.ts
|
|
// 개인 그래프 문맥 조회 (실제 SQLite) — 직전 문장 follows · 조사 무관 용어 매칭 · 짧은 꼬리 물러나기.
|
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
import { createTestDb } from '../../helpers/createTestDb'
|
|
|
|
const holder = vi.hoisted(() => ({ db: null as unknown }))
|
|
|
|
vi.mock('../../../src/main/db', async (importOriginal) => ({
|
|
...(await importOriginal<typeof import('../../../src/main/db')>()),
|
|
getDatabase: () => holder.db
|
|
}))
|
|
vi.mock('../../../src/main/services/LoggerService', () => ({
|
|
getLogger: () => ({ debug: vi.fn(), info: vi.fn(), warn: vi.fn(), error: vi.fn() })
|
|
}))
|
|
|
|
import {
|
|
getPersonalGraphService,
|
|
resetPersonalGraphServiceForTests
|
|
} from '../../../src/main/services/PersonalGraphService'
|
|
|
|
let testDb: ReturnType<typeof createTestDb>
|
|
|
|
beforeEach(() => {
|
|
testDb = createTestDb()
|
|
holder.db = testDb.db
|
|
resetPersonalGraphServiceForTests()
|
|
})
|
|
|
|
afterEach(() => {
|
|
testDb.close()
|
|
})
|
|
|
|
describe('PersonalGraphService.retrieveContext', () => {
|
|
it('직전 문장 뒤에 사용자가 실제로 이어 쓴 문장을 followUps 로 준다', () => {
|
|
const graph = getPersonalGraphService()
|
|
graph.indexText('배포 끝났습니다. 모니터링 대시보드 확인 부탁드립니다.', { source: 'typed' })
|
|
graph.indexText('배포 끝났습니다. 모니터링 대시보드 확인 부탁드립니다.', { source: 'typed' })
|
|
|
|
const context = graph.retrieveContext('오전 작업 공유드립니다. 배포 끝났습니다. ')
|
|
expect(context.followUps).toEqual(['모니터링 대시보드 확인 부탁드립니다'])
|
|
})
|
|
|
|
it('직전 문장이 조금 달라도 용어가 거의 같으면 그 노드의 follows 를 쓴다', () => {
|
|
const graph = getPersonalGraphService()
|
|
graph.indexText('주간 보고서 초안 작성했습니다. 피드백은 금요일까지 부탁드려요.', { source: 'typed' })
|
|
|
|
const context = graph.retrieveContext('주간 보고서 초안을 작성했습니다! ')
|
|
expect(context.followUps).toEqual(['피드백은 금요일까지 부탁드려요'])
|
|
})
|
|
|
|
it('조사가 달라도 같은 주제의 문장을 관련 문장으로 끌어온다', () => {
|
|
const graph = getPersonalGraphService()
|
|
graph.indexText('금요일 배포를 위해 회귀 테스트를 끝내야 합니다', { source: 'typed' })
|
|
graph.indexText('점심은 김치찌개 어때요', { source: 'typed' })
|
|
|
|
const context = graph.retrieveContext('이번 배포는 회귀 테스트가')
|
|
expect(context.related).toContain('금요일 배포를 위해 회귀 테스트를 끝내야 합니다')
|
|
expect(context.related).not.toContain('점심은 김치찌개 어때요')
|
|
})
|
|
|
|
it('긴 꼬리가 맞지 않으면 짧은 어절 꼬리로 물러나 이어쓰기를 찾는다', () => {
|
|
const graph = getPersonalGraphService()
|
|
graph.indexText('회의록은 내일 오전까지 공유드리겠습니다', { source: 'typed' })
|
|
|
|
const context = graph.retrieveContext('지난번 논의한 안건의 회의록은')
|
|
expect(context.continuations).toEqual(['내일 오전까지 공유드리겠습니다'])
|
|
})
|
|
|
|
it('이미 접두에 쓴 문장은 다시 주지 않는다', () => {
|
|
const graph = getPersonalGraphService()
|
|
graph.indexText('배포 끝났습니다. 배포 로그 확인했습니다.', { source: 'typed' })
|
|
|
|
const context = graph.retrieveContext('배포 끝났습니다. 배포 로그 확인했습니다. ')
|
|
expect(context.related).not.toContain('배포 로그 확인했습니다')
|
|
expect(context.followUps).not.toContain('배포 로그 확인했습니다')
|
|
})
|
|
})
|