Go to file
2026-01-17 23:15:58 +08:00
blueprints feat: Implement core application structure with new services, blueprints, templates, and database migrations. 2026-01-17 23:15:58 +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
services feat: Implement core application structure with new services, blueprints, templates, and database migrations. 2026-01-17 23:15:58 +08:00
static feat: Implement core application structure with new services, blueprints, templates, and database migrations. 2026-01-17 23:15:58 +08:00
templates feat: Implement core application structure with new services, blueprints, templates, and database migrations. 2026-01-17 23:15:58 +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 feat: Implement core application structure with new services, blueprints, templates, and database migrations. 2026-01-17 23:15:58 +08:00
config.py feat: Implement core application structure with new services, blueprints, templates, and database migrations. 2026-01-17 23:15:58 +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 feat: Implement core application structure with new services, blueprints, templates, and database migrations. 2026-01-17 23:15:58 +08:00
README.md feat: Implement core application structure with new services, blueprints, templates, and database migrations. 2026-01-17 23:15:58 +08:00
requirements.txt 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

AI 视界 (AI Vision) 项目指南

🚀 快速开始

1. 环境准备

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

激活虚拟环境 (推荐)

# 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


🛠️ 常用维护命令

数据库管理 (推荐)

本项目内置了自动化数据库管理工具 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)