From 2c8333e9f67b9c2db5a54848f614bc0f39af1c88 Mon Sep 17 00:00:00 2001 From: binyangzhu000-sudo <224954946+binyangzhu000-sudo@users.noreply.github.com> Date: Thu, 30 Jul 2026 22:16:17 +0800 Subject: [PATCH] feat: add Atlas Cloud provider Signed-off-by: binyangzhu000-sudo <224954946+binyangzhu000-sudo@users.noreply.github.com> --- src/types/settings.ts | 1 + src/utils/chatApiRoute.test.ts | 35 +++++++++++++++++++++++++++++ src/utils/thirdPartyApiProviders.ts | 10 +++++++++ 3 files changed, 46 insertions(+) diff --git a/src/types/settings.ts b/src/types/settings.ts index 7c4441a2..f7238317 100644 --- a/src/types/settings.ts +++ b/src/types/settings.ts @@ -51,6 +51,7 @@ export const THIRD_PARTY_PROVIDER_IDS = [ 'qwen', 'kimi', 'glm', + 'atlascloud', 'custom', ] as const; export type ThirdPartyProviderId = (typeof THIRD_PARTY_PROVIDER_IDS)[number]; diff --git a/src/utils/chatApiRoute.test.ts b/src/utils/chatApiRoute.test.ts index 0609267f..ec44508a 100644 --- a/src/utils/chatApiRoute.test.ts +++ b/src/utils/chatApiRoute.test.ts @@ -43,4 +43,39 @@ describe('resolveChatApiRoute', () => { provider: expect.objectContaining({ apiKey: 'kimi-key' }), }); }); + + it('routes the built-in Atlas Cloud provider through the OpenAI-compatible path', () => { + const providers = createDefaultThirdPartyApiSettings().providers; + const appSettings = createAppSettings({ + isThirdPartyApiEnabled: true, + thirdPartyApi: { + activeProvider: 'atlascloud', + providers: { + ...providers, + atlascloud: { + ...providers.atlascloud, + apiKey: 'atlascloud-key', + enabled: true, + }, + }, + }, + }); + const chatSettings = createChatSettings({ + apiMode: 'third-party', + modelId: 'deepseek-ai/deepseek-v4-pro', + thirdPartyProviderId: 'atlascloud', + thirdPartyModelId: 'deepseek-ai/deepseek-v4-pro', + }); + + expect(resolveChatApiRoute(appSettings, chatSettings)).toMatchObject({ + apiMode: 'third-party', + modelId: 'deepseek-ai/deepseek-v4-pro', + providerId: 'atlascloud', + provider: { + apiKey: 'atlascloud-key', + baseUrl: 'https://api.atlascloud.ai/v1', + protocol: 'openai-compatible', + }, + }); + }); }); diff --git a/src/utils/thirdPartyApiProviders.ts b/src/utils/thirdPartyApiProviders.ts index 0cc4cdbe..6da014ac 100644 --- a/src/utils/thirdPartyApiProviders.ts +++ b/src/utils/thirdPartyApiProviders.ts @@ -16,6 +16,7 @@ export const THIRD_PARTY_PROVIDER_IDS = [ 'qwen', 'kimi', 'glm', + 'atlascloud', 'custom', ] as const; @@ -27,6 +28,7 @@ export const THIRD_PARTY_PROVIDER_LABELS: Record = qwen: 'Qwen', kimi: 'Kimi', glm: 'GLM', + atlascloud: 'Atlas Cloud', custom: 'Custom', }; @@ -98,6 +100,14 @@ const DEFAULT_THIRD_PARTY_PROVIDER_CONFIGS: Record