@raolin2025/claude-code-node 2.4.1 → 2.4.2
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.
- package/package.json +1 -1
- package/src/core/cli.js +12 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raolin2025/claude-code-node",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"description": "Node.js AI Code Agent CLI - Zero dependencies, pure JavaScript, security hardened, multi-channel notifications, Telegram & QQ Bot remote programming",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
package/src/core/cli.js
CHANGED
|
@@ -407,11 +407,21 @@ export async function main() {
|
|
|
407
407
|
const config = new Config()
|
|
408
408
|
await config.load(process.cwd())
|
|
409
409
|
|
|
410
|
-
const
|
|
410
|
+
const apiBase = cliArgs.apiBase || config.get('apiBase') || process.env.LLM_API_BASE || ''
|
|
411
|
+
// 智能默认模型:根据 apiBase 自动选择
|
|
412
|
+
function getDefaultModel(base) {
|
|
413
|
+
if (!base) return 'deepseek-chat' // 无 apiBase → DeepSeek 默认
|
|
414
|
+
if (base.includes('11434')) return 'llama3' // Ollama 本地
|
|
415
|
+
if (base.includes('dashscope')) return 'qwen-plus' // 通义千问
|
|
416
|
+
if (base.includes('bigmodel.cn')) return 'glm-4-flash' // 智谱 GLM
|
|
417
|
+
if (base.includes('moonshot')) return 'kimi-k2-0711' // Moonshot
|
|
418
|
+
if (base.includes('openai.com')) return 'gpt-4o' // OpenAI
|
|
419
|
+
return 'deepseek-chat' // 其他情况默认 DeepSeek
|
|
420
|
+
}
|
|
421
|
+
const model = cliArgs.model || config.get('model') || getDefaultModel(apiBase)
|
|
411
422
|
const systemPrompt = cliArgs.systemPrompt || ''
|
|
412
423
|
const permissionMode = cliArgs.permissionMode || config.get('permissionMode')
|
|
413
424
|
const maxTurns = cliArgs.maxTurns || config.get('maxTurns')
|
|
414
|
-
const apiBase = cliArgs.apiBase || config.get('apiBase') || process.env.LLM_API_BASE || ''
|
|
415
425
|
const apiKey = cliArgs.apiKey || config.get('apiKey') || ''
|
|
416
426
|
const verbose = cliArgs.verbose || config.get('verbose')
|
|
417
427
|
|