Unverified 提交 7bcb68e8 authored 作者: Will Chen's avatar Will Chen 提交者: GitHub

Fix model client gateway prefix check (openAI erroneously not using dyad gateway…

Fix model client gateway prefix check (openAI erroneously not using dyad gateway for dyad pro) (#174)
上级 07984386
......@@ -99,7 +99,9 @@ export async function getModelClient(
if (dyadApiKey && settings.enableDyadPro) {
// Check if the selected provider supports Dyad Pro (has a gateway prefix) OR
// we're using local engine.
if (providerConfig.gatewayPrefix || dyadLocalEngine) {
// 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) {
const languageModel = await findLanguageModel(model);
// Currently engine is only used for turbo edits.
const isEngineEnabled = Boolean(
......@@ -112,7 +114,8 @@ export async function getModelClient(
apiKey: dyadApiKey,
baseURL: dyadLocalEngine ?? "https://engine.dyad.sh/v1",
})
: createOpenAI({
: createOpenAICompatible({
name: "dyad-gateway",
apiKey: dyadApiKey,
baseURL: dyadGatewayUrl ?? "https://llm-gateway.dyad.sh/v1",
});
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论