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

@ -142,3 +142,21 @@ export function fitChatRequest(request: ChatRequest, limits: Readonly<ChatReques
if (fittedSystem !== undefined) fitted.system = fittedSystem
return fitted
}
/** 단일 턴 요청(generate/processText)에서 한도를 넘는 부분. */
export type SingleTurnLimitViolation = 'system' | 'message'
/**
* 단일 턴 요청이 한도를 넘는지 (순수 함수). 서버(parseLlmRequest)처럼 앞뒤 공백을 빼고 센다.
* 채팅과 달리 잘라 보내지 않는다 — 자유 생성 입력(회의 전사·요약 대상)을 조용히 자르면
* 결과가 입력의 앞부분만 반영하고도 완전한 것처럼 보인다. 호출자가 나누거나(map-reduce) 실패를 알린다.
*/
export function singleTurnLimitViolation(
input: { system?: string; message: string },
limits: Readonly<ChatRequestLimits> = LLM_PROXY_CHAT_LIMITS,
): SingleTurnLimitViolation | null {
const system = input.system?.trim()
if (system && system.length > limits.maxSystemChars) return 'system'
if (input.message.trim().length > limits.maxMessageChars) return 'message'
return null
}