mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-05-07 04:22:42 +08:00
feat: AI助手支持 Anthropic/Gemini 原生API + 修复Windows终端闪烁
- AI助手新增 API 类型选择器(OpenAI兼容 / Anthropic原生 / Google Gemini) - 实现 Anthropic Messages API 流式调用 + 工具调用(tool_use/tool_result) - 实现 Google Gemini streamGenerateContent + 工具调用(functionCall) - 设置弹窗动态切换 placeholder 和提示文本 - 测试按钮和模型拉取适配三种 API 类型 - 修复 Windows 上 Gateway 状态轮询导致终端反复闪烁(execSync/spawn 加 windowsHide) - 默认密码统一为 123456 + 改密码后自动移除顶部横幅 - 后端 API 增加暴力破解保护、配置缓存、请求体大小限制
This commit is contained in:
@@ -140,6 +140,10 @@ install_clawpanel() {
|
||||
cd "$INSTALL_DIR"
|
||||
npm install
|
||||
fi
|
||||
# 生产构建(生成优化后的静态文件)
|
||||
echo "📦 构建生产版本..."
|
||||
cd "$INSTALL_DIR"
|
||||
npx vite build
|
||||
echo "✅ ClawPanel 安装完成: $INSTALL_DIR"
|
||||
}
|
||||
|
||||
@@ -164,7 +168,7 @@ After=network.target
|
||||
Type=simple
|
||||
User=$(whoami)
|
||||
WorkingDirectory=$INSTALL_DIR
|
||||
ExecStart=$(which npx) vite --port $PANEL_PORT --host 0.0.0.0
|
||||
ExecStart=$(which npx) vite preview --port $PANEL_PORT --host 0.0.0.0
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
Environment=NODE_ENV=production
|
||||
@@ -185,7 +189,7 @@ After=network.target
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=$INSTALL_DIR
|
||||
ExecStart=$(which npx) vite --port $PANEL_PORT --host 0.0.0.0
|
||||
ExecStart=$(which npx) vite preview --port $PANEL_PORT --host 0.0.0.0
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
Environment=NODE_ENV=production
|
||||
@@ -210,6 +214,32 @@ get_local_ip() {
|
||||
echo "localhost"
|
||||
}
|
||||
|
||||
# 生成默认访问密码
|
||||
setup_default_password() {
|
||||
local config_dir="$HOME/.openclaw"
|
||||
local config_file="$config_dir/clawpanel.json"
|
||||
mkdir -p "$config_dir"
|
||||
|
||||
# 已存在配置且有密码则跳过
|
||||
if [ -f "$config_file" ]; then
|
||||
local existing_pw=$(grep -o '"accessPassword"[[:space:]]*:[[:space:]]*"[^"]*"' "$config_file" | head -1)
|
||||
if [ -n "$existing_pw" ]; then
|
||||
echo "ℹ️ 已有访问密码,跳过生成"
|
||||
DEFAULT_PASSWORD=""
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
DEFAULT_PASSWORD="123456"
|
||||
cat > "$config_file" <<EOF
|
||||
{
|
||||
"accessPassword": "123456",
|
||||
"mustChangePassword": true
|
||||
}
|
||||
EOF
|
||||
echo "✅ 已设置默认访问密码: 123456"
|
||||
}
|
||||
|
||||
# 主流程
|
||||
main() {
|
||||
detect_os
|
||||
@@ -218,6 +248,7 @@ main() {
|
||||
install_node
|
||||
install_openclaw
|
||||
install_clawpanel
|
||||
setup_default_password
|
||||
setup_systemd
|
||||
|
||||
local ip=$(get_local_ip)
|
||||
@@ -236,6 +267,11 @@ main() {
|
||||
echo " 🌐 访问地址: http://${ip}:${PANEL_PORT}"
|
||||
echo " 📁 安装目录: $INSTALL_DIR"
|
||||
echo " 📋 配置目录: $HOME/.openclaw/"
|
||||
if [ -n "$DEFAULT_PASSWORD" ]; then
|
||||
echo ""
|
||||
echo " 🔑 默认访问密码: $DEFAULT_PASSWORD"
|
||||
echo " ⚠️ 首次登录后会要求修改密码,请妥善保管新密码!"
|
||||
fi
|
||||
echo ""
|
||||
echo " 常用命令:"
|
||||
echo " $ctl_cmd status clawpanel # 查看状态"
|
||||
|
||||
Reference in New Issue
Block a user