Skip to content

Commit f71f0cb

Browse files
committed
refactor: restructure project into src and data directories
1 parent 55fb7f4 commit f71f0cb

64 files changed

Lines changed: 359 additions & 219 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v4
17+
with:
18+
version: "latest"
19+
20+
- name: Set up Python
21+
run: uv python install 3.12
22+
23+
- name: Install dependencies
24+
run: uv sync --frozen
25+
26+
- name: Run ruff check
27+
run: uv run ruff check src/
28+
continue-on-error: true
29+
30+
- name: Run ruff format check
31+
run: uv run ruff format --check src/
32+
continue-on-error: true
33+
34+
type-check:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- name: Install uv
40+
uses: astral-sh/setup-uv@v4
41+
with:
42+
version: "latest"
43+
44+
- name: Set up Python
45+
run: uv python install 3.12
46+
47+
- name: Install dependencies
48+
run: uv sync --frozen
49+
50+
- name: Run pyright
51+
run: uv run pyright src/
52+
continue-on-error: true
53+
54+
test:
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v4
58+
59+
- name: Install uv
60+
uses: astral-sh/setup-uv@v4
61+
with:
62+
version: "latest"
63+
64+
- name: Set up Python
65+
run: uv python install 3.12
66+
67+
- name: Install dependencies
68+
run: uv sync --frozen
69+
70+
- name: Run tests
71+
run: uv run pytest tests/ -v --tb=short
72+
continue-on-error: true
73+
env:
74+
PYTHONPATH: src

.github/workflows/docker.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Docker Build
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
build-and-push:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Log in to Container Registry
24+
uses: docker/login-action@v3
25+
with:
26+
registry: ${{ env.REGISTRY }}
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Extract metadata
31+
id: meta
32+
uses: docker/metadata-action@v5
33+
with:
34+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
35+
tags: |
36+
type=semver,pattern={{version}}
37+
type=semver,pattern={{major}}.{{minor}}
38+
type=raw,value=latest,enable={{is_default_branch}}
39+
40+
- name: Build and push
41+
uses: docker/build-push-action@v5
42+
with:
43+
context: .
44+
file: docker/Dockerfile
45+
push: true
46+
tags: ${{ steps.meta.outputs.tags }}
47+
labels: ${{ steps.meta.outputs.labels }}

.gitignore

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Logs
22
logs
33
*.log
4-
certs/*
4+
certs/
5+
data/certs/
6+
src/certs/
57
npm-debug.log*
68
yarn-debug.log*
79
yarn-error.log*
@@ -216,14 +218,14 @@ env.bak/
216218
venv.bak/
217219

218220
# Error snapshots directory (Python specific)
219-
errors_py/
221+
data/errors_py/
220222
logs/
221223

222224
# Authentication Profiles (Sensitive)
223-
auth_profiles/active/*
224-
!auth_profiles/active/.gitkeep
225-
auth_profiles/saved/*
226-
!auth_profiles/saved/.gitkeep
225+
data/auth_profiles/active/*
226+
!data/auth_profiles/active/.gitkeep
227+
data/auth_profiles/saved/*
228+
!data/auth_profiles/saved/.gitkeep
227229

228230
# Camoufox/Playwright Profile Data (Assume these are generated/temporary)
229231
camoufox_profile/
@@ -234,10 +236,10 @@ deprecated_javascript_version/node_modules/
234236

235237
.roomodes
236238
memory-bank/
237-
gui_config.json
239+
data/gui_config.json
238240

239241
# key
240-
key.txt
242+
data/key.txt
241243

242244
# 脚本注入相关文件
243245
# 用户自定义的模型配置文件(保留示例文件)

Dockerfile

Lines changed: 0 additions & 66 deletions
This file was deleted.

README.md

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ uv run playwright install firefox
100100

101101
1. **启动图形界面**:
102102
```bash
103-
uv run python app_launcher.py
103+
uv run python src/app_launcher.py
104104
```
105105

106106
2. **配置代理**(建议):
@@ -127,7 +127,7 @@ uv run playwright install firefox
127127

128128
1. 启动图形界面:
129129
```bash
130-
uv run python app_launcher.py
130+
uv run python src/app_launcher.py
131131
```
132132

133133
2. 点击「启动无头模式」或 「虚拟显示模式」
@@ -181,7 +181,7 @@ curl -X POST http://localhost:2048/v1/chat/completions \
181181

182182
```bash
183183
# 启动 Ollama 兼容服务
184-
uv run python app_launcher.py
184+
uv run python src/app_launcher.py
185185
# 在 GUI 的配置页面中点击"启动本地LLM模拟服务"
186186

187187
# 使用 Ollama 格式 API
@@ -194,16 +194,30 @@ curl -X POST http://localhost:11434/api/chat \
194194

195195
```
196196
AIStudio2API/
197-
├── app_launcher.py # 图形界面启动器
198-
├── launch_camoufox.py # 命令行启动器
199-
├── server.py # 主服务器
200-
├── llm.py # Ollama 兼容层
201-
├── api/ # API 处理模块
202-
├── browser/ # 浏览器自动化模块
203-
├── config/ # 配置管理
204-
├── models/ # 数据模型
205-
├── proxy/ # 流式代理
206-
└── docs/ # 详细文档
197+
├── src/ # 源码目录
198+
│ ├── app_launcher.py # 图形界面启动器
199+
│ ├── launch_camoufox.py # 命令行启动器
200+
│ ├── server.py # 主服务器
201+
│ ├── manager.py # WebUI 管理器
202+
│ ├── api/ # API 处理模块
203+
│ ├── browser/ # 浏览器自动化模块
204+
│ ├── config/ # 配置管理
205+
│ ├── models/ # 数据模型
206+
│ ├── proxy/ # 流式代理
207+
│ └── static/ # 静态资源
208+
├── data/ # 运行时数据目录
209+
│ ├── auth_profiles/ # 认证文件
210+
│ ├── certs/ # 证书文件
211+
│ └── key.txt # API 密钥
212+
├── llm/ # Ollama 兼容层
213+
├── camoufox/ # Camoufox 脚本
214+
├── docker/ # Docker 配置
215+
├── docs/ # 详细文档
216+
├── logs/ # 日志文件
217+
├── start_webui.bat # WebUI 启动脚本
218+
├── start_cmd.bat # 命令行启动脚本
219+
├── setup.bat # Windows 安装脚本
220+
└── setup.sh # Linux/macOS 安装脚本
207221
```
208222

209223
## ⚙️ 配置说明
@@ -236,7 +250,7 @@ cp .env.example .env
236250

237251
### 认证文件管理
238252

239-
- 认证文件存储在 `auth_profiles/` 目录
253+
- 认证文件存储在 `data/auth_profiles/` 目录
240254
- 支持多个认证文件的保存和切换
241255
- 通过 GUI 的"管理认证文件"功能进行管理
242256

README_en.md

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ uv run playwright install firefox
101101

102102
1. **Start the GUI**:
103103
```bash
104-
uv run python app_launcher.py
104+
uv run python src/app_launcher.py
105105
```
106106

107107
2. **Configure Proxy** (recommended):
@@ -126,7 +126,7 @@ After authentication is saved, you can use headless mode:
126126

127127
1. Start the GUI:
128128
```bash
129-
uv run python app_launcher.py
129+
uv run python src/app_launcher.py
130130
```
131131

132132
2. Click "Start Headless Mode" or "Virtual Display Mode"
@@ -175,7 +175,7 @@ The project also provides Ollama format API compatibility:
175175

176176
```bash
177177
# Start Ollama compatible service
178-
uv run python app_launcher.py
178+
uv run python src/app_launcher.py
179179
# Click "Start Local LLM Simulation Service" in the GUI config page
180180

181181
# Use Ollama format API
@@ -188,16 +188,30 @@ curl -X POST http://localhost:11434/api/chat \
188188

189189
```
190190
AIStudio2API/
191-
├── app_launcher.py # GUI launcher
192-
├── launch_camoufox.py # Command-line launcher
193-
├── server.py # Main server
194-
├── llm.py # Ollama compatibility layer
195-
├── api/ # API processing modules
196-
├── browser/ # Browser automation modules
197-
├── config/ # Configuration management
198-
├── models/ # Data models
199-
├── proxy/ # Streaming proxy
200-
└── docs/ # Detailed documentation
191+
├── src/ # Source code directory
192+
│ ├── app_launcher.py # GUI launcher
193+
│ ├── launch_camoufox.py # Command-line launcher
194+
│ ├── server.py # Main server
195+
│ ├── manager.py # WebUI manager
196+
│ ├── api/ # API processing modules
197+
│ ├── browser/ # Browser automation modules
198+
│ ├── config/ # Configuration management
199+
│ ├── models/ # Data models
200+
│ ├── proxy/ # Streaming proxy
201+
│ └── static/ # Static resources
202+
├── data/ # Runtime data directory
203+
│ ├── auth_profiles/ # Authentication files
204+
│ ├── certs/ # Certificate files
205+
│ └── key.txt # API keys
206+
├── llm/ # Ollama compatibility layer
207+
├── camoufox/ # Camoufox scripts
208+
├── docker/ # Docker configuration
209+
├── docs/ # Detailed documentation
210+
├── logs/ # Log files
211+
├── start_webui.bat # WebUI startup script
212+
├── start_cmd.bat # Command-line startup script
213+
├── setup.bat # Windows installation script
214+
└── setup.sh # Linux/macOS installation script
201215
```
202216

203217
## ⚙️ Configuration
@@ -230,7 +244,7 @@ Supports accessing AI Studio through proxy:
230244

231245
### Authentication File Management
232246

233-
- Authentication files are stored in `auth_profiles/` directory
247+
- Authentication files are stored in `data/auth_profiles/` directory
234248
- Supports saving and switching multiple authentication files
235249
- Manage through the "Manage Auth Files" feature in the GUI
236250

0 commit comments

Comments
 (0)