AIClient-2-API/install-and-run.ps1
hex2077 fa19bae517 refactor(potluck): 简化 API 大锅饭系统并增强安全性和 UI
- 移除凭证管理和资源包系统,简化为基于每日限额的 Key 管理
- 新增登录安全防护(频率限制、账户锁定、IP 追踪)
- 重构日志系统使用 AsyncLocalStorage 替代全局状态
- 全面升级 UI 界面(主题切换、使用分布统计、响应式设计)
- 优化安装脚本(PowerShell 支持、手动安装指引)

BREAKING CHANGE: API Potluck 插件不再支持凭证资源包功能,所有 Key 仅基于每日限额进行配额管理。user-data-manager 模块已禁用,相关 API 端点已移除。
2026-03-05 17:21:47 +08:00

71 lines
2.3 KiB
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# install-and-run.ps1
$OutputEncoding = [System.Text.Encoding]::UTF8
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " AI Client 2 API 快速安装启动脚本" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# 处理参数
$forcePull = $args -contains "--pull"
# 检查 Git 并拉取
if ($forcePull) {
Write-Host "[更新] 正在从远程仓库拉取最新代码..."
if (Get-Command git -ErrorAction SilentlyContinue) {
git pull
if ($LASTEXITCODE -ne 0) {
Write-Warning "Git pull 失败,请检查网络或手动处理冲突。"
} else {
Write-Host "[成功] 代码已更新。" -ForegroundColor Green
}
} else {
Write-Warning "未检测到 Git跳过代码拉取。"
}
}
# 检查 Node.js
Write-Host "[检查] 正在检查Node.js是否已安装..."
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
Write-Host "[错误] 未检测到Node.js请先安装Node.js (https://nodejs.org/)" -ForegroundColor Red
Pause
exit 1
}
$nodeVersion = node --version
Write-Host "[成功] Node.js已安装版本: $nodeVersion" -ForegroundColor Green
# 检查 package.json
if (-not (Test-Path "package.json")) {
Write-Host "[错误] 未找到package.json文件请确保在项目根目录下运行此脚本" -ForegroundColor Red
Pause
exit 1
}
# 确定包管理器
$pkgManager = if (Get-Command pnpm -ErrorAction SilentlyContinue) { "pnpm" } else { "npm" }
Write-Host "[安装] 正在使用 $pkgManager 安装/更新依赖..." -ForegroundColor Cyan
& $pkgManager install
if ($LASTEXITCODE -ne 0) {
Write-Host "[错误] 依赖安装失败,请检查网络连接。" -ForegroundColor Red
Pause
exit 1
}
# 检查主文件
if (-not (Test-Path "src\core\master.js")) {
Write-Host "[错误] 未找到 src\core\master.js 文件" -ForegroundColor Red
Pause
exit 1
}
Write-Host ""
Write-Host "========================================" -ForegroundColor Green
Write-Host " 启动 AIClient2API 服务器..." -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green
Write-Host "服务器将在 http://localhost:3000 启动"
Write-Host "按 Ctrl+C 停止服务器"
Write-Host ""
node src\core\master.js