feat(desktop): typo auto-correct and context-aware sentence prediction
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
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).
This commit is contained in:
parent
5ca3709b32
commit
3cac14f668
56 changed files with 4700 additions and 258 deletions
|
|
@ -6,6 +6,7 @@ import { describe, expect, it } from 'vitest'
|
|||
import {
|
||||
decideSuggestion,
|
||||
isEditAtTextEnd,
|
||||
withoutRichEditEndMark,
|
||||
shouldLearnFromApp,
|
||||
shouldPersistSuggestionPrefix,
|
||||
type SuggestionPolicyInput
|
||||
|
|
@ -48,6 +49,13 @@ describe('케어렛 신뢰도', () => {
|
|||
expect(isEditAtTextEnd('aXb', 'ab')).toBe(false)
|
||||
})
|
||||
|
||||
it('값 끝에 줄끝 문자를 붙여 주는 입력칸(RichEdit·카카오톡)에서도 끝 편집을 알아본다', () => {
|
||||
expect(isEditAtTextEnd('안녕\r', '안녕하\r')).toBe(true)
|
||||
expect(isEditAtTextEnd('오늘 회의 자\r\n', '오늘 회의 자료\r\n')).toBe(true)
|
||||
// 줄끝 문자 앞의 진짜 중간 편집은 여전히 중간 편집이다
|
||||
expect(isEditAtTextEnd('첫 문장. 둘째\r', '첫 문장이. 둘째\r')).toBe(false)
|
||||
})
|
||||
|
||||
it('caretReliable=false 면 요청하지 않고 떠 있는 세션도 닫는다', () => {
|
||||
expect(decideSuggestion(policy({ caretReliable: false }))).toEqual({ action: 'clear', reason: 'caret-unknown' })
|
||||
expect(decideSuggestion(policy({ caretReliable: false, overlayVisible: true }))).toEqual({
|
||||
|
|
@ -98,3 +106,18 @@ describe('학습 제외 앱 정본', () => {
|
|||
expect(shouldPersistSuggestionPrefix({ learnTypedText: true, appName: 'KakaoTalk.exe' })).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('RichEdit 문단 끝 표시', () => {
|
||||
const base = {
|
||||
available: true, isPassword: false, isEditable: true, isComposing: false, hasSelection: false,
|
||||
textSource: 'value' as const, caretRect: null, elementRect: null, windowTitle: null, appName: 'KakaoTalk.exe',
|
||||
processId: 1, capturedAt: 0
|
||||
}
|
||||
|
||||
it('값 끝의 \r 하나를 걷어내 이음새 공백이 빠지지 않게 한다 (사용자가 넣은 줄바꿈은 남긴다)', () => {
|
||||
expect(withoutRichEditEndMark({ ...base, text: '오늘 저녁에 시간 되면\r', caretOffset: null }).text).toBe('오늘 저녁에 시간 되면')
|
||||
expect(withoutRichEditEndMark({ ...base, text: '첫 줄\r\r', caretOffset: null }).text).toBe('첫 줄\r')
|
||||
expect(withoutRichEditEndMark({ ...base, text: '표준 줄바꿈\r\n', caretOffset: null }).text).toBe('표준 줄바꿈\r\n')
|
||||
expect(withoutRichEditEndMark({ ...base, text: 'abc\r', caretOffset: 4 }).caretOffset).toBe(3)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue