Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

feat(ai): add AstraFlow provider preset

t8y224523d44f6a8
diff --git a/apps/desktop/public/icons/ai/astraflow.png b/apps/desktop/public/icons/ai/astraflow.png
new file mode 100644
index 0000000000..f3ba6243b2
Binary files /dev/null and b/apps/desktop/public/icons/ai/astraflow.png differ
diff --git a/apps/desktop/src/i18n/__tests__/featureMessages.spec.ts b/apps/desktop/src/i18n/__tests__/featureMessages.spec.ts
index 932c46c0bc..ece710e199 100644
--- a/apps/desktop/src/i18n/__tests__/featureMessages.spec.ts
+++ b/apps/desktop/src/i18n/__tests__/featureMessages.spec.ts
@@ -43,6 +43,7 @@ const under = (namespace: string, keys: string[]) => keys.map((key) => `${namesp
// leaks the raw key path, and a key missing from a locale silently shows
// English.
const FEATURE_MESSAGES: FeatureMessages[] = [
+ { feature: "AstraFlow provider", keys: ["ai.astraflowDescription"], translated: true },
{ feature: "AI HTML preview (#6467)", keys: under("ai", ["htmlPreviewLabel", "htmlExpandPreview", "htmlExpandPreviewHint", "htmlSaveSafe", "htmlSaveFailed", "htmlCopySource", "htmlCopyRiskBody", "htmlCopyRiskAccept", "htmlCopyRiskRemember", "htmlCopyRiskToast"]) },
{ feature: "AI conversation export (#6467)", keys: under("ai", ["exportConversation", "conversationExportMarkdown", "conversationExportHtml", "conversationRoleUser", "conversationRoleAssistant", "conversationFailedMarker", "conversationExportEmpty"]) },
{ feature: "AI conversation management", keys: under("ai", ["renameConversation", "conversationRenameFailed", "clearDatabaseSelection", "searchDatabases", "noDatabasesFound"]) },
diff --git a/apps/desktop/src/i18n/locales/az.ts b/apps/desktop/src/i18n/locales/az.ts
index 27e608db65..44de9c8af4 100644
--- a/apps/desktop/src/i18n/locales/az.ts
+++ b/apps/desktop/src/i18n/locales/az.ts
@@ -2889,6 +2889,7 @@ export default withEnglishFallback({
hualongDescription:
"🐉 AI ilə intensiv işləyən tərtibatçılar üçün rəsmi mənbəli model vasitəçisi! Yoxlanıla bilən token səviyyəli hesablaşma, müəssisə müqavilələri və hesab-fakturalarla 100% orijinal Codex və Claude seriyaları.\n🎉$1 pulsuz kredit üçün DBX&HUALONG promo kodu ilə qeydiyyatdan keçin!",
aicodemirrorDescription: "⚡ AICodeMirror korporativ səviyyəli yüksək paralellik, sürətli faktura və 7×24 xüsusi dəstək təklif edir; yeni istifadəçilər ¥8 pulsuz kredit və ilk dolduruşda 20% endirim qazanır.",
+ astraflowDescription: "UCloud-un AstraFlow platforması bir API açarı ilə 200-dən çox populyar süni intellekt modelinə çıxış verir və OpenAI API ilə uyğundur.",
visitPartner: "Tərəfdaşın saytına keç",
getApiKey: "API açarı əldə et",
defaultModel: "Standart model",
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index 9c43416dac..5912f48d6b 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -3382,6 +3382,7 @@ export default {
jalapenoDescription: "🎉 Enterprise-grade AI trusted by leading teams is now available to you! Try cutting-edge models at 50% off and get more bonus credit when you top up more!",
hualongDescription: "🐉 Official-source model relay for heavy AI developers! 100% genuine Codex and Claude series with verifiable token-level billing, enterprise contracts, and invoicing.\n🎉Sign up with promo code DBX&HUALONG for $1 free credit!",
aicodemirrorDescription: "⚡ AICodeMirror delivers enterprise-grade concurrency, fast invoicing, and 7×24 dedicated support; new users get ¥8 in free credit plus 20% off their first top-up.",
+ astraflowDescription: "AstraFlow by UCloud provides access to 200+ mainstream AI models with a single API key, compatible with the OpenAI API.",
visitPartner: "Visit partner website",
getApiKey: "Get API key",
defaultModel: "Default Model",
diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts
index 5bcaea2ba0..8b71c8c3f3 100644
--- a/apps/desktop/src/i18n/locales/es.ts
+++ b/apps/desktop/src/i18n/locales/es.ts
@@ -3284,6 +3284,7 @@ export default withEnglishFallback({
jalapenoDescription: "🎉 ¡La IA de nivel empresarial que utilizan los equipos líderes ya está disponible para ti! ¡Prueba modelos de vanguardia con un 50 % de descuento y recibe más bonificaciones al recargar!",
hualongDescription: "🐉 ¡Relay de modelos con fuente oficial para desarrolladores de IA intensivos! Serie Codex/Claude 100% oficial, facturación por token verificable, contratos y facturas. \n🎉¡Regístrate con el código promocional DBX&HUALONG y obtén 1 $ de crédito!",
aicodemirrorDescription: "⚡ AICodeMirror ofrece concurrencia de nivel empresarial, facturación rápida y soporte dedicado 7×24; los nuevos usuarios obtienen ¥8 de crédito gratuito y un 20% de descuento en su primera recarga.",
+ astraflowDescription: "AstraFlow de UCloud ofrece acceso a más de 200 modelos de IA populares con una sola clave API y es compatible con la API de OpenAI.",
visitPartner: "Visitar el sitio web del socio",
getApiKey: "Obtener clave API",
defaultModel: "Modelo predeterminado",
diff --git a/apps/desktop/src/i18n/locales/id.ts b/apps/desktop/src/i18n/locales/id.ts
index d3503bde37..3fc7968efd 100644
--- a/apps/desktop/src/i18n/locales/id.ts
+++ b/apps/desktop/src/i18n/locales/id.ts
@@ -3190,6 +3190,7 @@ export default withEnglishFallback({
jalapenoDescription: "🎉 AI tingkat enterprise yang dipercaya tim-tim terkemuka kini tersedia untuk Anda! Coba model mutakhir dengan diskon 50% dan dapatkan bonus kredit lebih besar saat top up lebih banyak!",
hualongDescription: "🐉 Relay model sumber resmi untuk developer AI berat! Seri Codex dan Claude 100% asli dengan penagihan berbasis token yang dapat diverifikasi, kontrak enterprise, dan invoicing.\n🎉Daftar dengan kode promo DBX&HUALONG untuk kredit gratis $1!",
aicodemirrorDescription: "⚡ AICodeMirror menghadirkan konkurensi tingkat enterprise, invoicing cepat, dan dukungan khusus 7×24; pengguna baru mendapat kredit gratis ¥8 plus diskon 20% untuk top up pertama.",
+ astraflowDescription: "AstraFlow dari UCloud menyediakan akses ke lebih dari 200 model AI populer dengan satu API key, kompatibel dengan API OpenAI.",
visitPartner: "Kunjungi situs web mitra",
getApiKey: "Dapatkan API key",
defaultModel: "Model Default",
diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.ts
index 414979c1de..39901ed28b 100644
--- a/apps/desktop/src/i18n/locales/it.ts
+++ b/apps/desktop/src/i18n/locales/it.ts
@@ -3135,6 +3135,7 @@ export default withEnglishFallback({
jalapenoDescription: "🎉 L'AI di livello enterprise usata dai team migliori è ora disponibile per te! Prova i modelli all'avanguardia con il 50% di sconto e ottieni più bonus ricaricando di più!",
hualongDescription: "🐉 Relay di modelli con fonte ufficiale per sviluppatori AI intensivi! Serie Codex/Claude 100% ufficiale, fatturazione a token verificabile, contratti e fatture. \n🎉Registrati con il codice promo DBX&HUALONG e ottieni 1 $ di credito!",
aicodemirrorDescription: "⚡ AICodeMirror offre concorrenza di livello enterprise, fatturazione rapida e supporto dedicato 7×24; i nuovi utenti ottengono ¥8 di credito gratuito e il 20% di sconto sulla prima ricarica.",
+ astraflowDescription: "AstraFlow di UCloud offre accesso a oltre 200 modelli di IA diffusi con un'unica chiave API ed è compatibile con l'API OpenAI.",
visitPartner: "Visita il sito del partner",
getApiKey: "Ottieni la chiave API",
defaultModel: "Modello predefinito",
diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.ts
index 331b69a254..44a350a903 100644
--- a/apps/desktop/src/i18n/locales/ja.ts
+++ b/apps/desktop/src/i18n/locales/ja.ts
@@ -3160,6 +3160,7 @@ export default withEnglishFallback({
jalapenoDescription: "🎉トップチームも利用するエンタープライズ向けAIが、あなたのもとへ!最先端モデルを50%オフで今すぐ体験。さらにチャージするほどボーナスも増量!",
hualongDescription: "🐉 ヘビーなAI開発者のための公式直結リレー!Codex/Claudeシリーズは100%公式ソース、トークン単位の明細検証、法人契約・請求書対応。\n🎉プロモコード DBX&HUALONG で登録すると$1クレジット進呈!",
aicodemirrorDescription: "⚡ AICodeMirror はエンタープライズ級の高同時実行、迅速なインボイス発行、7×24 の専任サポートを提供。新規ユーザーは 8 元の無料クレジットと初回チャージ 20% オフを獲得できます。",
+ astraflowDescription: "UCloud の AstraFlow は、1 つの API キーで 200 以上の主要 AI モデルを利用できる、OpenAI API 互換のプラットフォームです。",
visitPartner: "パートナーサイトを開く",
getApiKey: "APIキーを取得",
defaultModel: "デフォルトモデル",
diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.ts
index dd4359f419..0a23b23f70 100644
--- a/apps/desktop/src/i18n/locales/ko.ts
+++ b/apps/desktop/src/i18n/locales/ko.ts
@@ -3086,6 +3086,7 @@ export default withEnglishFallback({
jalapenoDescription: "🎉 최고의 팀들이 사용하는 엔터프라이즈급 AI를 이제 만나보세요! 최첨단 모델을 50% 할인으로 바로 체험하고, 충전할수록 더 많은 보너스를 받으세요!",
hualongDescription: "🐉 헤비 AI 개발자를 위한 공식 직결 릴레이! Codex/Claude 시리즈 100% 공식 소스, 토큰 단위 명세 검증, 기업 계약 및 인보이스 지원. \n🎉프로모 코드 DBX&HUALONG 로 가입하면 $1 크레딧 증정!",
aicodemirrorDescription: "⚡ AICodeMirror는 기업급 동시 처리, 빠른 세금계산서 발급, 7×24 전담 기술 지원을 제공합니다. 신규 사용자는 8위안 무료 크레딧과 첫 충전 20% 할인을 받습니다.",
+ astraflowDescription: "UCloud의 AstraFlow는 하나의 API 키로 200개 이상의 주요 AI 모델을 이용할 수 있는 OpenAI API 호환 플랫폼입니다.",
visitPartner: "파트너 웹사이트 방문",
getApiKey: "API 키 받기",
defaultModel: "기본 모델",
diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts
index 281adc61b4..155396b962 100644
--- a/apps/desktop/src/i18n/locales/pt-BR.ts
+++ b/apps/desktop/src/i18n/locales/pt-BR.ts
@@ -3137,6 +3137,7 @@ export default withEnglishFallback({
jalapenoDescription: "🎉 A IA de nível empresarial usada pelas principais equipes agora está disponível para você! Experimente modelos de ponta com 50% de desconto e ganhe mais bônus ao recarregar mais!",
hualongDescription: "🐉 Relay de modelos com fonte oficial para desenvolvedores de IA intensivos! Série Codex/Claude 100% oficial, faturamento por token verificável, contratos e notas fiscais. \n🎉Cadastre-se com o código promocional DBX&HUALONG e ganhe US$ 1 de crédito!",
aicodemirrorDescription: "⚡ AICodeMirror oferece concorrência de nível corporativo, faturamento rápido e suporte dedicado 7×24; novos usuários ganham ¥8 de crédito gratuito e 20% de desconto na primeira recarga.",
+ astraflowDescription: "O AstraFlow da UCloud oferece acesso a mais de 200 modelos populares de IA com uma única chave de API e é compatível com a API da OpenAI.",
visitPartner: "Visitar site do parceiro",
getApiKey: "Obter chave de API",
defaultModel: "Modelo padrão",
diff --git a/apps/desktop/src/i18n/locales/ru.ts b/apps/desktop/src/i18n/locales/ru.ts
index 980b0f6363..a2f7875e37 100644
--- a/apps/desktop/src/i18n/locales/ru.ts
+++ b/apps/desktop/src/i18n/locales/ru.ts
@@ -3241,6 +3241,7 @@ export default withEnglishFallback({
hualongDescription:
"🐉 Официальный ретранслятор моделей для активных ИИ-разработчиков! 100% подлинные модели серий Codex и Claude с проверяемой токен-биллинговой детализацией, корпоративными контрактами и выставлением счетов.\n🎉Зарегистрируйтесь с промокодом DBX&HUALONG и получите $1 бесплатного кредита!",
aicodemirrorDescription: "⚡ AICodeMirror — корпоративная масштабируемость, быстрые счета и поддержка 7×24; новые пользователи получают 8 юаней бесплатного кредита и скидку 20% на первое пополнение.",
+ astraflowDescription: "AstraFlow от UCloud предоставляет доступ к более чем 200 популярным моделям ИИ с одним API-ключом и совместим с API OpenAI.",
visitPartner: "Посетить сайт партнёра",
getApiKey: "Получить ключ API",
defaultModel: "Модель по умолчанию",
diff --git a/apps/desktop/src/i18n/locales/tr.ts b/apps/desktop/src/i18n/locales/tr.ts
index 07153a1a39..d4e7975658 100644
--- a/apps/desktop/src/i18n/locales/tr.ts
+++ b/apps/desktop/src/i18n/locales/tr.ts
@@ -2863,6 +2863,7 @@ export default withEnglishFallback({
jalapenoDescription: "🎉 Önde gelen ekiplerin güvendiği kurumsal düzeyde yapay zekâ artık sizin için de kullanılabilir! En yeni modelleri %50 indirimle deneyin ve daha çok yükleme yaptıkça daha çok bonus kredi kazanın!",
hualongDescription: "🐉 Yoğun yapay zekâ geliştiricileri için resmî kaynak aktarıcı! Codex/Claude serisi %100 resmî kaynak, doğrulanabilir belirteç düzeyinde fatura, kurumsal sözleşme ve fatura. \n🎉DBX&HUALONG promosyon koduyla kayıt olun, 1$ kredi kazanın!",
aicodemirrorDescription: "⚡ AICodeMirror, kurumsal düzeyde eşzamanlılık, hızlı faturalandırma ve 7×24 özel destek sunar; yeni kullanıcılar ¥8 ücretsiz kredi ve ilk yüklemede %20 indirim kazanır.",
+ astraflowDescription: "UCloud'un AstraFlow platformu, tek bir API anahtarıyla 200'den fazla popüler yapay zekâ modeline erişim sağlar ve OpenAI API ile uyumludur.",
visitPartner: "İş ortağının web sitesini ziyaret et",
getApiKey: "API anahtarı al",
defaultModel: "Varsayılan Model",
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index bda67f3475..7032ac4d47 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -3316,6 +3316,7 @@ export default withEnglishFallback({
jalapenoDescription: "🎉顶尖团队都在用的企业级 AI,现在为你而来!【5折前沿模型】立刻体验!更有【多充多送】羊毛狠狠薅!",
hualongDescription: "🐉 面向重度 AI 开发者的官方直连中转!Codex/Claude 系列 100% 官方源直供,Token 级账单逐笔可核验,支持企业合同与发票。\n🎉用优惠码 DBX&HUALONG 注册即得 $1 额度!",
aicodemirrorDescription: "⚡ AICodeMirror 支持企业级高并发、极速开票、7×24 专属技术支持,新人免费领 8 元额度和首充 8 折。",
+ astraflowDescription: "UCloud 优刻得旗下星图 AstraFlow 大模型平台,一个 API Key 即可调用 200+ 主流大模型,兼容 OpenAI API。",
visitPartner: "访问合作伙伴网站",
getApiKey: "获取 API Key",
defaultModel: "默认模型",
diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts
index 45de66e492..4aba5c56ef 100644
--- a/apps/desktop/src/i18n/locales/zh-TW.ts
+++ b/apps/desktop/src/i18n/locales/zh-TW.ts
@@ -3142,6 +3142,7 @@ export default withEnglishFallback({
jalapenoDescription: "🎉頂尖團隊都在使用的企業級 AI,現在也為你而來!【5 折前沿模型】立即體驗!還有【儲值越多送越多】的優惠!",
hualongDescription: "🐉 面向重度 AI 開發者的官方直連中轉!Codex/Claude 系列 100% 官方源直供,Token 級帳單可逐筆核驗,支援企業合約與發票。\n🎉用優惠碼 DBX&HUALONG 註冊即得 $1 額度!",
aicodemirrorDescription: "⚡ AICodeMirror 支援企業級高併發、極速開票與 7×24 專屬技術支援,新人免費領 8 元額度和首充 8 折。",
+ astraflowDescription: "UCloud 優刻得旗下星圖 AstraFlow 大模型平台,一個 API Key 即可呼叫 200+ 主流大模型,相容 OpenAI API。",
visitPartner: "前往合作夥伴網站",
getApiKey: "取得 API Key",
defaultModel: "預設模型",
diff --git a/apps/desktop/src/lib/ai/__tests__/aiConfigList.spec.ts b/apps/desktop/src/lib/ai/__tests__/aiConfigList.spec.ts
index eb3bbd14c1..077d417fad 100644
--- a/apps/desktop/src/lib/ai/__tests__/aiConfigList.spec.ts
+++ b/apps/desktop/src/lib/ai/__tests__/aiConfigList.spec.ts
@@ -24,6 +24,15 @@ describe("generateId", () => {
});
describe("AI model options", () => {
+ it("uses discovered or manually added models without a preset default", () => {
+ const config = { model: "" };
+
+ expect(aiModelOptions(config, [])).toEqual([]);
+ expect(aiModelOptions(config, [{ id: "discovered-model" }])).toEqual([{ id: "discovered-model" }]);
+ expect(aiModelOptions({ ...config, models: addConfiguredAiModel(undefined, "manual-model") }, [])).toEqual([expect.objectContaining({ id: "manual-model" })]);
+ expect(config.model).toBe("");
+ });
+
it("keeps saved models selectable when provider model discovery fails", () => {
const options = aiModelOptions(
{
diff --git a/apps/desktop/src/stores/__tests__/settingsStore.spec.ts b/apps/desktop/src/stores/__tests__/settingsStore.spec.ts
index 84a1aa6856..fae9f11506 100644
--- a/apps/desktop/src/stores/__tests__/settingsStore.spec.ts
+++ b/apps/desktop/src/stores/__tests__/settingsStore.spec.ts
@@ -11,7 +11,10 @@ import {
EXECUTE_MODE_CURRENT_DEFAULT_VERSION,
SIDEBAR_BROWSE_OBJECTS_MIGRATION_VERSION,
enforceRightSidebarPanelExclusivity,
+ getAiProviderPreset,
getAiProviderPresetDefaultEndpoint,
+ getAiProviderPresetId,
+ getAiProviderPresetOption,
normalizeAiConfig,
normalizeDesktopSettings,
normalizeEditorSettings,
@@ -1228,6 +1231,42 @@ describe("settingsStore AI API key normalization", () => {
});
});
+ it("appends AstraFlow as a partner preset without a default model", () => {
+ const preset = getAiProviderPresetOption("astraflow");
+
+ expect(AI_PROVIDER_PARTNER_PRESETS.at(-1)).toBe(preset);
+ expect(preset).toMatchObject({
+ id: "astraflow",
+ label: "AstraFlow",
+ iconPath: "/icons/ai/astraflow.png",
+ group: "partner",
+ provider: "openai-compatible",
+ endpoint: "https://api.modelverse.cn/v1",
+ model: "",
+ apiStyle: "completions",
+ authMethod: "bearer",
+ requiresApiKey: true,
+ websiteUrl: "https://www.ucloud.cn/site/active/kuaijiesale.html?ytag=geo_waituo_github_dbx",
+ apiKeyUrl: "https://console.ucloud.cn/modelverse/experience/api-keys",
+ descriptionKey: "ai.astraflowDescription",
+ });
+ expect(preset.models ?? []).toEqual([]);
+ expect(normalizeAiConfig(preset)).toMatchObject({
+ provider: "openai-compatible",
+ endpoint: "https://api.modelverse.cn/v1",
+ model: "",
+ });
+ });
+
+ it("recognizes saved AstraFlow configs without changing other compatible providers", () => {
+ const preset = getAiProviderPresetOption("astraflow");
+
+ expect(getAiProviderPreset("openai-compatible", "https://api.modelverse.cn/v1")).toBe(preset);
+ expect(getAiProviderPresetId("openai-compatible", " HTTPS://API.MODELVERSE.CN/v1/ ")).toBe("astraflow");
+ expect(getAiProviderPreset("openai-compatible", "https://example.com/v1")).toBe(AI_PROVIDER_PRESETS["openai-compatible"]);
+ expect(getAiProviderPresetOption("hualong-ai").model).toBe("deepseek-v4.1-flash");
+ });
+
it("uses the mainland MiniMax endpoint only for new zh-CN presets", () => {
expect(getAiProviderPresetDefaultEndpoint(AI_PROVIDER_PRESETS.minimax, "zh-CN")).toBe("https://api.minimaxi.com/v1");
expect(getAiProviderPresetDefaultEndpoint(AI_PROVIDER_PRESETS.minimax, "zh-TW")).toBe("https://api.minimax.io/v1");
diff --git a/apps/desktop/src/stores/settingsStore.ts b/apps/desktop/src/stores/settingsStore.ts
index 910f8d4fdd..1cdc404f73 100644
--- a/apps/desktop/src/stores/settingsStore.ts
+++ b/apps/desktop/src/stores/settingsStore.ts
@@ -553,6 +553,21 @@ export const AI_PROVIDER_PARTNER_PRESETS: readonly AiPartnerProviderPreset[] = [
descriptionKey: "ai.hualongDescription",
badgeKey: "ai.hualongSponsored",
},
+ {
+ id: "astraflow",
+ label: "AstraFlow",
+ iconPath: "/icons/ai/astraflow.png",
+ group: "partner",
+ provider: "openai-compatible",
+ endpoint: "https://api.modelverse.cn/v1",
+ model: "",
+ apiStyle: "completions",
+ authMethod: "bearer",
+ requiresApiKey: true,
+ websiteUrl: "https://www.ucloud.cn/site/active/kuaijiesale.html?ytag=geo_waituo_github_dbx",
+ apiKeyUrl: "https://console.ucloud.cn/modelverse/experience/api-keys",
+ descriptionKey: "ai.astraflowDescription",
+ },
];
function normalizeAiProviderEndpoint(endpoint: string): string {