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.
This commit is contained in:
Yun Chan 2026-10-20 22:48:17 +09:00
parent 51a80ad56c
commit ce8d603b4a
2 changed files with 7 additions and 4 deletions

View file

@ -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()

View file

@ -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']