From 67dc9f4c42e8a0182b24a3bdea02cca3241abbb5 Mon Sep 17 00:00:00 2001 From: Will Chen Date: Fri, 13 Jun 2025 10:05:12 -0700 Subject: [PATCH] Print engine/gateway URL more clearly (#396) --- e2e-tests/helpers/test_helper.ts | 2 +- src/ipc/utils/get_model_client.ts | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/e2e-tests/helpers/test_helper.ts b/e2e-tests/helpers/test_helper.ts index ec3a239..db8b6d8 100644 --- a/e2e-tests/helpers/test_helper.ts +++ b/e2e-tests/helpers/test_helper.ts @@ -687,7 +687,7 @@ export const test = base.extend<{ process.env.OLLAMA_HOST = "http://localhost:3500/ollama"; process.env.LM_STUDIO_BASE_URL_FOR_TESTING = "http://localhost:3500/lmstudio"; - process.env.DYAD_LOCAL_ENGINE = "http://localhost:3500/engine/v1"; + process.env.DYAD_ENGINE_URL = "http://localhost:3500/engine/v1"; process.env.DYAD_GATEWAY_URL = "http://localhost:3500/gateway/v1"; process.env.E2E_TEST_BUILD = "true"; // This is just a hack to avoid the AI setup screen. diff --git a/src/ipc/utils/get_model_client.ts b/src/ipc/utils/get_model_client.ts index 04c99f6..42058a2 100644 --- a/src/ipc/utils/get_model_client.ts +++ b/src/ipc/utils/get_model_client.ts @@ -14,7 +14,7 @@ import { createDyadEngine } from "./llm_engine_provider"; import { findLanguageModel } from "./findLanguageModel"; import { LM_STUDIO_BASE_URL } from "./lm_studio_utils"; -const dyadLocalEngine = process.env.DYAD_LOCAL_ENGINE; +const dyadEngineUrl = process.env.DYAD_ENGINE_URL; const dyadGatewayUrl = process.env.DYAD_GATEWAY_URL; const AUTO_MODELS = [ @@ -101,7 +101,7 @@ export async function getModelClient( // we're using local engine. // IMPORTANT: some providers like OpenAI have an empty string gateway prefix, // so we do a nullish and not a truthy check here. - if (providerConfig.gatewayPrefix != null || dyadLocalEngine) { + if (providerConfig.gatewayPrefix != null || dyadEngineUrl) { const languageModel = await findLanguageModel(model); const engineProMode = settings.enableProSmartFilesContextMode || @@ -115,7 +115,7 @@ export async function getModelClient( const provider = isEngineEnabled ? createDyadEngine({ apiKey: dyadApiKey, - baseURL: dyadLocalEngine ?? "https://engine.dyad.sh/v1", + baseURL: dyadEngineUrl ?? "https://engine.dyad.sh/v1", dyadOptions: { enableLazyEdits: settings.enableProLazyEditsMode, enableSmartFilesContext: settings.enableProSmartFilesContextMode, @@ -127,7 +127,18 @@ export async function getModelClient( baseURL: dyadGatewayUrl ?? "https://llm-gateway.dyad.sh/v1", }); - logger.info(`Using Dyad Pro API key. engine_enabled=${isEngineEnabled}`); + logger.info( + `\x1b[1;97;44m Using Dyad Pro API key for model: ${model.name}. engine_enabled=${isEngineEnabled} \x1b[0m`, + ); + if (isEngineEnabled) { + logger.info( + `\x1b[1;30;42m Using Dyad Pro engine: ${dyadEngineUrl ?? ""} \x1b[0m`, + ); + } else { + logger.info( + `\x1b[1;30;43m Using Dyad Pro gateway: ${dyadGatewayUrl ?? ""} \x1b[0m`, + ); + } // Do not use free variant (for openrouter). const modelName = model.name.split(":free")[0]; const autoModelClient = {