Go to file
公司git 5793a659a9 ```
feat(config): 添加尺寸模型常量配置

- 将尺寸模型数组定义为全局常量 SIZE_MODELS
- 在模型选择变更时使用常量进行判断
- 初始化页面时检查默认模型并相应显示/隐藏尺寸选择器
- 支持 nano-banana-2 和 gemini-3.1-flash-image-preview 模型的尺寸选项
```
2026-02-27 10:46:14 +08:00
.agent/workflows feat: Initialize UI/UX Pro Max agent with core data, stack definitions, and utility scripts. 2026-01-18 20:35:35 +08:00
.shared/ui-ux-pro-max feat: Initialize UI/UX Pro Max agent with core data, stack definitions, and utility scripts. 2026-01-18 20:35:35 +08:00
blueprints ``` 2026-02-27 10:44:01 +08:00
middlewares feat: Implement core application structure with new services, blueprints, templates, and database migrations. 2026-01-17 23:15:58 +08:00
migrations feat: Implement core application structure with new services, blueprints, templates, and database migrations. 2026-01-17 23:15:58 +08:00
scripts ``` 2026-01-23 22:09:45 +08:00
services ``` 2026-02-05 20:58:25 +08:00
static ``` 2026-02-27 10:46:14 +08:00
templates ``` 2026-02-08 20:39:35 +08:00
.gitignore feat: Implement a comprehensive user authentication system, add video generation capabilities, and set up database migrations and API blueprints. 2026-01-16 22:24:14 +08:00
app.py ``` 2026-02-08 20:39:35 +08:00
config.py ``` 2026-02-03 21:24:31 +08:00
db_manager.py feat: Implement core application structure with new services, blueprints, templates, and database migrations. 2026-01-17 23:15:58 +08:00
extensions.py feat: Implement a comprehensive user authentication system, add video generation capabilities, and set up database migrations and API blueprints. 2026-01-16 22:24:14 +08:00
models.py ``` 2026-01-23 21:46:08 +08:00
README.md ``` 2026-02-15 10:07:38 +08:00
requirements.txt ``` 2026-02-15 10:07:38 +08:00
utils.py ``` 2026-02-02 12:54:43 +08:00

AI 视界 (AI Vision) 项目指南

🚀 快速开始

1. 环境准备

确保已安装 Python 3.8+ 和 PostgreSQL / Redis。

创建虚拟环境

# 如果 python 命令不可用,请尝试使用 py
python -m venv .venv
# 或者
py -m venv .venv

激活虚拟环境 (推荐)

# Windows (PowerShell)
.\.venv\Scripts\Activate.ps1

# Linux / Mac
source .venv/bin/activate

安装依赖

pip install -r requirements.txt

2. 启动服务

开发环境

python app.py

服务默认运行在 http://127.0.0.1:5000

生产环境 (Gunicorn) 在 Linux 生产环境中,建议使用 Gunicorn 作为 WSGI 服务器以获得更好的性能和稳定性:

pip install gunicorn  # 如果尚未安装
gunicorn -w 4 -b 0.0.0.0:5000 app:app
  • -w 4: 使用 4 个工作进程(通常设为 CPU 核心数 * 2 + 1
  • -b 0.0.0.0:5000: 绑定所有 IP 且端口为 5000。
  • app:app: 加载 app.py 中的 app 实例。

🛠️ 常用维护命令

数据库管理 (推荐)

本项目内置了自动化数据库管理工具 db_manager.py,用于处理模型变更和迁移。

一键自动同步 (最常用) 当您修改了 models.py 中的表结构后,运行此命令自动完成迁移:

python db_manager.py sync

分步操作 如果您需要更精细的控制:

  • 初始化环境 (仅首次): python db_manager.py init
  • 生成迁移脚本: python db_manager.py make "修改说明"
  • 执行数据库变更: python db_manager.py up

系统配置更新

AI 模型、提示词模板等配置已移至数据库的 system_dicts 表中。

  • 请登录 Web 后台管理界面 (/rbac) 进行可视化的添加和修改。
  • 或直接操作数据库更新 system_dicts 表。

📂 目录结构说明

  • app.py: 应用入口
  • config.py: 配置文件
  • models.py: 数据库模型定义
  • blueprints/: 路由蓝图 (API 接口)
    • api.py: 核心业务接口 (Controller)
    • admin.py: 后台管理接口
    • auth.py: 认证接口
  • services/: 业务逻辑层 (Service)
    • task_service.py: 异步任务处理 (生图/视频)
    • generation_service.py: 生成请求验证与计费
    • system_service.py: 系统配置与通知
    • history_service.py: 历史记录查询
  • templates/: 前端 HTML 模板
  • static/: 静态资源 (JS/CSS)