File size: 1,969 Bytes
7e55e53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# Windows PowerShell 版本的源代码获取脚本

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
}

# 检查 app 目录是否已存在
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
}