Print engine/gateway URL more clearly (#396)

This commit is contained in:
Will Chen
2025-06-13 10:05:12 -07:00
committed by GitHub
parent 99e6592abc
commit 67dc9f4c42
2 changed files with 16 additions and 5 deletions

View File

@@ -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.

View File

@@ -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 ?? "<prod>"} \x1b[0m`,
);
} else {
logger.info(
`\x1b[1;30;43m Using Dyad Pro gateway: ${dyadGatewayUrl ?? "<prod>"} \x1b[0m`,
);
}
// Do not use free variant (for openrouter).
const modelName = model.name.split(":free")[0];
const autoModelClient = {