mirror of
https://github.com/hanzoai/dev.git
synced 2026-10-25 03:32:32 +00:00
feat(core/agents): mirror Qwen/DashScope env vars and respect QWEN_MODEL; add qwen examples to config.toml.example\n\n- Do not pin a default Qwen model; let CLI track latest\n- Mirror QWEN_API_KEY↔DASHSCOPE_API_KEY and *_BASE_URL in write mode\n- Support optional QWEN_MODEL env to pass -m when set\n- Add qwen/qwen-safe examples to config.toml.example
This commit is contained in:
@@ -613,8 +613,22 @@ async fn execute_model_with_permissions(
|
||||
}
|
||||
}
|
||||
"qwen" => {
|
||||
// Qwen coder: follow Gemini CLI UX, but do not pin a model.
|
||||
if read_only {
|
||||
// Qwen coder: follow Gemini CLI UX by default, and do not pin a model
|
||||
// unless the user explicitly sets QWEN_MODEL in the environment.
|
||||
// We intentionally omit default "-m" to track the CLI's latest default model.
|
||||
if let Ok(model_override) = std::env::var("QWEN_MODEL") {
|
||||
if !model_override.trim().is_empty() {
|
||||
if read_only {
|
||||
cmd.args(&["-m", &model_override, "-p", prompt]);
|
||||
} else {
|
||||
cmd.args(&["-m", &model_override, "-y", "-p", prompt]);
|
||||
}
|
||||
} else if read_only {
|
||||
cmd.args(&["-p", prompt]);
|
||||
} else {
|
||||
cmd.args(&["-y", "-p", prompt]);
|
||||
}
|
||||
} else if read_only {
|
||||
cmd.args(&["-p", prompt]);
|
||||
} else {
|
||||
cmd.args(&["-y", "-p", prompt]);
|
||||
@@ -663,6 +677,20 @@ async fn execute_model_with_permissions(
|
||||
if let Some(anthropic_base) = env.get("ANTHROPIC_BASE_URL").cloned() {
|
||||
env.entry("CLAUDE_BASE_URL".to_string()).or_insert(anthropic_base);
|
||||
}
|
||||
// Qwen/DashScope convenience: mirror API keys and base URLs both ways so
|
||||
// either variable name works across tools.
|
||||
if let Some(qwen_key) = env.get("QWEN_API_KEY").cloned() {
|
||||
env.entry("DASHSCOPE_API_KEY".to_string()).or_insert(qwen_key);
|
||||
}
|
||||
if let Some(dashscope_key) = env.get("DASHSCOPE_API_KEY").cloned() {
|
||||
env.entry("QWEN_API_KEY".to_string()).or_insert(dashscope_key);
|
||||
}
|
||||
if let Some(qwen_base) = env.get("QWEN_BASE_URL").cloned() {
|
||||
env.entry("DASHSCOPE_BASE_URL".to_string()).or_insert(qwen_base);
|
||||
}
|
||||
if let Some(ds_base) = env.get("DASHSCOPE_BASE_URL").cloned() {
|
||||
env.entry("QWEN_BASE_URL".to_string()).or_insert(ds_base);
|
||||
}
|
||||
// Reduce startup overhead for Claude CLI: disable auto-updater/telemetry.
|
||||
env.entry("DISABLE_AUTOUPDATER".to_string()).or_insert("1".to_string());
|
||||
env.entry("CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC".to_string()).or_insert("1".to_string());
|
||||
@@ -725,7 +753,13 @@ async fn execute_model_with_permissions(
|
||||
args.extend(["-p".to_string(), prompt.to_string()]);
|
||||
}
|
||||
"qwen" => {
|
||||
// Do not specify a model to allow latest default.
|
||||
// Respect QWEN_MODEL override if set in the effective env; otherwise
|
||||
// omit -m to allow the CLI to pick its latest default.
|
||||
if let Some(m) = env.get("QWEN_MODEL").cloned() {
|
||||
if !m.trim().is_empty() {
|
||||
args.extend(["-m".to_string(), m]);
|
||||
}
|
||||
}
|
||||
if !read_only { args.push("-y".to_string()); }
|
||||
args.extend(["-p".to_string(), prompt.to_string()]);
|
||||
}
|
||||
|
||||
+24
-1
@@ -35,6 +35,29 @@ read-only = true
|
||||
description = "Google Gemini AI assistant in read-only mode"
|
||||
args = []
|
||||
|
||||
[[agents]]
|
||||
name = "qwen"
|
||||
command = "qwen"
|
||||
enabled = true
|
||||
read-only = false
|
||||
description = "Qwen Coder assistant (tracks latest default model)"
|
||||
# No default -m: let the CLI choose its current default model
|
||||
# To pin a model explicitly, export QWEN_MODEL or add here, e.g.:
|
||||
# args = ["-m", "qwen3-coder", "-y"]
|
||||
args = ["-y"]
|
||||
# Optional environment variables (either name works; mirrored automatically):
|
||||
# env = { QWEN_API_KEY = "your-key", DASHSCOPE_API_KEY = "your-key" }
|
||||
|
||||
[[agents]]
|
||||
name = "qwen-safe"
|
||||
command = "qwen"
|
||||
enabled = true
|
||||
read-only = true
|
||||
description = "Qwen Coder assistant in read-only mode"
|
||||
# No -y in read-only; omit -m to track latest default. To pin:
|
||||
# args = ["-m", "qwen3-coder"]
|
||||
args = []
|
||||
|
||||
[[agents]]
|
||||
name = "codex"
|
||||
command = "codex"
|
||||
@@ -95,4 +118,4 @@ args = ["-y", "@example/mcp-server"]
|
||||
env = { API_KEY = "your-api-key" }
|
||||
|
||||
# File Opener Configuration
|
||||
file-opener = "vscode" # Options: vscode, vscode-insiders, windsurf, cursor, none
|
||||
file-opener = "vscode" # Options: vscode, vscode-insiders, windsurf, cursor, none
|
||||
|
||||
Reference in New Issue
Block a user