From ce8d603b4ad339b5ce4effa0096b9d175e7236f5 Mon Sep 17 00:00:00 2001 From: Yun Chan Date: Tue, 20 Oct 2026 22:48:17 +0900 Subject: [PATCH] fix(chain): route chain steps through the LLM gateway instead of always calling the premium proxy Chains were pinned to the premium service, so they always failed in anonymous local mode and sent text to the cloud for signed-in users who had chosen the local backend. --- apps/desktop/src/main/services/ChainService.ts | 6 ++++-- apps/desktop/tests/main/services/ChainService.test.ts | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/desktop/src/main/services/ChainService.ts b/apps/desktop/src/main/services/ChainService.ts index 8706afc..6589ecd 100644 --- a/apps/desktop/src/main/services/ChainService.ts +++ b/apps/desktop/src/main/services/ChainService.ts @@ -5,7 +5,7 @@ import { getLogger } from './LoggerService' import { configGet, configSet } from './ConfigService' import { getCustomInstructionService } from './CustomInstructionService' -import { getPremiumLLMService } from './PremiumLLMService' +import { getLlmGateway } from './llm/LlmGateway' import { buildInstructionInvocation, resolveTargetLanguage } from './llm-prompts' import { getMainWindow } from '../windows/WindowManager' import { IPC_CHANNELS } from '@d3ro/core/ipc-channels' @@ -161,7 +161,9 @@ class ChainService { const stepResults: Array<{ instructionId: string; output: string; durationMs: number }> = [] let previousOutput = inputText - const llm = getPremiumLLMService() + // 백엔드 선택(로컬/프리미엄·폴백)은 게이트웨이가 정한다 — 프리미엄 고정이면 익명 로컬 모드에선 늘 실패하고 + // 로컬을 고른 사용자 텍스트가 클라우드로 갔다. + const llm = getLlmGateway() const instructionService = getCustomInstructionService() const targetLanguage = resolveTargetLanguage() diff --git a/apps/desktop/tests/main/services/ChainService.test.ts b/apps/desktop/tests/main/services/ChainService.test.ts index 9c263c1..eeb14d3 100644 --- a/apps/desktop/tests/main/services/ChainService.test.ts +++ b/apps/desktop/tests/main/services/ChainService.test.ts @@ -34,8 +34,9 @@ const mockLLM = vi.hoisted(() => ({ cancelGeneration: vi.fn() })) -vi.mock('../../../src/main/services/PremiumLLMService', () => ({ - getPremiumLLMService: () => mockLLM +// 체인은 백엔드 선택을 게이트웨이에 맡긴다(프리미엄 고정 아님) +vi.mock('../../../src/main/services/llm/LlmGateway', () => ({ + getLlmGateway: () => mockLLM })) let getChainService: typeof import('../../../src/main/services/ChainService')['getChainService']