Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 153 additions & 0 deletions demohouse/multimedia/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# 电商营销视频生成 E-commerce Marketing Video Generation

## 应用介绍

> 本项目通过支持 A2A 的 Multi-Agent 实现电商营销视频生成,该系统由营销策划、视频导演、评估、合成与发布 4 个 Agent 组成,提供从视频创意构思、高质量视频生成、到视频上线发布的端到端解决方案。面向需要快速、批量化生产营销短视频的电商客户或营销团队,旨在降低视频制作门槛,提高营销内容生产效率。


### 费用说明

| 相关服务 | 描述 | 计费说明 |
|-------------------------------------------------------------------------------------------------------------|-------------------| --- |
| [Doubao-Seed-1.6](https://console.volcengine.com/ark/region:ark+cn-beijing/model/detail?Id=doubao-seed-1-6) | 负责理解用户信息并转化为工具调用。 | [多种计费方式](https://www.volcengine.com/docs/82379/1099320)
| [Doubao-Seedance 1.0 pro](https://console.volcengine.com/ark/region:ark+cn-beijing/model/detail?Id=doubao-seedance-1-0-pro) | 负责将图片和文字描述转为视频。 | [多种计费方式](https://www.volcengine.com/docs/82379/1099320) |\
| [Doubao-Seedream 4.5 pro](https://console.volcengine.com/ark/region:ark+cn-beijing/model/detail?Id=doubao-seedream-4-5) | 负责根据文字或参考图生成图片 | [多种计费方式](https://www.volcengine.com/docs/82379/1099320) |\


## 环境准备

开始前,请确保您的开发环境满足以下要求:

- Python 3.10 或更高版本
- VeADK 0.2.28 或更高版本
- Playwright 1.55.0 或更高版本
- 推荐使用 `uv` 进行依赖管理
- <a target="_blank" href="https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey">获取火山方舟 API KEY</a>
- <a target="_blank" href="https://console.volcengine.com/iam/keymanage/">获取火山引擎 AK/SK</a>

## 快速入门

请按照以下步骤在本地部署和运行本项目。

### 1. 下载代码并安装依赖

```bash
# 克隆代码仓库
# git clone ...
# cd ...

# 安装项目依赖
uv sync
```

### 2. 配置环境变量

本项目包含多个 Agent,每个 Agent 都需要独立的配置。请参考 `config.yaml.example` 文件为每个 Agent 创建 `config.yaml` 并填入必要的密钥信息。

以 `director-agent` 为例:
```bash
# 进入 director-agent 目录
cd app/director-agent

# 复制配置文件
cp config.yaml.example config.yaml
```
然后,编辑 `config.yaml` 文件,填入您的火山方舟 API Key、火山引擎 AK/SK 等信息。请为 `market-agent`、`evaluate-agent`、`release-agent`、`multimedia-agent` 重复此操作。

具体配置项可参考 <a target="_blank" href="https://github.com/volcengine/veadk-python/blob/main/config.yaml.full">veadk-python config.yaml 配置文档</a>。

### 3. 安装 Playwright 浏览器组件

`market-agent` 需要 Playwright 来解析网页内容。

```bash
# market-agent
# 安装 Playwright 浏览器依赖
playwright install
```

### 4. 启动服务

请按顺序启动各个 Agent 服务。

```bash
# 激活虚拟环境
# Windows (Powershell)
# .\.venv\Scripts\activate
# macOS/Linux
# source .venv/bin/activate

# 启动 market-agent
cd backend/app/market-agent/src
python -m uvicorn app:app --host 127.0.0.1 --port 8000 --loop asyncio

# 启动 director-agent
cd backend/app/director-agent/src
python -m uvicorn app:app --host 127.0.0.1 --port 8001 --loop asyncio

# 启动 evaluate-agent
cd backend/app/evaluate-agent/src
python -m uvicorn app:app --host 127.0.0.1 --port 8002 --loop asyncio

# 启动 release-agent
cd backend/app/release-agent/src
python -m uvicorn app:app --host 127.0.0.1 --port 8003 --loop asyncio

# 最后启动 multimedia-agent
cd backend/app/multimedia-agent/src
python -m uvicorn server:app --host 127.0.0.1 --port 8004 --loop asyncio

# 启动 short_link 服务
cd backend/app/short_link
python -m uvicorn app:app --host 127.0.0.1 --port 8005 --loop asyncio
```

### 5. 测试服务

所有服务启动后,可运行测试脚本验证。

```bash
python backend/app/main.py
```

**示例提示词:**
- `根据https://...这个网站中的商品信息,给我生成一段视频`


## 技术实现

本项目核心为一套基于 VeADK 构建的多 Agent 协作框架。各 Agent 职责明确,通过 A2A (Agent-to-Agent) 通信协同工作,完成从需求理解到视频发布的完整流程。

- **营销策划 Agent (`market-agent`)**: 负责解析用户输入(如商品链接),进行市场分析并形成初步的营销策略和视频创意。
- **视频导演 Agent (`director-agent`)**: 根据营销策略,生成具体的视频脚本、文案,并调用多模态能力(文生图、图生视频)产出视频素材。
- **评估 Agent (`evaluate-agent`)**: 对生成的视频素材进行质量评估和筛选,通过自主评测机制进行抽卡优化,确保视频质量。
- **合成与发布 Agent (`release-agent`)**: 将筛选后的素材合成为最终视频,并提供发布能力。

## 目录结构

```
/
├── README.md # 本文档
├── backend/app/
│ ├── __init__.py
│ ├── director-agent/ # 视频导演Agent
│ │ ├── config.yaml.example # 配置文件示例
│ │ └── src/ # Agent源码
│ ├── evaluate-agent/ # 评估Agent
│ │ ├── config.yaml.example
│ │ └── src/
│ ├── main.py # 测试用主程序
│ ├── market-agent/ # 营销策划Agent
│ │ ├── config.yaml.example
│ │ └── src/
│ ├── multimedia-agent/ # 主Agent,负责协调其他Agent
│ │ ├── config.yaml.example
│ │ └── src/
│ ├── release-agent/ # 发布Agent
│ │ ├── config.yaml.example
│ │ └── src/
│ └── short_link/ # 视频短链接生成工具
│ ├── app.py
│ └── requirements.txt
└── ... (其他项目文件)
```
191 changes: 191 additions & 0 deletions demohouse/multimedia/backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
uv.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

# Ruff stuff:
.ruff_cache/

# PyPI configuration file
.pypirc
/src/logs/

# Deepeval
.deepeval/

# MacOS dev
.DS_Store
**/config.yaml

# docs
**/node_modules/

# 忽略所有 .temp 目录
**/.temp/

**/tmp-json/
/app/merged_videos/
11 changes: 11 additions & 0 deletions demohouse/multimedia/backend/app/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
# Licensed under the 【火山方舟】原型应用软件自用许可协议
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.volcengine.com/docs/82379/1433703
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

10 changes: 10 additions & 0 deletions demohouse/multimedia/backend/app/director-agent/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
# Licensed under the 【火山方舟】原型应用软件自用许可协议
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.volcengine.com/docs/82379/1433703
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Loading