fix(suggestion): stop generating mid-typing and let a pause bring a suggestion at once
With a 100 ms trigger left in the installed config, generation started in the gaps between keystrokes; the next key ended the session silently, and that session still counted against the 5 s minimum interval, so the moment the user actually paused nothing came (rate-limited). The log showed a generate-then-vanish cycle every 5-6 s. The trigger delay now has a 500 ms floor and settings revision 6 resets a stored value below it to 600 ms. A session ended because the user kept typing no longer blocks the next request by the minimum interval (per-minute and daily caps still apply), and that dismissal is logged.
This commit is contained in:
parent
7e0c20b510
commit
1b8fe445f3
5 changed files with 63 additions and 5 deletions
|
|
@ -48,7 +48,7 @@ describe('ConfigService suggestion tuning migration', () => {
|
|||
)
|
||||
await initConfigService()
|
||||
|
||||
expect(configGet('suggestionTuningRevision')).toBe(5)
|
||||
expect(configGet('suggestionTuningRevision')).toBe(6)
|
||||
expect(configGet('suggestionTriggerDelayMs')).toBe(600)
|
||||
expect(configGet('suggestionMaxRequestsPerMinute')).toBe(6)
|
||||
expect(configGet('suggestionMinPrefixChars')).toBe(17)
|
||||
|
|
@ -114,7 +114,7 @@ describe('ConfigService suggestion tuning migration', () => {
|
|||
// 옮기지 않는 액션은 그대로 남는다.
|
||||
expect(bindings['suggestion-next']).toEqual(OLD_NEXT)
|
||||
expect(bindings['suggestion-prev']).toEqual(OLD_PREV)
|
||||
expect(configGet('suggestionTuningRevision')).toBe(5)
|
||||
expect(configGet('suggestionTuningRevision')).toBe(6)
|
||||
|
||||
resetInMemoryConfig()
|
||||
})
|
||||
|
|
@ -144,4 +144,43 @@ describe('ConfigService suggestion tuning migration', () => {
|
|||
resetInMemoryConfig()
|
||||
})
|
||||
|
||||
it('revision 6: 하한(500ms) 미만으로 남은 멈춤 판단 시간만 기본값 600ms로 되돌린다', async () => {
|
||||
for (const [stored, expected] of [
|
||||
[100, 600],
|
||||
[800, 800],
|
||||
] as const) {
|
||||
const persisted = { suggestionTuningRevision: 5, suggestionTriggerDelayMs: stored }
|
||||
|
||||
class TestStore<T extends Record<string, unknown>> {
|
||||
store: T
|
||||
|
||||
constructor(options: { defaults: T }) {
|
||||
this.store = { ...options.defaults, ...persisted } as T
|
||||
}
|
||||
|
||||
get<K extends keyof T>(key: K): T[K] {
|
||||
return this.store[key]
|
||||
}
|
||||
|
||||
set<K extends keyof T>(key: K, value: T[K]): void {
|
||||
this.store[key] = value
|
||||
}
|
||||
|
||||
delete(key: string): void {
|
||||
delete this.store[key as keyof T]
|
||||
}
|
||||
}
|
||||
|
||||
vi.doMock('electron-store', () => ({ default: TestStore }))
|
||||
const { configGet, initConfigService, resetInMemoryConfig } = await import(
|
||||
'../../../src/main/services/ConfigService'
|
||||
)
|
||||
await initConfigService()
|
||||
expect(configGet('suggestionTuningRevision')).toBe(6)
|
||||
expect(configGet('suggestionTriggerDelayMs')).toBe(expected)
|
||||
resetInMemoryConfig()
|
||||
vi.doUnmock('electron-store')
|
||||
vi.resetModules()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -477,7 +477,8 @@ describe('입력 플로우 서비스', () => {
|
|||
available: true,
|
||||
appName: 'Notion.exe',
|
||||
windowTitle: '회의록',
|
||||
idleMs: 300,
|
||||
// 멈춤 판단 하한(500ms)을 넘긴 멈춤
|
||||
idleMs: 700,
|
||||
capturedAt: now,
|
||||
editedSinceFocus: true,
|
||||
typedRecently: true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue