🎬 火宝短剧 - 基于AI的一站式短剧生成平台 《一句话生成完整短剧,从剧本到成片全自动化》 Huobao Drama - An AI-Powered End-to-End Short Drama Generator "One Sentence to Complete Drama: Fully Automated from Script to Final Video"
TypeScript
修改readme相关内容
Connorae4bf97a1cbb
diff --git a/README-CN.md b/README-CN.mddeleted file mode 100644index d209aa4..0000000--- a/README-CN.md+++ /dev/null@@ -1,686 +0,0 @@-# 🎬 Huobao Drama - AI 短剧生成平台--<div align="center">--**基于 Go + Vue3 的全栈 AI 短剧自动化生产平台**--[](https://golang.org)-[](https://vuejs.org)-[](https://creativecommons.org/licenses/by-nc-sa/4.0/)--[功能特性](#功能特性) • [快速开始](#快速开始) • [部署指南](#部署指南)--[简体中文](README-CN.md) | [English](README.md) | [日本語](README-JA.md)--</div>-------## 📖 项目简介--Huobao Drama 是一个基于 AI 的短剧自动化生产平台,实现从剧本生成、角色设计、分镜制作到视频合成的全流程自动化。--火宝短剧商业版地址:[火宝短剧商业版](https://drama.chatfire.site/shortvideo)--火宝小说生成:[火宝小说生成](https://marketing.chatfire.site/huobao-novel/)--### 🎯 核心价值--- **🤖 AI 驱动**:使用大语言模型解析剧本,提取角色、场景和分镜信息-- **🎨 智能创作**:AI 绘图生成角色形象和场景背景-- **📹 视频生成**:基于文生视频和图生视频模型自动生成分镜视频-- **🔄 工作流**:完整的短剧制作工作流,从创意到成片一站式完成--### 🛠️ 技术架构--采用**DDD 领域驱动设计**,清晰分层:--```-├── API层 (Gin HTTP)-├── 应用服务层 (Business Logic)-├── 领域层 (Domain Models)-└── 基础设施层 (Database, External Services)-```--### 🎥 作品展示 / Demo Videos--体验 AI 短剧生成效果:--<div align="center">--**示例作品 1**--<video src="https://ffile.chatfire.site/cf/public/20260114094337396.mp4" controls width="640"></video>--**示例作品 2**--<video src="https://ffile.chatfire.site/cf/public/fcede75e8aeafe22031dbf78f86285b8.mp4" controls width="640"></video>--[点击观看视频 1](https://ffile.chatfire.site/cf/public/20260114094337396.mp4) | [点击观看视频 2](https://ffile.chatfire.site/cf/public/fcede75e8aeafe22031dbf78f86285b8.mp4)--</div>-------## ✨ 功能特性--### 🎭 角色管理--- ✅ AI 生成角色形象-- ✅ 批量角色生成-- ✅ 角色图片上传和管理--### 🎬 分镜制作--- ✅ 自动生成分镜脚本-- ✅ 场景描述和镜头设计-- ✅ 分镜图片生成(文生图)-- ✅ 帧类型选择(首帧/关键帧/尾帧/分镜板)--### 🎥 视频生成--- ✅ 图生视频自动生成-- ✅ 视频合成和剪辑-- ✅ 转场效果--### 📦 资源管理--- ✅ 素材库统一管理-- ✅ 本地存储支持-- ✅ 资源导入导出-- ✅ 任务进度追踪-------## 🚀 快速开始--### 📋 环境要求--| 软件 | 版本要求 | 说明 |-| ----------- | -------- | -------------------- |-| **Go** | 1.23+ | 后端运行环境 |-| **Node.js** | 18+ | 前端构建环境 |-| **npm** | 9+ | 包管理工具 |-| **FFmpeg** | 4.0+ | 视频处理(**必需**) |-| **SQLite** | 3.x | 数据库(已内置) |--#### 安装 FFmpeg--**macOS:**--```bash-brew install ffmpeg-```--**Ubuntu/Debian:**--```bash-sudo apt update-sudo apt install ffmpeg-```--**Windows:**-从 [FFmpeg 官网](https://ffmpeg.org/download.html) 下载并配置环境变量--验证安装:--```bash-ffmpeg -version-```--### ⚙️ 配置文件--复制并编辑配置文件:--```bash-cp configs/config.example.yaml configs/config.yaml-vim configs/config.yaml-```--配置文件格式(`configs/config.yaml`):--```yaml-app:- name: "Huobao Drama API"- version: "1.0.0"- debug: true # 开发环境设为true,生产环境设为false--server:- port: 5678- host: "0.0.0.0"- cors_origins:- - "http://localhost:3012"- read_timeout: 600- write_timeout: 600--database:- type: "sqlite"- path: "./data/drama_generator.db"- max_idle: 10- max_open: 100--storage:- type: "local"- local_path: "./data/storage"- base_url: "http://localhost:5678/static"--ai:- default_text_provider: "openai"- default_image_provider: "openai"- default_video_provider: "doubao"-```--**重要配置项:**--- `app.debug`: 调试模式开关(开发环境建议设为 true)-- `server.port`: 服务运行端口-- `server.cors_origins`: 允许跨域访问的前端地址-- `database.path`: SQLite 数据库文件路径-- `storage.local_path`: 本地文件存储路径-- `storage.base_url`: 静态资源访问 URL-- `ai.default_*_provider`: AI 服务提供商配置(在 Web 界面中配置具体的 API Key)--### 📥 安装依赖--```bash-# 克隆项目-git clone https://github.com/chatfire-AI/huobao-drama.git-cd huobao-drama--# 安装Go依赖-go mod download--# 安装前端依赖-cd web-npm install-cd ..-```--### 🎯 启动项目--#### 方式一:开发模式(推荐)--**前后端分离,支持热重载**--```bash-# 终端1:启动后端服务-go run main.go--# 终端2:启动前端开发服务器-cd web-npm run dev-```--- 前端地址: `http://localhost:3012`-- 后端 API: `http://localhost:5678/api/v1`-- 前端自动代理 API 请求到后端--#### 方式二:单服务模式--**后端同时提供 API 和前端静态文件**--```bash-# 1. 构建前端-cd web-npm run build-cd ..--# 2. 启动服务-go run main.go-```--访问: `http://localhost:5678`--### 🗄️ 数据库初始化--数据库表会在首次启动时自动创建(使用 GORM AutoMigrate),无需手动迁移。-------## 📦 部署指南--### ☁️ 云端一键部署(推荐 3080Ti)--👉 [优云智算,一键部署](https://www.compshare.cn/images/fScvzK95NUk5?referral_code=8hUJOaWz3YzG64FI2OlCiB&ytag=GPU_YY_YX_GitHub_huobaoai)--> ⚠️ **注意**:云端部署方案数据请及时存储到本地-------### 🐳 Docker 部署(推荐)--#### 方式一:Docker Compose(推荐)--#### 🚀 国内网络加速(可选)--如果您在国内网络环境下,Docker 拉取镜像和安装依赖可能较慢。可以通过配置镜像源加速构建过程。--**步骤 1:创建环境变量文件**--```bash-cp .env.example .env-```--**步骤 2:编辑 `.env` 文件,取消注释需要的镜像源**--```bash-# 启用 Docker Hub 镜像(推荐)-DOCKER_REGISTRY=docker.1ms.run/--# 启用 npm 镜像-NPM_REGISTRY=https://registry.npmmirror.com/--# 启用 Go 代理-GO_PROXY=https://goproxy.cn,direct--# 启用 Alpine 镜像-ALPINE_MIRROR=mirrors.aliyun.com-```--**步骤 3:使用 docker compose 构建(必须)**--```bash-docker compose build-```--> **重要说明**:->-> - ⚠️ 必须使用 `docker compose build` 才能自动加载 `.env` 文件中的镜像源配置-> - ❌ 如果使用 `docker build` 命令,需要手动传递 `--build-arg` 参数-> - ✅ 推荐始终使用 `docker compose build` 进行构建--**效果对比**:--| 操作 | 不配置镜像源 | 配置镜像源后 |-| ------------- | ------------ | ------------ |-| 拉取基础镜像 | 5-30 分钟 | 1-5 分钟 |-| 安装 npm 依赖 | 可能失败 | 快速成功 |-| 下载 Go 依赖 | 5-10 分钟 | 30 秒-1 分钟 |--> **注意**:国外用户请勿配置镜像源,使用默认配置即可。--```bash-# 启动服务-docker-compose up -d--# 查看日志-docker-compose logs -f--# 停止服务-docker-compose down-```--#### 方式二:Docker 命令--> **注意**:Linux 用户需添加 `--add-host=host.docker.internal:host-gateway` 以访问宿主机服务--```bash-# 从 Docker Hub 运行-docker run -d \- --name huobao-drama \- -p 5678:5678 \- -v $(pwd)/data:/app/data \- --restart unless-stopped \- huobao/huobao-drama:latest--# 查看日志-docker logs -f huobao-drama-```--**本地构建**(可选):--```bash-docker build -t huobao-drama:latest .-docker run -d --name huobao-drama -p 5678:5678 -v $(pwd)/data:/app/data huobao-drama:latest-```--**Docker 部署优势:**--- ✅ 开箱即用,内置默认配置-- ✅ 环境一致性,避免依赖问题-- ✅ 一键启动,无需安装 Go、Node.js、FFmpeg-- ✅ 易于迁移和扩展-- ✅ 自动健康检查和重启-- ✅ 自动处理文件权限,无需手动配置--#### 🔗 访问宿主机服务(Ollama/本地模型)--容器已配置支持访问宿主机服务,直接使用 `http://host.docker.internal:端口号` 即可。--**配置步骤:**--1. **宿主机启动服务(监听所有接口)**-- ```bash- export OLLAMA_HOST=0.0.0.0:11434 && ollama serve- ```--2. **前端 AI 服务配置**- - Base URL: `http://host.docker.internal:11434/v1`- - Provider: `openai`- - Model: `qwen2.5:latest`-------### 🏭 传统部署方式--#### 1. 编译构建--```bash-# 1. 构建前端-cd web-npm run build-cd ..--# 2. 编译后端-go build -o huobao-drama .-```--生成文件:--- `huobao-drama` - 后端可执行文件-- `web/dist/` - 前端静态文件(已嵌入后端)--#### 2. 准备部署文件--需要上传到服务器的文件:--```-huobao-drama # 后端可执行文件-configs/config.yaml # 配置文件-data/ # 数据目录(可选,首次运行自动创建)-```--#### 3. 服务器配置--```bash-# 上传文件到服务器-scp huobao-drama user@server:/opt/huobao-drama/-scp configs/config.yaml user@server:/opt/huobao-drama/configs/--# SSH登录服务器-ssh user@server--# 修改配置文件-cd /opt/huobao-drama-vim configs/config.yaml-# 设置mode为production-# 配置域名和存储路径--# 创建数据目录并设置权限(重要!)-# 注意:将 YOUR_USER 替换为实际运行服务的用户名(如 www-data、ubuntu、deploy 等)-sudo mkdir -p /opt/huobao-drama/data/storage-sudo chown -R YOUR_USER:YOUR_USER /opt/huobao-drama/data-sudo chmod -R 755 /opt/huobao-drama/data--# 赋予执行权限-chmod +x huobao-drama--# 启动服务-./huobao-drama-```--#### 4. 使用 systemd 管理服务--创建服务文件 `/etc/systemd/system/huobao-drama.service`:--```ini-[Unit]-Description=Huobao Drama Service-After=network.target--[Service]-Type=simple-User=YOUR_USER-WorkingDirectory=/opt/huobao-drama-ExecStart=/opt/huobao-drama/huobao-drama-Restart=on-failure-RestartSec=10--# 环境变量(可选)-# Environment="GIN_MODE=release"--[Install]-WantedBy=multi-user.target-```--启动服务:--```bash-sudo systemctl daemon-reload-sudo systemctl enable huobao-drama-sudo systemctl start huobao-drama-sudo systemctl status huobao-drama-```--**⚠️ 常见问题:SQLite 写权限错误**--如果遇到 `attempt to write a readonly database` 错误:--```bash-# 1. 确认当前运行服务的用户-sudo systemctl status huobao-drama | grep "Main PID"-ps aux | grep huobao-drama--# 2. 修复权限(将 YOUR_USER 替换为实际用户名)-sudo chown -R YOUR_USER:YOUR_USER /opt/huobao-drama/data-sudo chmod -R 755 /opt/huobao-drama/data--# 3. 验证权限-ls -la /opt/huobao-drama/data-# 应该显示所有者为运行服务的用户--# 4. 重启服务-sudo systemctl restart huobao-drama-```--**原因说明**:--- SQLite 需要对数据库文件 **和** 所在目录都有写权限-- 需要在目录中创建临时文件(如 `-wal`、`-journal`)-- **关键**:确保 systemd 配置中的 `User` 与数据目录所有者一致--**常用用户名**:--- Ubuntu/Debian: `www-data`、`ubuntu`-- CentOS/RHEL: `nginx`、`apache`-- 自定义部署: `deploy`、`app`、当前登录用户--#### 5. Nginx 反向代理--```nginx-server {- listen 80;- server_name your-domain.com;-- location / {- proxy_pass http://localhost:5678;- proxy_set_header Host $host;- proxy_set_header X-Real-IP $remote_addr;- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;- }-- # 静态文件直接访问- location /static/ {- alias /opt/huobao-drama/data/storage/;- }-}-```-------## 🎨 技术栈--### 后端技术--- **语言**: Go 1.23+-- **Web 框架**: Gin 1.9+-- **ORM**: GORM-- **数据库**: SQLite-- **日志**: Zap-- **视频处理**: FFmpeg-- **AI 服务**: OpenAI、Gemini、火山等--### 前端技术--- **框架**: Vue 3.4+-- **语言**: TypeScript 5+-- **构建工具**: Vite 5-- **UI 组件**: Element Plus-- **CSS 框架**: TailwindCSS-- **状态管理**: Pinia-- **路由**: Vue Router 4--### 开发工具--- **包管理**: Go Modules, npm-- **代码规范**: ESLint, Prettier-- **版本控制**: Git-------## 📝 常见问题--### Q: Docker 容器如何访问宿主机的 Ollama?--A: 使用 `http://host.docker.internal:11434/v1` 作为 Base URL。注意两点:--1. 宿主机 Ollama 需监听 `0.0.0.0`:`export OLLAMA_HOST=0.0.0.0:11434 && ollama serve`-2. Linux 用户使用 `docker run` 需添加:`--add-host=host.docker.internal:host-gateway`--详见:[DOCKER_HOST_ACCESS.md](docs/DOCKER_HOST_ACCESS.md)--### Q: FFmpeg 未安装或找不到?--A: 确保 FFmpeg 已安装并在 PATH 环境变量中。运行 `ffmpeg -version` 验证。--### Q: 前端无法连接后端 API?--A: 检查后端是否启动,端口是否正确。开发模式下前端代理配置在 `web/vite.config.ts`。--### Q: 数据库表未创建?--A: GORM 会在首次启动时自动创建表,检查日志确认迁移是否成功。-------## 📋 更新日志 / Changelog--### v1.0.5 (2026-02-06)--#### 🎨 重大功能--- **🎭 全局风格系统**:引入了项目级别的风格选择支持。用户现在可以在剧本层面定义自定义视觉风格,该风格将自动应用于所有 AI 生成的内容,包括角色、场景和分镜图像,确保整个制作过程中的艺术风格一致性。--- **✂️ 九宫格序列图裁剪**:新增裁剪工具,支持从动作序列图(3x3 网格布局)中提取单个帧,并将其指定为首帧、尾帧或关键帧用于视频生成,为镜头构图和连续性提供更大的灵活性。--#### 🚀 功能增强--- **📐 优化动作序列网格**:改进了九宫格动作序列图的视觉质量和布局,优化了间距、对齐和帧过渡效果。--- **🔧 手动网格拼接**:引入手动网格组合工具,支持 2x2(四宫格)、2x3(六宫格)和 3x3(九宫格)布局,允许用户从单个帧创建自定义动作序列。--- **🗑️ 内容管理**:新增图片和视频的删除功能,实现更好的素材组织和存储管理。--### v1.0.4 (2026-01-27)--#### 🚀 重大更新--- 引入本地存储策略,实现生成内容的本地化缓存管理,有效规避外部资源链接失效风险-- 采用 Base64 编码方案进行参考图像的嵌入式传输-- 修复镜头切换时镜头图片提示词状态未重置问题-- 修复视频添加素材库视频时长显示为0的问题-- 添加场景迁移至章节内--#### 历史数据清洗--- 增加清洗脚本,用于处理历史数据,具体操作请参考 [MIGRATE_README.md](MIGRATE_README.md)--### v1.0.3 (2026-01-16)--#### 🚀 重大更新--- SQLite 纯 Go 驱动(`modernc.org/sqlite`),支持 `CGO_ENABLED=0` 跨平台编译-- 优化并发性能(WAL 模式),解决 "database is locked" 错误-- Docker 跨平台支持 `host.docker.internal` 访问宿主机服务-- 精简文档和部署指南--### v1.0.2 (2026-01-14)--#### 🐛 Bug Fixes / 🔧 Improvements--- 修复视频生成 API 响应解析问题-- 添加 OpenAI Sora 视频端点配置-- 优化错误处理和日志输出-------## 🤝 贡献指南--欢迎提交 Issue 和 Pull Request!--1. Fork 本项目-2. 创建特性分支 (`git checkout -b feature/AmazingFeature`)-3. 提交改动 (`git commit -m 'Add some AmazingFeature'`)-4. 推送到分支 (`git push origin feature/AmazingFeature`)-5. 开启 Pull Request-------## API 配置站点--2 分钟完成配置:[API 聚合站点](https://api.chatfire.site/models)-------## 👨💻 关于我们--**AI 火宝 - AI 工作室创业中**--- 🏠 **位置**: 中国南京-- 🚀 **状态**: 创业中-- 📧 **Email**: [[email protected]](mailto:[email protected])-- 🐙 **GitHub**: [https://github.com/chatfire-AI/huobao-drama](https://github.com/chatfire-AI/huobao-drama)--> _"让 AI 帮我们做更有创造力的事"_--### 📢 招聘信息--#### 全栈高级开发工程师(Base 南京)--**关于岗位:**--我们是创业团队,致力于打造 AI 驱动的终端应用。如果你热爱技术、追求极致,渴望在 AI 领域有所作为,欢迎加入我们,一起做有意义的事!--**岗位要求:**--1. 参与 AI 驱动的终端应用全栈开发,覆盖 Web/移动端前后端系统搭建,主导核心业务模块的设计、开发、测试与上线迭代。-2. 负责核心功能模块开发,包括:前端交互实现(React/Vue.js + TypeScript)、后端服务开发(Python/Node.js + Flask/FastAPI),确保模块高效、稳定、可扩展。-3. 负责 AI 模型服务接口设计与对接,参与 AI 能力落地终端场景的技术方案设计,推动 AI 技术与业务场景的深度融合。-4. 深度践行 vibe coding 开发模式,注重代码质量、开发效率与技术美感,搭建规范的开发流程,推动团队研发模式优化。--**加入我们:**--如果你对 AI 技术充满热情,喜欢挑战和创新,欢迎投递简历至 [[email protected]](mailto:[email protected])--期待志同道合的你一起探索 AI 的无限可能!--## 项目交流群----- 提交 [Issue](../../issues)-- 发送邮件至项目维护者-------<div align="center">--**⭐ 如果这个项目对你有帮助,请给一个 Star!**--## Star History--[](https://www.star-history.com/#chatfire-AI/huobao-drama&type=date&legend=top-left)-Made with ❤️ by Huobao Team--</div>diff --git a/README-JA.md b/README-JA.mddeleted file mode 100644index 5cb7078..0000000--- a/README-JA.md+++ /dev/null@@ -1,667 +0,0 @@-# 🎬 Huobao Drama - AI ショートドラマ制作プラットフォーム--<div align="center">--**Go + Vue3 ベースのフルスタック AI ショートドラマ自動化プラットフォーム**--[](https://golang.org)-[](https://vuejs.org)-[](https://creativecommons.org/licenses/by-nc-sa/4.0/)--[機能](#機能) • [クイックスタート](#クイックスタート) • [デプロイ](#デプロイ)--[简体中文](README-CN.md) | [English](README.md) | [日本語](README-JA.md)--</div>-------## 📖 概要--Huobao Drama は、脚本生成、キャラクターデザイン、絵コンテ作成から動画合成までの全ワークフローを自動化する AI 駆動のショートドラマ制作プラットフォームです。--火宝短剧商业版地址:[火宝短剧商业版](https://drama.chatfire.site/shortvideo)--火宝小说生成:[火宝小说生成](https://marketing.chatfire.site/huobao-novel/)--### 🎯 主要機能--- **🤖 AI 駆動**: 大規模言語モデルを使用して脚本を解析し、キャラクター、シーン、絵コンテ情報を抽出-- **🎨 インテリジェント創作**: AI によるキャラクターポートレートとシーン背景の生成-- **📹 動画生成**: テキストから動画、画像から動画モデルによる絵コンテ動画の自動生成-- **🔄 完全なワークフロー**: アイデアから完成動画までのエンドツーエンド制作ワークフロー--### 🛠️ 技術アーキテクチャ--**DDD(ドメイン駆動設計)** に基づく明確なレイヤー構造:--```-├── APIレイヤー (Gin HTTP)-├── アプリケーションサービスレイヤー (ビジネスロジック)-├── ドメインレイヤー (ドメインモデル)-└── インフラストラクチャレイヤー (データベース、外部サービス)-```--### 🎥 デモ動画--AI ショートドラマ生成を体験:--<div align="center">--**サンプル作品 1**--<video src="https://ffile.chatfire.site/cf/public/20260114094337396.mp4" controls width="640"></video>--**サンプル作品 2**--<video src="https://ffile.chatfire.site/cf/public/fcede75e8aeafe22031dbf78f86285b8.mp4" controls width="640"></video>--[動画 1 を見る](https://ffile.chatfire.site/cf/public/20260114094337396.mp4) | [動画 2 を見る](https://ffile.chatfire.site/cf/public/fcede75e8aeafe22031dbf78f86285b8.mp4)--</div>-------## ✨ 機能--### 🎭 キャラクター管理--- ✅ AI 生成キャラクターポートレート-- ✅ バッチキャラクター生成-- ✅ キャラクター画像のアップロードと管理--### 🎬 絵コンテ制作--- ✅ 自動絵コンテスクリプト生成-- ✅ シーン説明とショットデザイン-- ✅ 絵コンテ画像生成(テキストから画像)-- ✅ フレームタイプ選択(先頭フレーム/キーフレーム/末尾フレーム/パネル)--### 🎥 動画生成--- ✅ 画像から動画の自動生成-- ✅ 動画合成と編集-- ✅ トランジション効果--### 📦 アセット管理--- ✅ 統合アセットライブラリ管理-- ✅ ローカルストレージサポート-- ✅ アセットのインポート/エクスポート-- ✅ タスク進捗トラッキング-------## 🚀 クイックスタート--### 📋 前提条件--| ソフトウェア | バージョン | 説明 |-| ------------ | ---------- | ------------------------ |-| **Go** | 1.23+ | バックエンドランタイム |-| **Node.js** | 18+ | フロントエンドビルド環境 |-| **npm** | 9+ | パッケージマネージャー |-| **FFmpeg** | 4.0+ | 動画処理(**必須**) |-| **SQLite** | 3.x | データベース(内蔵) |--#### FFmpeg のインストール--**macOS:**--```bash-brew install ffmpeg-```--**Ubuntu/Debian:**--```bash-sudo apt update-sudo apt install ffmpeg-```--**Windows:**-[FFmpeg 公式サイト](https://ffmpeg.org/download.html)からダウンロードし、環境変数を設定--インストール確認:--```bash-ffmpeg -version-```--### ⚙️ 設定--設定ファイルをコピーして編集:--```bash-cp configs/config.example.yaml configs/config.yaml-vim configs/config.yaml-```--設定ファイル形式(`configs/config.yaml`):--```yaml-app:- name: "Huobao Drama API"- version: "1.0.0"- debug: true # 開発環境ではtrue、本番環境ではfalseに設定--server:- port: 5678- host: "0.0.0.0"- cors_origins:- - "http://localhost:3012"- read_timeout: 600- write_timeout: 600--database:- type: "sqlite"- path: "./data/drama_generator.db"- max_idle: 10- max_open: 100--storage:- type: "local"- local_path: "./data/storage"- base_url: "http://localhost:5678/static"--ai:- default_text_provider: "openai"- default_image_provider: "openai"- default_video_provider: "doubao"-```--**主要設定項目:**--- `app.debug`: デバッグモードスイッチ(開発環境では true を推奨)-- `server.port`: サービスポート-- `server.cors_origins`: フロントエンドの許可 CORS オリジン-- `database.path`: SQLite データベースファイルパス-- `storage.local_path`: ローカルファイルストレージパス-- `storage.base_url`: 静的リソースアクセス URL-- `ai.default_*_provider`: AI サービスプロバイダー設定(API キーは Web UI で設定)--### 📥 インストール--```bash-# プロジェクトをクローン-git clone https://github.com/chatfire-AI/huobao-drama.git-cd huobao-drama--# Go依存関係をインストール-go mod download--# フロントエンド依存関係をインストール-cd web-npm install-cd ..-```--### 🎯 プロジェクトの起動--#### 方法 1: 開発モード(推奨)--**フロントエンドとバックエンドを分離、ホットリロード対応**--```bash-# ターミナル1: バックエンドサービスを起動-go run main.go--# ターミナル2: フロントエンド開発サーバーを起動-cd web-npm run dev-```--- フロントエンド: `http://localhost:3012`-- バックエンド API: `http://localhost:5678/api/v1`-- フロントエンドは API リクエストを自動的にバックエンドにプロキシ--#### 方法 2: シングルサービスモード--**バックエンドが API とフロントエンド静的ファイルの両方を提供**--```bash-# 1. フロントエンドをビルド-cd web-npm run build-cd ..--# 2. サービスを起動-go run main.go-```--アクセス: `http://localhost:5678`--### 🗄️ データベース初期化--データベーステーブルは初回起動時に自動作成されます(GORM AutoMigrate を使用)。手動マイグレーションは不要です。-------## 📦 デプロイ--### ☁️ クラウドワンクリックデプロイ(推奨 3080Ti)--👉 [优云智算,一键部署](https://www.compshare.cn/images/fScvzK95NUk5?referral_code=8hUJOaWz3YzG64FI2OlCiB&ytag=GPU_YY_YX_GitHub_huobaoai)--> ⚠️ **注意**:クラウドデプロイを使用する場合は、データを速やかにローカルストレージに保存してください-------### 🐳 Docker デプロイ(推奨)--#### 方法 1: Docker Compose(推奨)--#### 🚀 中国国内ネットワーク高速化(オプション)--中国国内のネットワーク環境では、Docker イメージのプルや依存関係のインストールが遅い場合があります。ミラーソースを設定することでビルドプロセスを高速化できます。--**ステップ 1: 環境変数ファイルを作成**--```bash-cp .env.example .env-```--**ステップ 2: `.env` ファイルを編集し、必要なミラーソースのコメントを解除**--```bash-# Docker Hub ミラーを有効化(推奨)-DOCKER_REGISTRY=docker.1ms.run/--# npm ミラーを有効化-NPM_REGISTRY=https://registry.npmmirror.com/--# Go プロキシを有効化-GO_PROXY=https://goproxy.cn,direct--# Alpine ミラーを有効化-ALPINE_MIRROR=mirrors.aliyun.com-```--**ステップ 3: docker compose でビルド(必須)**--```bash-docker compose build-```--> **重要な注意事項**:->-> - ⚠️ `.env` ファイルのミラーソース設定を自動的に読み込むには `docker compose build` を使用する必要があります-> - ❌ `docker build` コマンドを使用する場合は、手動で `--build-arg` パラメータを渡す必要があります-> - ✅ 常に `docker compose build` を使用してビルドすることを推奨--**パフォーマンス比較**:--| 操作 | ミラー未設定 | ミラー設定後 |-| ------------------------ | -------------- | ------------ |-| ベースイメージのプル | 5-30 分 | 1-5 分 |-| npm 依存関係インストール | 失敗する可能性 | 高速成功 |-| Go 依存関係ダウンロード | 5-10 分 | 30 秒-1 分 |--> **注意**: 中国国外のユーザーはミラーソースを設定せず、デフォルト設定を使用してください。--```bash-# サービスを起動-docker-compose up -d--# ログを表示-docker-compose logs -f--# サービスを停止-docker-compose down-```--#### 方法 2: Docker コマンド--> **注意**: Linux ユーザーはホストサービスにアクセスするために `--add-host=host.docker.internal:host-gateway` を追加する必要があります--```bash-# Docker Hubから実行-docker run -d \- --name huobao-drama \- -p 5678:5678 \- -v $(pwd)/data:/app/data \- --restart unless-stopped \- huobao/huobao-drama:latest--# ログを表示-docker logs -f huobao-drama-```--**ローカルビルド**(オプション):--```bash-docker build -t huobao-drama:latest .-docker run -d --name huobao-drama -p 5678:5678 -v $(pwd)/data:/app/data huobao-drama:latest-```--**Docker デプロイの利点:**--- ✅ デフォルト設定ですぐに使用可能-- ✅ 環境の一貫性、依存関係の問題を回避-- ✅ ワンクリック起動、Go、Node.js、FFmpeg のインストール不要-- ✅ 移行とスケーリングが容易-- ✅ 自動ヘルスチェックと再起動-- ✅ ファイル権限の自動処理--#### 🔗 ホストサービスへのアクセス(Ollama/ローカルモデル)--コンテナは `http://host.docker.internal:ポート番号` を使用してホストサービスにアクセスするよう設定されています。--**設定手順:**--1. **ホストでサービスを起動(全インターフェースでリッスン)**-- ```bash- export OLLAMA_HOST=0.0.0.0:11434 && ollama serve- ```--2. **フロントエンド AI サービス設定**- - Base URL: `http://host.docker.internal:11434/v1`- - Provider: `openai`- - Model: `qwen2.5:latest`-------### 🏭 従来のデプロイ方法--#### 1. ビルド--```bash-# 1. フロントエンドをビルド-cd web-npm run build-cd ..--# 2. バックエンドをコンパイル-go build -o huobao-drama .-```--生成ファイル:--- `huobao-drama` - バックエンド実行ファイル-- `web/dist/` - フロントエンド静的ファイル(バックエンドに埋め込み)--#### 2. デプロイファイルの準備--サーバーにアップロードするファイル:--```-huobao-drama # バックエンド実行ファイル-configs/config.yaml # 設定ファイル-data/ # データディレクトリ(オプション、初回実行時に自動作成)-```--#### 3. サーバー設定--```bash-# ファイルをサーバーにアップロード-scp huobao-drama user@server:/opt/huobao-drama/-scp configs/config.yaml user@server:/opt/huobao-drama/configs/--# サーバーにSSH接続-ssh user@server--# 設定ファイルを編集-cd /opt/huobao-drama-vim configs/config.yaml-# modeをproductionに設定-# ドメインとストレージパスを設定--# データディレクトリを作成し権限を設定(重要!)-# 注意: YOUR_USERを実際にサービスを実行するユーザー名に置き換え(例: www-data、ubuntu、deploy)-sudo mkdir -p /opt/huobao-drama/data/storage-sudo chown -R YOUR_USER:YOUR_USER /opt/huobao-drama/data-sudo chmod -R 755 /opt/huobao-drama/data--# 実行権限を付与-chmod +x huobao-drama--# サービスを起動-./huobao-drama-```--#### 4. systemd でサービス管理--サービスファイル `/etc/systemd/system/huobao-drama.service` を作成:--```ini-[Unit]-Description=Huobao Drama Service-After=network.target--[Service]-Type=simple-User=YOUR_USER-WorkingDirectory=/opt/huobao-drama-ExecStart=/opt/huobao-drama/huobao-drama-Restart=on-failure-RestartSec=10--# 環境変数(オプション)-# Environment="GIN_MODE=release"--[Install]-WantedBy=multi-user.target-```--サービスを起動:--```bash-sudo systemctl daemon-reload-sudo systemctl enable huobao-drama-sudo systemctl start huobao-drama-sudo systemctl status huobao-drama-```--**⚠️ よくある問題: SQLite 書き込み権限エラー**--`attempt to write a readonly database` エラーが発生した場合:--```bash-# 1. サービスを実行中のユーザーを確認-sudo systemctl status huobao-drama | grep "Main PID"-ps aux | grep huobao-drama--# 2. 権限を修正(YOUR_USERを実際のユーザー名に置き換え)-sudo chown -R YOUR_USER:YOUR_USER /opt/huobao-drama/data-sudo chmod -R 755 /opt/huobao-drama/data--# 3. 権限を確認-ls -la /opt/huobao-drama/data-# サービスを実行するユーザーが所有者として表示されるはず--# 4. サービスを再起動-sudo systemctl restart huobao-drama-```--**原因:**--- SQLite はデータベースファイル**と**そのディレクトリの両方に書き込み権限が必要-- ディレクトリ内に一時ファイル(例: `-wal`、`-journal`)を作成する必要がある-- **重要**: systemd の`User`がデータディレクトリの所有者と一致していることを確認--**一般的なユーザー名:**--- Ubuntu/Debian: `www-data`、`ubuntu`-- CentOS/RHEL: `nginx`、`apache`-- カスタムデプロイ: `deploy`、`app`、現在ログインしているユーザー--#### 5. Nginx リバースプロキシ--```nginx-server {- listen 80;- server_name your-domain.com;-- location / {- proxy_pass http://localhost:5678;- proxy_set_header Host $host;- proxy_set_header X-Real-IP $remote_addr;- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;- }-- # 静的ファイルへの直接アクセス- location /static/ {- alias /opt/huobao-drama/data/storage/;- }-}-```-------## 🎨 技術スタック--### バックエンド--- **言語**: Go 1.23+-- **Web フレームワーク**: Gin 1.9+-- **ORM**: GORM-- **データベース**: SQLite-- **ログ**: Zap-- **動画処理**: FFmpeg-- **AI サービス**: OpenAI、Gemini、Doubao など--### フロントエンド--- **フレームワーク**: Vue 3.4+-- **言語**: TypeScript 5+-- **ビルドツール**: Vite 5-- **UI コンポーネント**: Element Plus-- **CSS フレームワーク**: TailwindCSS-- **状態管理**: Pinia-- **ルーター**: Vue Router 4--### 開発ツール--- **パッケージ管理**: Go Modules、npm-- **コード規約**: ESLint、Prettier-- **バージョン管理**: Git-------## 📝 よくある質問--### Q: Docker コンテナからホストの Ollama にアクセスするには?--A: Base URL として `http://host.docker.internal:11434/v1` を使用します。注意点:--1. ホストの Ollama は `0.0.0.0` でリッスンする必要があります: `export OLLAMA_HOST=0.0.0.0:11434 && ollama serve`-2. `docker run` を使用する Linux ユーザーは追加が必要: `--add-host=host.docker.internal:host-gateway`--詳細: [DOCKER_HOST_ACCESS.md](docs/DOCKER_HOST_ACCESS.md)--### Q: FFmpeg がインストールされていない、または見つからない?--A: FFmpeg がインストールされ、PATH 環境変数に含まれていることを確認してください。`ffmpeg -version` で確認。--### Q: フロントエンドがバックエンド API に接続できない?--A: バックエンドが実行中で、ポートが正しいか確認してください。開発モードでは、フロントエンドプロキシ設定は `web/vite.config.ts` にあります。--### Q: データベーステーブルが作成されない?--A: GORM は初回起動時にテーブルを自動作成します。ログでマイグレーション成功を確認してください。-------## 📋 更新履歴--### v1.0.5 (2026-02-06)--#### 🎨 主要機能--- **🎭 グローバルスタイルシステム**:プロジェクト全体でスタイル選択をサポートする包括的なシステムを導入しました。ユーザーはドラマレベルでカスタムビジュアルスタイルを定義でき、キャラクター、シーン、ストーリーボードを含むすべてのAI生成コンテンツに自動的に適用され、制作全体で一貫した芸術的方向性を確保します。--- **✂️ 9グリッドシーケンス画像クロップ**:アクションシーケンス画像用のクロップツールを追加しました。3x3グリッドレイアウトから個別のフレームを抽出し、ビデオ生成用のファーストフレーム、ラストフレーム、またはキーフレームとして指定できるようになり、ショット構成と連続性においてより大きな柔軟性を提供します。--#### 🚀 機能強化--- **📐 アクションシーケンスグリッドの最適化**:9グリッドアクションシーケンス画像の視覚品質とレイアウトを改善し、間隔、配置、フレーム遷移を最適化しました。--- **🔧 手動グリッド組み立て**:2x2(4グリッド)、2x3(6グリッド)、3x3(9グリッド)レイアウトをサポートする手動グリッド構成ツールを導入し、個別のフレームからカスタムアクションシーケンスを作成できるようになりました。--- **🗑️ コンテンツ管理**:生成された画像とビデオの両方に削除機能を追加し、より良いアセット整理とストレージ管理を実現しました。--### v1.0.4 (2026-01-27)--#### 🚀 主要アップデート--- 生成コンテンツのローカルストレージ戦略を導入し、外部リソースリンクの有効期限切れリスクを効果的に軽減-- 参照画像の埋め込み転送用 Base64 エンコーディング方式を実装-- ショット切り替え時にショット画像プロンプト状態がリセットされない問題を修正-- ライブラリ動画追加時に動画の長さが 0 と表示される問題を修正-- シーンのエピソードへの移行機能を追加--#### 履歴データクリーニング--- 履歴データ処理用のマイグレーションスクリプトを追加。詳細な手順については [MIGRATE_README.md](MIGRATE_README.md) を参照してください--### v1.0.3 (2026-01-16)--#### 🚀 主要アップデート--- 純粋な Go SQLite ドライバー(`modernc.org/sqlite`)、`CGO_ENABLED=0` クロスプラットフォームコンパイルをサポート-- 並行性能を最適化(WAL モード)、"database is locked" エラーを解決-- ホストサービスへのアクセス用 `host.docker.internal` の Docker クロスプラットフォームサポート-- ドキュメントとデプロイガイドの簡素化--### v1.0.2 (2026-01-14)--#### 🐛 バグ修正 / 🔧 改善--- 動画生成 API レスポンスのパース問題を修正-- OpenAI Sora 動画エンドポイント設定を追加-- エラー処理とログ出力を最適化-------## 🤝 コントリビューション--Issue と Pull Request を歓迎します!--1. このプロジェクトをフォーク-2. フィーチャーブランチを作成 (`git checkout -b feature/AmazingFeature`)-3. 変更をコミット (`git commit -m 'Add some AmazingFeature'`)-4. ブランチにプッシュ (`git push origin feature/AmazingFeature`)-5. Pull Request を作成-------## API 設定サイト--2 分で設定完了: [API 集約サイト](https://api.chatfire.site/models)-------## 👨💻 私たちについて--**AI 火宝 - AI スタジオ起業中**--- 🏠 **所在地**: 中国南京-- 🚀 **ステータス**: 起業中-- 📧 **Email**: [[email protected]](mailto:[email protected])-- 💬 **WeChat**: dangbao1117 (個人 WeChat - 技術的な質問には対応しません)-- 🐙 **GitHub**: [https://github.com/chatfire-AI/huobao-drama](https://github.com/chatfire-AI/huobao-drama)--> _「AI に私たちのより創造的なことを手伝ってもらおう」_--## コミュニティグループ----- [Issue](../../issues)を提出-- プロジェクトメンテナにメール-------<div align="center">--**⭐ このプロジェクトが役に立ったら、Star をお願いします!**--## Star 履歴--[](https://www.star-history.com/#chatfire-AI/huobao-drama&type=date&legend=top-left)--Made with ❤️ by Huobao Team--</div>diff --git a/README.md b/README.mdindex ebfb41a..74eb68f 100644--- a/README.md+++ b/README.md@@ -1,666 +1,481 @@-# 🎬 Huobao Drama - AI Short Drama Production Platform+# 火宝短剧-<div align="center">--**Full-stack AI Short Drama Automation Platform Based on Go + Vue3**+基于 TypeScript 的 AI 短剧生产工作台。+当前开源版本覆盖了从剧集内容编写、AI 改写、角色场景提取、分镜生成,到图片生成、配音生成、视频生成、单镜头合成和整集拼接导出的完整流程。-[](https://golang.org)-[](https://vuejs.org)-[](https://creativecommons.org/licenses/by-nc-sa/4.0/)+-[Features](#features) • [Quick Start](#quick-start) • [Deployment](#deployment)+## 项目简介-[简体中文](README-CN.md) | [English](README.md) | [日本語](README-JA.md)+火宝短剧是一个本地优先的短剧生产工具,面向连载短剧项目,提供完整的生产工作流:-</div>+- 项目与剧集管理+- AI 剧本改写与信息提取+- 角色、场景、分镜编辑+- 角色图、场景图、镜头图生成+- 配音试听、镜头 TTS、视频生成+- FFmpeg 单镜头合成与整集拼接+- 可视化工作台统一管理全流程----+本仓库是当前的 TypeScript 版本,不是旧的 Go 版本实现。-## 📖 About+## 技术栈-Huobao Drama is an AI-powered short drama production platform that automates the entire workflow from script generation, character design, storyboarding to video composition.+### 前端-火宝短剧商业版地址:[火宝短剧商业版](https://drama.chatfire.site/shortvideo)+- Nuxt 3+- Vue 3+- TypeScript+- 纯 CSS-火宝小说生成:[火宝小说生成](https://marketing.chatfire.site/huobao-novel/)+### 后端-### 🎯 Core Features+- Hono+- Drizzle ORM+- better-sqlite3+- Mastra Agents+- FFmpeg-- **🤖 AI-Driven**: Parse scripts using large language models to extract characters, scenes, and storyboards-- **🎨 Intelligent Creation**: AI-generated character portraits and scene backgrounds-- **📹 Video Generation**: Automatic storyboard video generation using text-to-video and image-to-video models-- **🔄 Complete Workflow**: End-to-end production workflow from idea to final video。+### 存储-### 🛠️ Technical Architecture+- SQLite 数据库+- 本地文件存储 `data/static/`-Based on **DDD (Domain-Driven Design)** with clear layering:+## 项目结构-```-├── API Layer (Gin HTTP)-├── Application Service Layer (Business Logic)-├── Domain Layer (Domain Models)-└── Infrastructure Layer (Database, External Services)+```text+frontend/ Nuxt 3 工作台前端+backend/ Hono API + Drizzle + agent/runtime 服务+configs/ 示例配置+data/ 本地数据库与生成资源+skills/ agent 运行时技能定义```-### 🎥 Demo Videos+关键入口:-Experience AI short drama generation:+- 后端入口:[backend/src/index.ts](/Users/connor/AiProject/huobao-drama/backend/src/index.ts)+- 数据库入口:[backend/src/db/index.ts](/Users/connor/AiProject/huobao-drama/backend/src/db/index.ts)+- 工作台页面:[frontend/app/pages/drama/[id]/episode/[episodeNumber].vue](/Users/connor/AiProject/huobao-drama/frontend/app/pages/drama/[id]/episode/[episodeNumber].vue)-<div align="center">+## 核心工作流-**Sample Work 1**+工作台当前按这条流程组织:-<video src="https://ffile.chatfire.site/cf/public/20260114094337396.mp4" controls width="640"></video>+1. 原始内容录入+2. 可选 AI 改写+3. 角色与场景提取+4. 音色分配+5. 分镜拆解与编辑+6. 角色图 / 场景图 / 镜头图生成+7. 配音生成+8. 视频生成+9. 单镜头视频合成+10. 整集拼接导出-**Sample Work 2**+此外还包含宫格图工具,用于:-<video src="https://ffile.chatfire.site/cf/public/fcede75e8aeafe22031dbf78f86285b8.mp4" controls width="640"></video>+- 生成多格参考图+- 切分宫格图+- 手动将格子分配回选中的分镜-[Watch Video 1](https://ffile.chatfire.site/cf/public/20260114094337396.mp4) | [Watch Video 2](https://ffile.chatfire.site/cf/public/fcede75e8aeafe22031dbf78f86285b8.mp4)+## 功能概览-</div>+### 项目与剧集管理----+- 创建和管理短剧项目+- 创建剧集,并在创建时锁定图片 / 视频 / 音频模型配置+- 本地 SQLite 持久化-## ✨ Features+### AI 工作流-### 🎭 Character Management+当前内置 agent:-- ✅ AI-generated character portraits-- ✅ Batch character generation-- ✅ Character image upload and management+- `script_rewriter`+- `extractor`+- `storyboard_breaker`+- `voice_assigner`+- `grid_prompt_generator`-### 🎬 Storyboard Production+对应能力包括:-- ✅ Automatic storyboard script generation-- ✅ Scene descriptions and shot design-- ✅ Storyboard image generation (text-to-image)-- ✅ Frame type selection (first frame/key frame/last frame/panel)+- 剧本改写+- 角色与场景提取+- 分镜拆解+- 音色分配+- 宫格图提示词生成-### 🎥 Video Generation+### 素材生成-- ✅ Automatic image-to-video generation-- ✅ Video composition and editing-- ✅ Transition effects+- 角色图片生成+- 场景图片生成+- 镜头图片生成+- 角色试听生成+- 镜头 TTS 生成+- 文生视频 / 图生视频生成-### 📦 Asset Management+### 编辑与生产-- ✅ Unified asset library management-- ✅ Local storage support-- ✅ Asset import/export-- ✅ Task progress tracking+- 分镜绑定角色与场景+- 分镜级提示词编辑+- 已生成图片 / 视频预览+- 批量合成+- 最终整集导出----+### 运维与配置-## 🚀 Quick Start+- AI 服务配置页面+- 音色同步接口+- agent / 图片 / 音频 / 视频 / 合成 / 拼接日志输出-### 📋 Prerequisites+## 环境要求-| Software | Version | Description |-| ----------- | ------- | ------------------------------- |-| **Go** | 1.23+ | Backend runtime |-| **Node.js** | 18+ | Frontend build environment |-| **npm** | 9+ | Package manager |-| **FFmpeg** | 4.0+ | Video processing (**Required**) |-| **SQLite** | 3.x | Database (built-in) |+- Node.js 18++- npm 9++- FFmpeg 已安装并在 `PATH` 中可用-#### Installing FFmpeg+推荐:-**macOS:**+- macOS / Linux+- 本地对 `data/` 目录有读写权限-```bash-brew install ffmpeg-```+## 快速开始-**Ubuntu/Debian:**+### 1. 安装依赖```bash-sudo apt update-sudo apt install ffmpeg-```--**Windows:**-Download from [FFmpeg Official Site](https://ffmpeg.org/download.html) and configure environment variables--Verify installation:+cd backend+npm install-```bash-ffmpeg -version+cd ../frontend+npm install```-### ⚙️ Configuration+### 2. 准备配置-Copy and edit the configuration file:+如需本地配置文件:```bashcp configs/config.example.yaml configs/config.yaml-vim configs/config.yaml-```--Configuration file format (`configs/config.yaml`):--```yaml-app:- name: "Huobao Drama API"- version: "1.0.0"- debug: true # Set to true for development, false for production--server:- port: 5678- host: "0.0.0.0"- cors_origins:- - "http://localhost:3012"- read_timeout: 600- write_timeout: 600--database:- type: "sqlite"- path: "./data/drama_generator.db"- max_idle: 10- max_open: 100--storage:- type: "local"- local_path: "./data/storage"- base_url: "http://localhost:5678/static"--ai:- default_text_provider: "openai"- default_image_provider: "openai"- default_video_provider: "doubao"```-**Key Configuration Items:**--- `app.debug`: Debug mode switch (recommended true for development)-- `server.port`: Service port-- `server.cors_origins`: Allowed CORS origins for frontend-- `database.path`: SQLite database file path-- `storage.local_path`: Local file storage path-- `storage.base_url`: Static resource access URL-- `ai.default_*_provider`: AI service provider configuration (API keys configured in Web UI)+当前运行时的 provider 配置主要来自 Web 设置页数据库配置,但 `config.example.yaml` 仍然可作为本地参考。-### 📥 Installation+### 3. 启动后端```bash-# Clone the project-git clone https://github.com/chatfire-AI/huobao-drama.git-cd huobao-drama--# Install Go dependencies-go mod download--# Install frontend dependencies-cd web-npm install-cd ..-```--### 🎯 Starting the Project--#### Method 1: Development Mode (Recommended)--**Frontend and backend separation with hot reload**--```bash-# Terminal 1: Start backend service-go run main.go--# Terminal 2: Start frontend dev server-cd web+cd backendnpm run dev```-- Frontend: `http://localhost:3012`-- Backend API: `http://localhost:5678/api/v1`-- Frontend automatically proxies API requests to backend+默认地址:-#### Method 2: Single Service Mode+- `http://localhost:5679`-**Backend serves both API and frontend static files**+### 4. 启动前端```bash-# 1. Build frontend-cd web-npm run build-cd ..--# 2. Start service-go run main.go+cd frontend+npm run dev```-Access: `http://localhost:5678`--### 🗄️ Database Initialization--Database tables are automatically created on first startup (using GORM AutoMigrate), no manual migration needed.-------## 📦 Deployment--### ☁️ Cloud One-Click Deployment (Recommended 3080Ti)+默认地址:-👉 [优云智算,一键部署](https://www.compshare.cn/images/fScvzK95NUk5?referral_code=8hUJOaWz3YzG64FI2OlCiB&ytag=GPU_YY_YX_GitHub_huobaoai)+- `http://localhost:3013`-> ⚠️ **Note**: Please save your data to local storage promptly when using cloud deployment+开发模式下前端会代理:------### 🐳 Docker Deployment (Recommended)--#### Method 1: Docker Compose (Recommended)+- `/api`+- `/static`-#### 🚀 China Network Acceleration (Optional)+到后端服务。-If you are in China, pulling Docker images and installing dependencies may be slow. You can speed up the build process by configuring mirror sources.+## 构建与运行-**Step 1: Create environment variable file**+### 前端静态导出```bash-cp .env.example .env+cd frontend+npm run generate```-**Step 2: Edit `.env` file and uncomment the mirror sources you need**--```bash-# Enable Docker Hub mirror (recommended)-DOCKER_REGISTRY=docker.1ms.run/--# Enable npm mirror-NPM_REGISTRY=https://registry.npmmirror.com/+当前前端是 Nuxt SPA 模式。+如果你希望后端直接托管前端静态资源,使用 `npm run generate`,输出目录为:-# Enable Go proxy-GO_PROXY=https://goproxy.cn,direct+- `frontend/dist`-# Enable Alpine mirror-ALPINE_MIRROR=mirrors.aliyun.com-```--**Step 3: Build with docker compose (required)**+### 后端类型检查```bash-docker compose build+cd backend+npm run typecheck```-> **Important Note**:->-> - ⚠️ You must use `docker compose build` to automatically load mirror source configurations from the `.env` file-> - ❌ If using `docker build` command, you need to manually pass `--build-arg` parameters-> - ✅ Always recommended to use `docker compose build` for building--**Performance Comparison**:--| Operation | Without Mirrors | With Mirrors |-| ---------------- | --------------- | ------------ |-| Pull base images | 5-30 minutes | 1-5 minutes |-| Install npm deps | May fail | Fast success |-| Download Go deps | 5-10 minutes | 30s-1 minute |--> **Note**: Users outside China should not configure mirror sources, use default settings.+### 后端启动```bash-# Start services-docker-compose up -d--# View logs-docker-compose logs -f--# Stop services-docker-compose down-```--#### Method 2: Docker Command--> **Note**: Linux users need to add `--add-host=host.docker.internal:host-gateway` to access host services--```bash-# Run from Docker Hub-docker run -d \- --name huobao-drama \- -p 5678:5678 \- -v $(pwd)/data:/app/data \- --restart unless-stopped \- huobao/huobao-drama:latest--# View logs-docker logs -f huobao-drama+cd backend+npm start```-**Local Build** (optional):--```bash-docker build -t huobao-drama:latest .-docker run -d --name huobao-drama -p 5678:5678 -v $(pwd)/data:/app/data huobao-drama:latest-```--**Docker Deployment Advantages:**--- ✅ Ready to use with default configuration-- ✅ Environment consistency, avoiding dependency issues-- ✅ One-click start, no need to install Go, Node.js, FFmpeg-- ✅ Easy to migrate and scale-- ✅ Automatic health checks and restarts-- ✅ Automatic file permission handling--#### 🔗 Accessing Host Services (Ollama/Local Models)+## 生产运行模式-The container is configured to access host services using `http://host.docker.internal:PORT`.+### 前后端分离模式-**Configuration Steps:**+- 前端:`cd frontend && npm run preview`+- 后端:`cd backend && npm start`-1. **Start service on host (listen on all interfaces)**+### 单服务模式- ```bash- export OLLAMA_HOST=0.0.0.0:11434 && ollama serve- ```--2. **Frontend AI Service Configuration**- - Base URL: `http://host.docker.internal:11434/v1`- - Provider: `openai`- - Model: `qwen2.5:latest`-------### 🏭 Traditional Deployment--#### 1. Build+如果希望后端直接提供前端页面:```bash-# 1. Build frontend-cd web-npm run build-cd ..--# 2. Compile backend-go build -o huobao-drama .-```--Generated files:--- `huobao-drama` - Backend executable-- `web/dist/` - Frontend static files (embedded in backend)--#### 2. Prepare Deployment Files--Files to upload to server:+cd frontend+npm run generate-```-huobao-drama # Backend executable-configs/config.yaml # Configuration file-data/ # Data directory (optional, auto-created on first run)-```--#### 3. Server Configuration--```bash-# Upload files to server-scp huobao-drama user@server:/opt/huobao-drama/-scp configs/config.yaml user@server:/opt/huobao-drama/configs/--# SSH to server-ssh user@server--# Modify configuration file-cd /opt/huobao-drama-vim configs/config.yaml-# Set mode to production-# Configure domain and storage path--# Create data directory and set permissions (Important!)-# Note: Replace YOUR_USER with actual user running the service (e.g., www-data, ubuntu, deploy)-sudo mkdir -p /opt/huobao-drama/data/storage-sudo chown -R YOUR_USER:YOUR_USER /opt/huobao-drama/data-sudo chmod -R 755 /opt/huobao-drama/data--# Grant execute permission-chmod +x huobao-drama--# Start service-./huobao-drama+cd ../backend+npm start```-#### 4. Manage Service with systemd+当前后端静态托管前端目录:-Create service file `/etc/systemd/system/huobao-drama.service`:+- `frontend/dist`-```ini-[Unit]-Description=Huobao Drama Service-After=network.target+## 数据库-[Service]-Type=simple-User=YOUR_USER-WorkingDirectory=/opt/huobao-drama-ExecStart=/opt/huobao-drama/huobao-drama-Restart=on-failure-RestartSec=10+当前默认数据库文件:-# Environment variables (optional)-# Environment="GIN_MODE=release"+- `data/huobao_drama.db`-[Install]-WantedBy=multi-user.target-```+后端现在支持从空数据库文件启动,并自动初始化基础表。-Start service:+如果需要改路径:```bash-sudo systemctl daemon-reload-sudo systemctl enable huobao-drama-sudo systemctl start huobao-drama-sudo systemctl status huobao-drama+DB_PATH=/absolute/path/to/your.db npm start```-**⚠️ Common Issue: SQLite Write Permission Error**+## 文件存储-If you encounter `attempt to write a readonly database` error:+生成资源默认写入:-```bash-# 1. Check current user running the service-sudo systemctl status huobao-drama | grep "Main PID"-ps aux | grep huobao-drama+- `data/static/images`+- `data/static/videos`+- `data/static/audio`+- `data/static/subtitles`+- `data/static/composed`+- `data/static/merged`+- `data/static/grid-cells`-# 2. Fix permissions (replace YOUR_USER with actual username)-sudo chown -R YOUR_USER:YOUR_USER /opt/huobao-drama/data-sudo chmod -R 755 /opt/huobao-drama/data+后端通过:-# 3. Verify permissions-ls -la /opt/huobao-drama/data-# Should show owner as the user running the service+- `/static/*`-# 4. Restart service-sudo systemctl restart huobao-drama-```+对外提供访问。-**Reason:**+## AI 服务配置-- SQLite requires write permission on both the database file **and** its directory-- Needs to create temporary files in the directory (e.g., `-wal`, `-journal`)-- **Key**: Ensure systemd `User` matches data directory owner+在设置页中配置 provider。-**Common Usernames:**+当前支持的服务分类:-- Ubuntu/Debian: `www-data`, `ubuntu`-- CentOS/RHEL: `nginx`, `apache`-- Custom deployment: `deploy`, `app`, current logged-in user+- 文本+- 图片+- 视频+- 音频-#### 5. Nginx Reverse Proxy+设置页内还提供:-```nginx-server {- listen 80;- server_name your-domain.com;+- 火宝一键配置- location / {- proxy_pass http://localhost:5678;- proxy_set_header Host $host;- proxy_set_header X-Real-IP $remote_addr;- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;- }+用于快速初始化默认服务配置。- # Direct access to static files- location /static/ {- alias /opt/huobao-drama/data/storage/;- }-}-```+## Agents 与 Skills----+当前运行时 agent:-## 🎨 Tech Stack+- `script_rewriter`+- `extractor`+- `storyboard_breaker`+- `voice_assigner`+- `grid_prompt_generator`-### Backend+Skills 存放在:-- **Language**: Go 1.23+-- **Web Framework**: Gin 1.9+-- **ORM**: GORM-- **Database**: SQLite-- **Logging**: Zap-- **Video Processing**: FFmpeg-- **AI Services**: OpenAI, Gemini, Doubao, etc.+- `skills/`-### Frontend+后端会在运行时按 agent 类型加载对应 skill,并拼接进最终 agent instructions。-- **Framework**: Vue 3.4+-- **Language**: TypeScript 5+-- **Build Tool**: Vite 5-- **UI Components**: Element Plus-- **CSS Framework**: TailwindCSS-- **State Management**: Pinia-- **Router**: Vue Router 4+## 媒体链路说明-### Development Tools+### 图片生成-- **Package Management**: Go Modules, npm-- **Code Standards**: ESLint, Prettier-- **Version Control**: Git+- 本地参考图在需要时会转成 base64 再发给 provider+- 单镜头图片会自动带入场景图、角色图、镜头参考图----+### 配音生成-## 📝 FAQ+- `无`+- `无对白`+- `环境音`+- `音效`+- `BGM`-### Q: How can Docker containers access Ollama on the host?+这类内容会自动跳过,不进入 TTS 生成-A: Use `http://host.docker.internal:11434/v1` as Base URL. Note two things:+### 视频生成-1. Host Ollama needs to listen on `0.0.0.0`: `export OLLAMA_HOST=0.0.0.0:11434 && ollama serve`-2. Linux users using `docker run` need to add: `--add-host=host.docker.internal:host-gateway`+- 支持包括 Volcengine / Seedance 在内的 provider adapter+- 本地参考图会在发送前转换成 provider 可接受的格式-See: [DOCKER_HOST_ACCESS.md](docs/DOCKER_HOST_ACCESS.md)+### 视频合成与拼接-### Q: FFmpeg not installed or not found?+- 单镜头合成使用 FFmpeg+- 如果本机 FFmpeg 不支持字幕烧录 filter,会自动降级为视频 + 音频合成+- 整集拼接现在要求使用已合成镜头,并统一转码,稳定性更高-A: Ensure FFmpeg is installed and in the PATH environment variable. Verify with `ffmpeg -version`.+## 主要 API 分组-### Q: Frontend cannot connect to backend API?+关键路由包括:-A: Check if backend is running and port is correct. In development mode, frontend proxy config is in `web/vite.config.ts`.+- `/api/v1/dramas`+- `/api/v1/episodes`+- `/api/v1/storyboards`+- `/api/v1/characters`+- `/api/v1/scenes`+- `/api/v1/images`+- `/api/v1/videos`+- `/api/v1/compose`+- `/api/v1/merge`+- `/api/v1/grid`+- `/api/v1/agent`+- `/api/v1/ai-configs`+- `/api/v1/ai-voices`-### Q: Database tables not created?+Webhook 路由:-A: GORM automatically creates tables on first startup, check logs to confirm migration success.+- `/webhooks`----+## 开源说明-## 📋 Changelog+当前仓库已做过一轮开源清理:-### v1.0.5 (2026-02-06)+- 运行期内容数据已清空+- 生成静态资源已清空+- 默认本地数据库已切换为新的 `huobao_drama.db`-#### 🎨 Major Features+发布前仍建议自行检查:-- **🎭 Global Style System**: Introduced comprehensive style selection support across the entire project. Users can now define custom visual styles at the drama level, which automatically applies to all AI-generated content including characters, scenes, and storyboards, ensuring consistent artistic direction throughout the production.+- `.env`+- 本地配置覆盖+- API Key+- 本地数据库快照-- **✂️ Nine-Grid Sequence Image Cropping**: Added cropping tool for action sequence images. Users can now extract individual frames from 3x3 grid layouts and designate them as first frames, last frames, or keyframes for video generation, providing greater flexibility in shot composition and continuity.+## 更新日志-#### 🚀 Enhancements+### v2.0.0-- **📐 Optimized Action Sequence Grid**: Enhanced the visual quality and layout of nine-grid action sequence images with improved spacing, alignment, and frame transitions.+这是火宝短剧当前 TypeScript 版本的开源基线版本。-- **🔧 Manual Grid Assembly**: Introduced manual grid composition tools supporting 2x2 (four-grid), 2x3 (six-grid), and 3x3 (nine-grid) layouts, allowing users to create custom action sequences from individual frames.+`2.0.0` 主要更新:-- **🗑️ Content Management**: Added delete functionality for both generated images and videos, enabling better asset organization and storage management.+- 项目迁移到当前 TypeScript 技术栈+ - Hono 后端+ - Drizzle + better-sqlite3+ - Nuxt 3 工作台前端+- 重做单集工作台 UI 和生产流程+ - 更紧凑的控制台布局+ - 重做分镜编辑区+ - 重做配音、镜头图、视频、合成、导出界面+- 增加运行时 skill 加载+- 扩展多种媒体 provider adapter+ - Gemini+ - OpenAI 兼容图片接口+ - MiniMax+ - Volcengine / Seedance+ - Ali+- 增加宫格图生成、切分和重新分配流程+- 完善 agent / 图片 / 音频 / 视频 / 合成 / 拼接日志+- 优化本地文件处理+ - 本地参考图按需转码+ - 默认数据库切换为 `data/huobao_drama.db`+- 完成开源版运行数据清理-### v1.0.4 (2026-01-27)+## 🤝 贡献指南-#### 🚀 Major Updates+欢迎提交 Issue 和 Pull Request。-- Introduced local storage strategy for generated content caching, effectively mitigating external resource link expiration risks-- Implemented Base64 encoding for embedded reference image transmission-- Fixed issue where shot image prompt state was not reset when switching shots-- Fixed issue where video duration displayed as 0 when adding library videos-- Added scene migration to episodes+建议流程:-#### Historical Data Migration+1. Fork 仓库+2. 创建功能分支+3. 完成修改+4. 运行相关检查+5. 提交 Pull Request-- Added migration script for processing historical data. For detailed instructions, please refer to [MIGRATE_README.md](MIGRATE_README.md)+常用检查命令:-### v1.0.3 (2026-01-16)+```bash+cd backend+npm run typecheck-#### 🚀 Major Updates+cd ../frontend+npm run build+```-- Pure Go SQLite driver (`modernc.org/sqlite`), supports `CGO_ENABLED=0` cross-platform compilation-- Optimized concurrency performance (WAL mode), resolved "database is locked" errors-- Docker cross-platform support for `host.docker.internal` to access host services-- Streamlined documentation and deployment guides+## API 配置站点-### v1.0.2 (2026-01-14)+2 分钟完成配置:[API 聚合站点](https://api.chatfire.site/models)-#### 🐛 Bug Fixes / 🔧 Improvements+----- Fixed video generation API response parsing issues-- Added OpenAI Sora video endpoint configuration-- Optimized error handling and logging+## 👨💻 关于我们----+**AI 火宝 - AI 工作室创业中**-## 🤝 Contributing+- 🏠 **位置**: 中国南京+- 🚀 **状态**: 创业中+- 📧 **Email**: [[email protected]](mailto:[email protected])+- 🐙 **GitHub**: [https://github.com/chatfire-AI/huobao-drama](https://github.com/chatfire-AI/huobao-drama)-Issues and Pull Requests are welcome!+> _"让 AI 帮我们做更有创造力的事"_-1. Fork this project-2. Create a feature branch (`git checkout -b feature/AmazingFeature`)-3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)-4. Push to the branch (`git push origin feature/AmazingFeature`)-5. Open a Pull Request+### 📢 招聘信息----+#### 全栈高级开发工程师(Base 南京)-## API Configuration Site+**关于岗位:**-Configure in 2 minutes: [API Aggregation Site](https://api.chatfire.site/models)+我们是创业团队,致力于打造 AI 驱动的终端应用。如果你热爱技术、追求极致,渴望在 AI 领域有所作为,欢迎加入我们,一起做有意义的事!----+**岗位要求:**-## 👨💻 About Us+1. 参与 AI 驱动的终端应用全栈开发,覆盖 Web/移动端前后端系统搭建,主导核心业务模块的设计、开发、测试与上线迭代。+2. 负责核心功能模块开发,包括:前端交互实现(React/Vue.js + TypeScript)、后端服务开发(Python/Node.js + Flask/FastAPI),确保模块高效、稳定、可扩展。+3. 负责 AI 模型服务接口设计与对接,参与 AI 能力落地终端场景的技术方案设计,推动 AI 技术与业务场景的深度融合。+4. 深度践行 vibe coding 开发模式,注重代码质量、开发效率与技术美感,搭建规范的开发流程,推动团队研发模式优化。-**AI Huobao - AI Studio Startup**+**加入我们:**-- 🏠 **Location**: Nanjing, China-- 🚀 **Status**: Startup in Progress-- 📧 **Email**: [[email protected]](mailto:[email protected])-- 🐙 **GitHub**: [https://github.com/chatfire-AI/huobao-drama](https://github.com/chatfire-AI/huobao-drama)+如果你对 AI 技术充满热情,喜欢挑战和创新,欢迎投递简历至 [[email protected]](mailto:[email protected])-> _"Let AI help us do more creative things"_+期待志同道合的你一起探索 AI 的无限可能!-## Community Group+## 项目交流群-+-- Submit [Issue](../../issues)-- Email project maintainers+- 提交 [Issue](../../issues)+- 发送邮件至项目维护者---<div align="center">-**⭐ If this project helps you, please give it a Star!**+**⭐ 如果这个项目对你有帮助,请给一个 Star!**## Star History[](https://www.star-history.com/#chatfire-AI/huobao-drama&type=date&legend=top-left)-Made with ❤️ by Huobao Team-</div>+</div>\ No newline at end of file