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

@ -50,9 +50,14 @@ class OnlineLLMService extends EventEmitter {
const token = this._ensureAuth()
const apiUrl = normalizeLoopbackUrl(configGet('onlineApiUrl') ?? 'http://127.0.0.1:5000')
const systemPrompt = resolveSystemPrompt(action, targetLanguage, customPrompt)
// cancelGeneration() 이 실제로 이 요청을 끊도록 컨트롤러를 등록한다(예전엔 한 번도 할당되지 않아 no-op).
this._abortController?.abort()
const controller = new AbortController()
this._abortController = controller
try {
const response = await fetch(`${apiUrl}/api/llm/generate`, {
signal: controller.signal,
method: 'POST',
headers: {
'Content-Type': 'application/json',
@ -89,10 +94,15 @@ class OnlineLLMService extends EventEmitter {
return data.text.trim()
} catch (err) {
if (err instanceof D3ROError) throw err
if (controller.signal.aborted) {
throw new D3ROError(ErrorCode.LLMProcessingCancelled, 'Online LLM request cancelled')
}
throw new D3ROError(
ErrorCode.LLMProcessingFailed,
`온라인 API 서버 연결 실패: ${err instanceof Error ? err.message : String(err)}`
)
} finally {
if (this._abortController === controller) this._abortController = null
}
}