Wizard: adapter-backed combos only, protocol-filtered models, test-gated activation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp
This commit is contained in:
+15
-5
@@ -13,18 +13,24 @@ fi
|
||||
|
||||
harness=$(cn_ai_harness_ids | gum choose --header "选择 Harness")
|
||||
|
||||
mapfile -t providers < <(jq -r --arg h "$harness" '.combos[$h] | keys[]' "$CN_AI_COMPAT")
|
||||
# Only combos whose adapter actually renders at launch
|
||||
mapfile -t providers < <(jq -r --arg h "$harness" \
|
||||
'.combos[$h] | to_entries[] | select(.value.adapter) | .key' "$CN_AI_COMPAT")
|
||||
if (( ${#providers[@]} == 0 )); then
|
||||
echo "兼容矩阵中没有 $harness 的 Provider 组合" >&2
|
||||
echo "兼容矩阵中没有 $harness 的可用 Provider 组合" >&2
|
||||
exit 1
|
||||
fi
|
||||
provider=$(printf '%s\n' "${providers[@]}" | gum choose --header "选择 Provider(兼容级别见 docs)")
|
||||
|
||||
harness_proto=$(cn_ai_harness_field "$harness" protocol)
|
||||
allowlist=$(cn_ai_combo_models "$harness" "$provider")
|
||||
if [[ -n $allowlist ]]; then
|
||||
model=$(gum choose --header "选择模型" <<<"$allowlist")
|
||||
else
|
||||
model=$(cn_ai_models "$provider" | gum choose --header "选择模型")
|
||||
# Hide models bound to a different wire protocol than the harness speaks
|
||||
model=$(jq -r --arg p "$provider" --arg hp "$harness_proto" \
|
||||
'.providers[$p].models[] | select((.protocol // $hp) == $hp) | .id' \
|
||||
"$CN_AI_PROVIDERS" | gum choose --header "选择模型")
|
||||
fi
|
||||
|
||||
default_name="$harness-$provider"
|
||||
@@ -45,10 +51,14 @@ if ! omarchy-cn-ai-secret get "$provider" > /dev/null 2>&1; then
|
||||
fi
|
||||
|
||||
omarchy-cn-ai-profile-create "$name" "$harness" "$provider" "$model"
|
||||
omarchy-cn-ai-profile-use "$name"
|
||||
|
||||
# Activate only after the test passes (or the user skips it)
|
||||
if gum confirm "运行连接测试?"; then
|
||||
omarchy-cn-ai-test "$name"
|
||||
if ! omarchy-cn-ai-test "$name"; then
|
||||
echo "测试未通过,Profile $name 已创建但未设为默认;修复后运行: omarchycn ai profile use $name" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
omarchy-cn-ai-profile-use "$name"
|
||||
echo "完成。启动: omarchycn ai launch"
|
||||
|
||||
@@ -4,15 +4,18 @@
|
||||
"claude-code": {
|
||||
"deepseek": {
|
||||
"level": "official-doc",
|
||||
"doc": "https://api-docs.deepseek.com/quick_start/agent_integrations/claude_code/"
|
||||
"doc": "https://api-docs.deepseek.com/quick_start/agent_integrations/claude_code/",
|
||||
"adapter": true
|
||||
},
|
||||
"kimi": {
|
||||
"level": "official-doc",
|
||||
"doc": "https://www.kimi.com/code/docs/en/third-party-tools/claude-code"
|
||||
"doc": "https://www.kimi.com/code/docs/en/third-party-tools/claude-code",
|
||||
"adapter": true
|
||||
},
|
||||
"zai": {
|
||||
"level": "official-doc",
|
||||
"doc": "https://docs.z.ai/devpack/tool/claude"
|
||||
"doc": "https://docs.z.ai/devpack/tool/claude",
|
||||
"adapter": true
|
||||
}
|
||||
},
|
||||
"codex": {
|
||||
@@ -24,29 +27,34 @@
|
||||
"deepseek-v4-pro",
|
||||
"deepseek-v4-flash-vision-exp"
|
||||
],
|
||||
"catalog": "codex-deepseek-models.json"
|
||||
"catalog": "codex-deepseek-models.json",
|
||||
"adapter": true
|
||||
}
|
||||
},
|
||||
"opencode": {
|
||||
"deepseek": {
|
||||
"level": "official-doc",
|
||||
"doc": "https://api-docs.deepseek.com/quick_start/agent_integrations/opencode/"
|
||||
"doc": "https://api-docs.deepseek.com/quick_start/agent_integrations/opencode/",
|
||||
"adapter": true
|
||||
},
|
||||
"zai": {
|
||||
"level": "official-doc",
|
||||
"doc": "https://docs.z.ai/scenario-example/develop-tools/opencode"
|
||||
"doc": "https://docs.z.ai/scenario-example/develop-tools/opencode",
|
||||
"adapter": false
|
||||
}
|
||||
},
|
||||
"kimi-code": {
|
||||
"kimi": {
|
||||
"level": "official-doc",
|
||||
"doc": "https://www.kimi.com/code/docs/en/"
|
||||
"doc": "https://www.kimi.com/code/docs/en/",
|
||||
"adapter": true
|
||||
}
|
||||
},
|
||||
"deep-code": {
|
||||
"deepseek": {
|
||||
"level": "official-doc",
|
||||
"doc": "https://api-docs.deepseek.com/quick_start/agent_integrations/deepcode/"
|
||||
"doc": "https://api-docs.deepseek.com/quick_start/agent_integrations/deepcode/",
|
||||
"adapter": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user