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:
Yun Chan 2026-09-27 22:55:26 +09:00
parent 7e0c20b510
commit 1b8fe445f3
5 changed files with 63 additions and 5 deletions

View file

@ -18,7 +18,7 @@ import { getLogger } from './LoggerService'
const logger = getLogger('ConfigService')
/** 제안/텔레메트리 튜닝 기본값의 현재 개정판. 기본값을 바꾸면 올린다. */
const SUGGESTION_TUNING_REVISION = 5
const SUGGESTION_TUNING_REVISION = 6
const INITIAL_SUGGESTION_TUNING = {
suggestionTriggerDelayMs: 300,
@ -59,6 +59,11 @@ function migrateSuggestionTuning(activeStore: ElectronStore<AppConfig>): void {
}
if (current < 5) migrateSuggestionOverlayBindings(activeStore)
// 설정 화면에 없는 값인데 설치본에 100ms 가 남아 치는 도중 생성이 시작됐다 — 하한 미만이면 기본값으로.
if (current < 6) {
const delay = Number(raw.suggestionTriggerDelayMs)
if (!Number.isFinite(delay) || delay < 500) activeStore.set('suggestionTriggerDelayMs', 600)
}
activeStore.set('suggestionTuningRevision', SUGGESTION_TUNING_REVISION)
logger.info(

View file

@ -356,7 +356,11 @@ class SuggestionService extends EventEmitter {
// 즉시 세션을 끝낸다(사용자 요청 사양: 계속 자라는 접두를 따라가지 않는다).
// 다음 멈춤에서 정책 게이트를 다시 거쳐 새 세션이 시작된다.
if (this.isVisible && !matchesSessionPrefix(this._generatedForPrefix, context.prefix)) {
logger.debug('제안 닫음: 이어서 입력함 — 멈추면 새 문맥으로 다시 만든다')
this.dismiss('stale')
// 사용자가 고르지 않고 계속 쳤다 — 이 세션 때문에 최소 간격(5초)에 걸려
// 정작 멈췄을 때 아무것도 안 뜨면 안 된다. 분당·일일 상한은 그대로 둔다.
this._lastRequestAt = Math.min(this._lastRequestAt, now - SUGGESTION_DEFAULTS.minIntervalMs)
this.emit('state-changed', this.getState())
return
}
@ -1330,7 +1334,10 @@ class SuggestionService extends EventEmitter {
excludedApps: string[]
} {
return {
triggerDelayMs: configGet('suggestionTriggerDelayMs') || SUGGESTION_DEFAULTS.triggerDelayMs,
triggerDelayMs: Math.max(
SUGGESTION_DEFAULTS.minTriggerDelayMs,
configGet('suggestionTriggerDelayMs') || SUGGESTION_DEFAULTS.triggerDelayMs
),
minPrefixChars: configGet('suggestionMinPrefixChars') || SUGGESTION_DEFAULTS.minPrefixChars,
maxRequestsPerMinute:
Math.min(