Procházet zdrojové kódy

feat(core): add china providers batch 2 (6 providers, 47 models from lobe@main)

fanghanjun před 6 měsíci
rodič
revize
4accbf5328

+ 7 - 0
packages/core/src/__tests__/providers-schema.test.ts

@@ -62,4 +62,11 @@ describe("providers structural integrity", () => {
     expect(getProvider("minimax")?.api).toBe("anthropic-messages");
     expect(getProvider("minimax")?.api).toBe("anthropic-messages");
     expect(getProvider("minimax")?.baseUrl).toContain("/anthropic");
     expect(getProvider("minimax")?.baseUrl).toContain("/anthropic");
   });
   });
+
+  it("B2:中国原厂批次 2 全部收录(6 个)", () => {
+    const ids = getAllProviders().map((p) => p.id);
+    for (const id of ["spark", "sensenova", "tencentcloud", "xiaomimimo", "longcat", "internlm"]) {
+      expect(ids).toContain(id);
+    }
+  });
 });
 });

+ 8 - 0
packages/core/src/llm/providers/index.ts

@@ -16,6 +16,13 @@ import { HUNYUAN } from "./hunyuan.js";
 import { BAICHUAN } from "./baichuan.js";
 import { BAICHUAN } from "./baichuan.js";
 import { STEPFUN } from "./stepfun.js";
 import { STEPFUN } from "./stepfun.js";
 import { WENXIN } from "./wenxin.js";
 import { WENXIN } from "./wenxin.js";
+// B2
+import { SPARK } from "./spark.js";
+import { SENSENOVA } from "./sensenova.js";
+import { TENCENTCLOUD } from "./tencentcloud.js";
+import { XIAOMI_MIMO } from "./xiaomimimo.js";
+import { LONGCAT } from "./longcat.js";
+import { INTERNLM } from "./internlm.js";
 
 
 export type { InkosProvider, InkosModel, ApiProtocol } from "./types.js";
 export type { InkosProvider, InkosModel, ApiProtocol } from "./types.js";
 
 
@@ -26,6 +33,7 @@ export type { InkosProvider, InkosModel, ApiProtocol } from "./types.js";
 const ALL_PROVIDERS: readonly InkosProvider[] = [
 const ALL_PROVIDERS: readonly InkosProvider[] = [
   ANTHROPIC, OPENAI, GOOGLE, DEEPSEEK, QWEN, MINIMAX,
   ANTHROPIC, OPENAI, GOOGLE, DEEPSEEK, QWEN, MINIMAX,
   MOONSHOT, ZHIPU, SILICONCLOUD, PPIO, BAILIAN, VOLCENGINE, HUNYUAN, BAICHUAN, STEPFUN, WENXIN,
   MOONSHOT, ZHIPU, SILICONCLOUD, PPIO, BAILIAN, VOLCENGINE, HUNYUAN, BAICHUAN, STEPFUN, WENXIN,
+  SPARK, SENSENOVA, TENCENTCLOUD, XIAOMI_MIMO, LONGCAT, INTERNLM,
 ];
 ];
 
 
 const PROVIDERS_BY_ID: Map<string, InkosProvider> = new Map(
 const PROVIDERS_BY_ID: Map<string, InkosProvider> = new Map(

+ 20 - 0
packages/core/src/llm/providers/internlm.ts

@@ -0,0 +1,20 @@
+import type { InkosProvider } from "./types.js";
+
+export const INTERNLM: InkosProvider = {
+  id: "internlm",
+  label: "书生浦语 (InternLM)",
+  api: "openai-completions",
+  baseUrl: "https://chat.intern-ai.org.cn/api/v1",
+  checkModel: "internlm2.5-latest",
+  temperatureRange: [0, 2],
+  defaultTemperature: 0.8,
+  writingTemperature: 1,
+  models: [
+    { id: "intern-latest", displayName: "Intern", maxOutput: 4096, contextWindowTokens: 262144, abilities: { reasoning: true, vision: true, functionCall: true }, releasedAt: "2026-02-04" },
+    { id: "intern-s1-pro", displayName: "Intern-S1-Pro", maxOutput: 4096, contextWindowTokens: 262144, abilities: { reasoning: true, vision: true, functionCall: true }, enabled: true, releasedAt: "2026-02-04" },
+    { id: "intern-s1", displayName: "Intern-S1", maxOutput: 4096, contextWindowTokens: 32768, abilities: { reasoning: true, vision: true, functionCall: true }, enabled: true, releasedAt: "2025-07-26" },
+    { id: "intern-s1-mini", displayName: "Intern-S1-Mini", maxOutput: 4096, contextWindowTokens: 32768, abilities: { reasoning: true, vision: true, functionCall: true }, enabled: true, releasedAt: "2025-08-20" },
+    { id: "internvl3.5-latest", displayName: "InternVL3.5", maxOutput: 4096, contextWindowTokens: 32768, abilities: { vision: true }, releasedAt: "2025-08-28" },
+    { id: "internvl3.5-241b-a28b", displayName: "InternVL3.5-241B-A28B", maxOutput: 4096, contextWindowTokens: 32768, abilities: { vision: true }, enabled: true, releasedAt: "2025-08-28" },
+  ],
+};

+ 18 - 0
packages/core/src/llm/providers/longcat.ts

@@ -0,0 +1,18 @@
+import type { InkosProvider } from "./types.js";
+
+export const LONGCAT: InkosProvider = {
+  id: "longcat",
+  label: "美团 LongCat",
+  api: "openai-completions",
+  baseUrl: "https://api.longcat.chat/openai/v1",
+  checkModel: "LongCat-Flash-Chat",
+  temperatureRange: [0, 2],
+  defaultTemperature: 0.7,
+  writingTemperature: 1,
+  models: [
+    { id: "LongCat-Flash-Lite", displayName: "LongCat-Flash-Lite", maxOutput: 4096, contextWindowTokens: 327680, abilities: { functionCall: true }, enabled: true, releasedAt: "2026-02-05" },
+    { id: "LongCat-Flash-Thinking-2601", displayName: "LongCat-Flash-Thinking-2601", maxOutput: 4096, contextWindowTokens: 262144, abilities: { reasoning: true, functionCall: true }, enabled: true, releasedAt: "2026-01-14" },
+    { id: "LongCat-Flash-Thinking", displayName: "LongCat-Flash-Thinking", maxOutput: 4096, contextWindowTokens: 262144, abilities: { reasoning: true, functionCall: true }, releasedAt: "2025-09-22" },
+    { id: "LongCat-Flash-Chat", displayName: "LongCat-Flash-Chat", maxOutput: 4096, contextWindowTokens: 262144, abilities: { functionCall: true }, enabled: true, releasedAt: "2025-12-12" },
+  ],
+};

+ 37 - 0
packages/core/src/llm/providers/sensenova.ts

@@ -0,0 +1,37 @@
+import type { InkosProvider } from "./types.js";
+
+export const SENSENOVA: InkosProvider = {
+  id: "sensenova",
+  label: "商汤日日新",
+  api: "openai-completions",
+  baseUrl: "https://api.sensenova.cn/compatible-mode/v1",
+  checkModel: "SenseChat-Turbo",
+  temperatureRange: [0, 2],
+  defaultTemperature: 0.7,
+  writingTemperature: 1,
+  models: [
+    { id: "SenseNova-V6-5-Pro", displayName: "SenseNova V6.5 Pro", maxOutput: 4096, contextWindowTokens: 131072, abilities: { reasoning: true, vision: true }, enabled: true, releasedAt: "2025-07-23" },
+    { id: "SenseNova-V6-5-Turbo", displayName: "SenseNova V6.5 Turbo", maxOutput: 4096, contextWindowTokens: 131072, abilities: { reasoning: true, vision: true }, enabled: true, releasedAt: "2025-07-23" },
+    { id: "Qwen3-235B", displayName: "Qwen3 235B A22B", maxOutput: 4096, contextWindowTokens: 32768, abilities: { reasoning: true }, releasedAt: "2025-05-27" },
+    { id: "Qwen3-32B", displayName: "Qwen3 32B", maxOutput: 4096, contextWindowTokens: 32768, abilities: { reasoning: true }, releasedAt: "2025-05-27" },
+    { id: "SenseNova-V6-Reasoner", displayName: "SenseNova V6 Reasoner", maxOutput: 4096, contextWindowTokens: 32768, abilities: { reasoning: true, vision: true }, releasedAt: "2025-04-14" },
+    { id: "SenseNova-V6-Turbo", displayName: "SenseNova V6 Turbo", maxOutput: 4096, contextWindowTokens: 32768, abilities: { vision: true }, releasedAt: "2025-04-14" },
+    { id: "SenseNova-V6-Pro", displayName: "SenseNova V6 Pro", maxOutput: 4096, contextWindowTokens: 32768, abilities: { vision: true }, releasedAt: "2025-04-14" },
+    { id: "SenseChat-5-beta", displayName: "SenseChat 5.5 Beta", maxOutput: 4096, contextWindowTokens: 32768 },
+    { id: "SenseChat-5-1202", displayName: "SenseChat 5.5 1202", maxOutput: 4096, contextWindowTokens: 32768, abilities: { functionCall: true }, releasedAt: "2024-12-30" },
+    { id: "SenseChat-Turbo-1202", displayName: "SenseChat Turbo 1202", maxOutput: 4096, contextWindowTokens: 32768, abilities: { functionCall: true }, releasedAt: "2024-12-30" },
+    { id: "SenseChat-5", displayName: "SenseChat 5.5", maxOutput: 131072, contextWindowTokens: 131072, abilities: { functionCall: true } },
+    { id: "SenseChat-Vision", displayName: "SenseChat 5.5 Vision", maxOutput: 16384, contextWindowTokens: 16384, abilities: { vision: true }, releasedAt: "2024-09-12" },
+    { id: "SenseChat-Turbo", displayName: "SenseChat 5.0 Turbo", maxOutput: 32768, contextWindowTokens: 32768, abilities: { functionCall: true } },
+    { id: "SenseChat-128K", displayName: "SenseChat 4.0 128K", maxOutput: 131072, contextWindowTokens: 131072 },
+    { id: "SenseChat-32K", displayName: "SenseChat 4.0 32K", maxOutput: 32768, contextWindowTokens: 32768 },
+    { id: "SenseChat", displayName: "SenseChat 4.0 4K", maxOutput: 4096, contextWindowTokens: 4096 },
+    { id: "SenseChat-5-Cantonese", displayName: "SenseChat 5.0 Cantonese", maxOutput: 32768, contextWindowTokens: 32768 },
+    { id: "SenseChat-Character", displayName: "SenseChat Character", maxOutput: 1024, contextWindowTokens: 8192 },
+    { id: "SenseChat-Character-Pro", displayName: "SenseChat Character Pro", maxOutput: 4096, contextWindowTokens: 32768 },
+    { id: "DeepSeek-V3", displayName: "DeepSeek V3", maxOutput: 4096, contextWindowTokens: 32768 },
+    { id: "DeepSeek-R1", displayName: "DeepSeek R1", maxOutput: 4096, contextWindowTokens: 32768, abilities: { reasoning: true } },
+    { id: "DeepSeek-R1-Distill-Qwen-14B", displayName: "DeepSeek R1 Distill Qwen 14B", maxOutput: 4096, contextWindowTokens: 32768, abilities: { reasoning: true } },
+    { id: "DeepSeek-R1-Distill-Qwen-32B", displayName: "DeepSeek R1 Distill Qwen 32B", maxOutput: 4096, contextWindowTokens: 8192, abilities: { reasoning: true } },
+  ],
+};

+ 22 - 0
packages/core/src/llm/providers/spark.ts

@@ -0,0 +1,22 @@
+import type { InkosProvider } from "./types.js";
+
+export const SPARK: InkosProvider = {
+  id: "spark",
+  label: "讯飞星火",
+  api: "openai-completions",
+  baseUrl: "https://spark-api-open.xf-yun.com/v1",
+  checkModel: "general",
+  temperatureRange: [0, 1],
+  defaultTemperature: 0.5,
+  writingTemperature: 0.95,
+  models: [
+    { id: "spark-x", displayName: "Spark X2", maxOutput: 131072, contextWindowTokens: 131072, abilities: { reasoning: true, functionCall: true, search: true }, enabled: true },
+    { id: "x1", displayName: "Spark X1.5", maxOutput: 65535, contextWindowTokens: 65535, abilities: { reasoning: true, functionCall: true, search: true } },
+    { id: "lite", displayName: "Spark Lite", maxOutput: 4096, contextWindowTokens: 12288, enabled: true },
+    { id: "generalv3", displayName: "Spark Pro", maxOutput: 8192, contextWindowTokens: 16384, abilities: { search: true } },
+    { id: "pro-128k", displayName: "Spark Pro 128K", maxOutput: 131072, contextWindowTokens: 131072 },
+    { id: "generalv3.5", displayName: "Spark Max", maxOutput: 8192, contextWindowTokens: 16384, abilities: { functionCall: true, search: true } },
+    { id: "max-32k", displayName: "Spark Max 32K", maxOutput: 32768, contextWindowTokens: 65536, abilities: { functionCall: true, search: true } },
+    { id: "4.0Ultra", displayName: "Spark 4.0 Ultra", maxOutput: 32768, contextWindowTokens: 65536, abilities: { reasoning: true, functionCall: true, search: true } },
+  ],
+};

+ 17 - 0
packages/core/src/llm/providers/tencentcloud.ts

@@ -0,0 +1,17 @@
+import type { InkosProvider } from "./types.js";
+
+export const TENCENTCLOUD: InkosProvider = {
+  id: "tencentcloud",
+  label: "腾讯云 (lkeap)",
+  api: "openai-completions",
+  baseUrl: "https://api.lkeap.cloud.tencent.com/v1",
+  checkModel: "deepseek-v3",
+  temperatureRange: [0, 2],
+  defaultTemperature: 0.7,
+  writingTemperature: 1,
+  models: [
+    { id: "deepseek-r1", displayName: "DeepSeek R1", maxOutput: 16000, contextWindowTokens: 65536, abilities: { reasoning: true }, enabled: true },
+    { id: "deepseek-v3-0324", displayName: "DeepSeek V3 0324", maxOutput: 16000, contextWindowTokens: 65536, enabled: true },
+    { id: "deepseek-v3", displayName: "DeepSeek V3", maxOutput: 16000, contextWindowTokens: 65536 },
+  ],
+};

+ 16 - 0
packages/core/src/llm/providers/xiaomimimo.ts

@@ -0,0 +1,16 @@
+import type { InkosProvider } from "./types.js";
+
+export const XIAOMI_MIMO: InkosProvider = {
+  id: "xiaomimimo",
+  label: "小米 MiMo",
+  api: "openai-completions",
+  baseUrl: "https://api-ai.xiaomi.com/v1",
+  temperatureRange: [0, 2],
+  defaultTemperature: 0.7,
+  writingTemperature: 1,
+  models: [
+    { id: "mimo-v2-pro", displayName: "MiMo-V2 Pro", maxOutput: 131072, contextWindowTokens: 1000000, abilities: { reasoning: true, functionCall: true, search: true, structuredOutput: true }, enabled: true, releasedAt: "2026-03-18" },
+    { id: "mimo-v2-omni", displayName: "MiMo-V2 Omni", maxOutput: 131072, contextWindowTokens: 262144, abilities: { reasoning: true, vision: true, functionCall: true, search: true, structuredOutput: true }, enabled: true, releasedAt: "2026-03-18" },
+    { id: "mimo-v2-flash", displayName: "MiMo-V2 Flash", maxOutput: 65536, contextWindowTokens: 262144, abilities: { reasoning: true, functionCall: true, search: true, structuredOutput: true }, enabled: true, releasedAt: "2026-03-03" },
+  ],
+};