docs: 更新 API 分组说明、客户端推荐及重启终端提醒
All checks were successful
Deploy to Cloudflare Pages / deploy (push) Successful in 1m4s
All checks were successful
Deploy to Cloudflare Pages / deploy (push) Successful in 1m4s
- 文档新增 ccmax/cc2api 分组说明:cc2api 推荐优先使用(Claude 系列,无客户端限制),ccmax 仅限 Claude Code - 推荐 OpenCode、OpenClaw 作为 cc2api 客户端,GPT 模型推荐 v1/responses 端点 - Cherry Studio 兼容性说明更新:支持所有模型,仅 ccmax 分组 Claude 模型不可用 - 所有脚本重启终端提示改为中文 - 三个工具文档页及快速开始页添加重启终端 warning 框
This commit is contained in:
64
setup.sh
64
setup.sh
@@ -364,17 +364,41 @@ install_tool() {
|
||||
local tool_pkg=$(get_tool_pkg "$tool_num")
|
||||
|
||||
info "安装 $tool_name..."
|
||||
local install_cmd="npm install -g $tool_pkg"
|
||||
|
||||
echo -e " 执行: ${CYAN}$install_cmd${NC}"
|
||||
|
||||
if eval "$install_cmd"; then
|
||||
hash -r 2>/dev/null || true
|
||||
success "$tool_name 安装成功!"
|
||||
return 0
|
||||
if [ "$tool_num" = "1" ]; then
|
||||
# Claude Code: 使用官方原生安装脚本
|
||||
local install_cmd="curl -fsSL https://claude.ai/install.sh | bash"
|
||||
echo -e " 执行: ${CYAN}$install_cmd${NC}"
|
||||
if bash -c 'set -o pipefail; curl -fsSL https://claude.ai/install.sh | bash'; then
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
hash -r 2>/dev/null || true
|
||||
local tool_cmd=$(get_tool_cmd "$tool_num")
|
||||
if command -v "$tool_cmd" >/dev/null 2>&1; then
|
||||
success "$tool_name 安装成功!"
|
||||
return 0
|
||||
else
|
||||
warning "$tool_name 可能已安装,但需要重新打开终端才能生效"
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
error "$tool_name 安装失败 (请检查 https://claude.ai 是否可达)"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
error "$tool_name 安装失败"
|
||||
return 1
|
||||
# Gemini CLI / Codex: 使用 npm 安装 (需要 Node.js)
|
||||
if ! ensure_node_environment; then
|
||||
return 1
|
||||
fi
|
||||
local install_cmd="npm install -g $tool_pkg"
|
||||
echo -e " 执行: ${CYAN}$install_cmd${NC}"
|
||||
if eval "$install_cmd"; then
|
||||
hash -r 2>/dev/null || true
|
||||
success "$tool_name 安装成功!"
|
||||
return 0
|
||||
else
|
||||
error "$tool_name 安装失败"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -387,7 +411,22 @@ configure_tool() {
|
||||
|
||||
info "配置 $tool_name..."
|
||||
|
||||
if API_KEY="$api_key" bash -c "$(curl -fsSL "$setup_url")"; then
|
||||
# 先下载脚本到临时文件,避免 curl 失败时空脚本静默执行
|
||||
local tmp_script
|
||||
tmp_script=$(mktemp) || { error "无法创建临时文件"; return 1; }
|
||||
trap "rm -f '$tmp_script'" RETURN
|
||||
|
||||
if ! curl -fsSL "$setup_url" -o "$tmp_script"; then
|
||||
error "下载 $tool_name 配置脚本失败 (请检查网络连接)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! -s "$tmp_script" ]; then
|
||||
error "下载的配置脚本为空"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if API_KEY="$api_key" bash "$tmp_script"; then
|
||||
success "$tool_name 配置完成!"
|
||||
return 0
|
||||
else
|
||||
@@ -514,10 +553,7 @@ main() {
|
||||
info "API 密钥: ${api_key:0:8}..."
|
||||
echo ""
|
||||
|
||||
# 确保 Node.js 环境就绪
|
||||
if ! ensure_node_environment; then
|
||||
exit 1
|
||||
fi
|
||||
# Node.js 环境检查已移至 install_tool 内部 (仅 Gemini CLI / Codex 需要)
|
||||
|
||||
echo ""
|
||||
echo -e "${CYAN}========================================${NC}"
|
||||
|
||||
Reference in New Issue
Block a user