engine7 7.1.44 → 7.1.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.mjs +32 -6
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -1857,6 +1857,8 @@ function getDefaultValues(stateDir) {
1857
1857
  wechatEnabled: false,
1858
1858
  wechatToken: "",
1859
1859
  wechatAccountId: "",
1860
+ customBaseUrl: "",
1861
+ customModelId: "",
1860
1862
  tavilyKey: "",
1861
1863
  apiPort: 16990
1862
1864
  };
@@ -1865,12 +1867,13 @@ async function interactiveConfig(rl, defaults) {
1865
1867
  const v = { ...defaults };
1866
1868
  console.log("\n=== \u7B2C\u4E00\u6B65\uFF1A\u5FC5\u586B\u914D\u7F6E ===\n");
1867
1869
  v.agentName = await ask(rl, "Agent \u540D\u79F0", defaults.agentName);
1868
- const providers = ["dashscope (\u901A\u4E49\u5343\u95EE)", "minimax (MiniMax)", "zhipu (\u667A\u8C31)", "deepseek (DeepSeek)"];
1870
+ const providers = ["dashscope (\u901A\u4E49\u5343\u95EE)", "minimax (MiniMax)", "zhipu (\u667A\u8C31)", "deepseek (DeepSeek)", "custom (\u81EA\u5B9A\u4E49/\u5176\u4ED6 Anthropic \u517C\u5BB9\u7AEF\u70B9)"];
1869
1871
  const providerMap = {
1870
1872
  "dashscope (\u901A\u4E49\u5343\u95EE)": "dashscope",
1871
1873
  "minimax (MiniMax)": "minimax",
1872
1874
  "zhipu (\u667A\u8C31)": "zhipu",
1873
- "deepseek (DeepSeek)": "deepseek"
1875
+ "deepseek (DeepSeek)": "deepseek",
1876
+ "custom (\u81EA\u5B9A\u4E49/\u5176\u4ED6 Anthropic \u517C\u5BB9\u7AEF\u70B9)": "custom"
1874
1877
  };
1875
1878
  const chosenProvider = await askChoice(rl, "\u4E3B\u6A21\u578B Provider:", providers, 0);
1876
1879
  v.primaryProvider = providerMap[chosenProvider] || "dashscope";
@@ -1880,21 +1883,34 @@ async function interactiveConfig(rl, defaults) {
1880
1883
  const chosenPlan = await askChoice(rl, "\u667A\u8C31\u8BA2\u9605\u7C7B\u578B:", planOptions, 0);
1881
1884
  v.zhipuPlan = chosenPlan.startsWith("coding") ? "coding" : "token";
1882
1885
  }
1886
+ v.customBaseUrl = "";
1887
+ v.customModelId = "";
1888
+ if (v.primaryProvider === "custom") {
1889
+ v.primaryProvider = await ask(rl, "Provider ID\uFF08\u5C0F\u5199\u5B57\u6BCD\uFF0C\u5982 kimi / moonshot / openrouter\uFF09", "custom");
1890
+ v.customBaseUrl = await ask(rl, "Anthropic \u517C\u5BB9 baseUrl\uFF08\u5982 https://api.moonshot.cn/anthropic\uFF09");
1891
+ const cm = await ask(rl, "\u6A21\u578B ID\uFF08\u5982 kimi-k2-turbo-preview\uFF09");
1892
+ v.customModelId = cm;
1893
+ }
1883
1894
  const keyMap = {
1884
1895
  dashscope: "DashScope API Key",
1885
1896
  minimax: "MiniMax API Key",
1886
1897
  zhipu: "\u667A\u8C31 API Key",
1887
1898
  deepseek: "DeepSeek API Key"
1888
1899
  };
1889
- v.primaryApiKey = await ask(rl, keyMap[v.primaryProvider] || "API Key");
1900
+ v.primaryApiKey = await ask(rl, keyMap[v.primaryProvider] || v.primaryProvider + " API Key");
1901
+ if (v.customModelId) {
1902
+ v.primaryModel = v.primaryProvider + "/" + v.customModelId;
1903
+ }
1890
1904
  const modelMap = {
1891
1905
  dashscope: ["dashscope/qwen3.7-max", "dashscope/qwen3.7-plus"],
1892
1906
  minimax: ["minimax/MiniMax-M3", "minimax/MiniMax-M2.7"],
1893
1907
  zhipu: ["zhipu/glm-5.3", "zhipu/glm-5v-turbo"],
1894
1908
  deepseek: ["deepseek/deepseek-v4-pro", "deepseek/deepseek-v4-flash"]
1895
1909
  };
1896
- const models = modelMap[v.primaryProvider] || ["dashscope/qwen3.7-max"];
1897
- v.primaryModel = await askChoice(rl, "\u4E3B\u6A21\u578B:", models, 0);
1910
+ if (!v.customModelId) {
1911
+ const models = modelMap[v.primaryProvider] || ["dashscope/qwen3.7-max"];
1912
+ v.primaryModel = await askChoice(rl, "\u4E3B\u6A21\u578B:", models, 0);
1913
+ }
1898
1914
  const visionCapableMap = {
1899
1915
  "dashscope/qwen3.7-max": true,
1900
1916
  "dashscope/qwen3.7-plus": true,
@@ -2123,7 +2139,7 @@ function generateConfig(v) {
2123
2139
  baseUrl: "https://open.bigmodel.cn/api/coding/paas/v4",
2124
2140
  api: "openai-completions",
2125
2141
  models: [
2126
- { id: "glm-5.3", name: "GLM-5.3 (\u6700\u65B0\u4E3B\u529B)", reasoning: true, input: ["text"], contextWindow: 204800, maxTokens: 131072 },
2142
+ { id: "glm-5.3", name: "GLM-5.3 (\u6700\u65B0\u4E3B\u529B)", reasoning: true, input: ["text"], contextWindow: 1e6, maxTokens: 128e3 },
2127
2143
  { id: "glm-5v-turbo", name: "GLM-5V-Turbo (\u89C6\u89C9)", reasoning: true, input: ["text", "image"], contextWindow: 2e5, maxTokens: 128e3 }
2128
2144
  ]
2129
2145
  },
@@ -2137,6 +2153,16 @@ function generateConfig(v) {
2137
2153
  ]
2138
2154
  }
2139
2155
  };
2156
+ if (!providerDefs[v.primaryProvider] && v.customModelId) {
2157
+ config.models.providers[v.primaryProvider] = {
2158
+ baseUrl: (v.customBaseUrl || "").trim(),
2159
+ api: "anthropic",
2160
+ apiKey: v.primaryApiKey.trim(),
2161
+ models: [
2162
+ { id: v.customModelId, name: v.customModelId, reasoning: false, input: ["text"], contextWindow: 2e5, maxTokens: 8192 }
2163
+ ]
2164
+ };
2165
+ }
2140
2166
  if (providerDefs[v.primaryProvider]) {
2141
2167
  const def = { ...providerDefs[v.primaryProvider] };
2142
2168
  if (v.primaryProvider === "zhipu" && v.zhipuPlan === "token") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "engine7",
3
- "version": "7.1.44",
3
+ "version": "7.1.45",
4
4
  "type": "module",
5
5
  "description": "Engine 7 — 给助手一个家 / A home for your AI assistant",
6
6
  "main": "dist/main.mjs",