fix(desktop): harden session, meeting, caption and LLM lifecycles; route LLM calls through the gateway

This commit is contained in:
Yun Chan 2026-09-28 02:16:15 +09:00
parent 3a46437f28
commit ddc78546f0
62 changed files with 4786 additions and 648 deletions

View file

@ -13,6 +13,26 @@ export function normalizeDictionaryWord(raw: string): string | null {
return word.length > 0 ? word : null
}
/**
* 단어의 식별 키 — 같은 카테고리에서 이 키가 같으면 같은 단어다.
* 서버 유일 인덱스 `(user_id, lower(btrim(word)), category)` 와 같은 규칙(대소문자 무시).
* 로컬이 'API' 와 'api' 를 따로 받아들이면, 동기화 때 서버 충돌(23505)로 로컬 행이 서버 행으로
* 대체되며 사용자가 넣은 표기와 발음이 조용히 사라진다.
*/
export function dictionaryIdentityKey(word: string): string {
return word.trim().toLowerCase()
}
/** 같은 카테고리의 기존 단어 중 식별 키가 같은 첫 항목 (excludeId 는 자기 자신 제외용) */
export function findDictionaryIdentityConflict<T extends { id: string; word: string }>(
word: string,
candidates: readonly T[],
excludeId?: string
): T | null {
const key = dictionaryIdentityKey(word)
return candidates.find((c) => c.id !== excludeId && dictionaryIdentityKey(c.word) === key) ?? null
}
/**
* 발음 입력을 정규화한다.
* - undefined → undefined: "변경 없음"