| |
| |
|
|
| Write-Host "================================" -ForegroundColor Cyan |
| Write-Host "开始获取 grok2api 源代码..." -ForegroundColor Cyan |
| Write-Host "================================" -ForegroundColor Cyan |
| Write-Host "" |
|
|
| |
| if (-not (Test-Path "pyproject.toml")) { |
| Write-Host "错误: 请在 grok2api 配置目录中运行此脚本" -ForegroundColor Red |
| exit 1 |
| } |
|
|
| |
| if (Test-Path "app") { |
| Write-Host "警告: app 目录已存在" -ForegroundColor Yellow |
| $reply = Read-Host "是否覆盖? (y/N)" |
| if ($reply -ne "y" -and $reply -ne "Y") { |
| Write-Host "已取消" -ForegroundColor Yellow |
| exit 0 |
| } |
| Remove-Item -Recurse -Force "app" |
| } |
|
|
| Write-Host "正在克隆原项目..." -ForegroundColor Green |
| git clone --depth 1 https://github.com/chenyme/grok2api.git temp_grok2api |
|
|
| if ($LASTEXITCODE -ne 0) { |
| Write-Host "错误: 克隆失败,请检查网络连接" -ForegroundColor Red |
| exit 1 |
| } |
|
|
| Write-Host "正在复制源代码..." -ForegroundColor Green |
| Copy-Item -Recurse "temp_grok2api\app" ".\" |
|
|
| Write-Host "正在清理临时文件..." -ForegroundColor Green |
| Remove-Item -Recurse -Force "temp_grok2api" |
|
|
| if (Test-Path "app") { |
| Write-Host "" |
| Write-Host "================================" -ForegroundColor Green |
| Write-Host "✅ 源代码获取成功!" -ForegroundColor Green |
| Write-Host "================================" -ForegroundColor Green |
| Write-Host "" |
| Write-Host "接下来的步骤:" |
| Write-Host "1. 创建 Hugging Face Space (Docker SDK)" |
| Write-Host "2. 推送代码到 HF Space" |
| Write-Host "3. 配置环境变量" |
| Write-Host "4. 启用 Persistent Storage" |
| Write-Host "5. 设置保活项目" |
| Write-Host "" |
| Write-Host "详细说明请查看 DEPLOY_GUIDE.md" |
| } else { |
| Write-Host "错误: 源代码复制失败" -ForegroundColor Red |
| exit 1 |
| } |
|
|