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
111 changes: 111 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,117 @@

---

## [v0.1.5] - 2026-09-29

**主题:AI 助手面板与画布节点视觉升级(BorderBeam 流光描边 + ThinkingOrb 加载球体)、TTS 拖拽与音色选择修复、agentscope 2.0.9 升级与依赖安全下界抬升**

上一版本:`v0.1.4`。本版本无数据库迁移;前端新增 2 个第三方依赖(`border-beam`、`thinking-orbs`)。

### ✨ 新增

#### 输入框描边流光(BorderBeam)

- Agent 生成回复时(`isLoading`),消息输入框外缘出现持续流动的描边光效,停止生成后平滑淡出;`colorVariant="ocean"`、`strength=0.6`,亮/暗主题均适配,不影响输入与响应式布局。

#### 加载指示器升级为 ThinkingOrb 球体动画

- AI 助手面板的三点加载动画(`LoadingDots` / `StreamingIndicator`)统一替换为 `thinking-orbs` 球体动画,按 Agent 阶段动态映射状态:初始响应=`listening`、深度思考=`searching`、生成输出 / Worker 执行=`working`、Leader 调度=`connecting`。
- 采用 `<orb> + <文字>` 并排布局(`flex items-center gap-2`,orb 在左),内联场景 `size=20`;`theme` 跟随应用主题,附 `aria-label` 描述状态。

#### 画布节点 Agent 操作描边流光

- Agent 调用画布工具时,节点卡片的 CSS 脉冲边框升级为 BorderBeam 流光:读取 `reading` / 扫描 `scanning` → ocean、编辑 `updating` → gold、删除 `deleting` → sunset、连线 `connecting` → forest;创建态 `GhostNode` → ocean。
- 保留原图标徽标、背景色与 `reading` 扫描光带;以「绝对定位覆盖层」方式集成(内联 style 覆盖组件默认的 `position:relative`),不裁剪节点外部工具栏 / 缩放手柄 / 下挂面板。

#### orbs-demo 演示页

- 新增 `/demo/orbs-demo`:展示 ThinkingOrb 全 9 种状态(`size` 20 内联 / 64 头像级)与画布节点描边效果,含状态切换、速度调节交互,复用生产组件 `NodeEffectOverlay` / `GhostNode` 保证与真实渲染一致。

### 🔧 改进

- **TTSSkills 音色描述细化**:`generate_tts` 工具定义与 `tts_tools` 技能的音色清单由「仅风格」升级为「按性别分组 + 语气特征」(如女声 `Kore (firm)`、男声 `Charon (informative)`,女 14 / 男 16),Agent 可据角色精准选男/女声;后端对 LLM 可能回传的尾部括注做防御式剥离(`Kore (firm)` → `Kore`),`auto` / 裸名 / 复刻 `voice_` ID 不受影响。
- **TTS 语音卡拖拽**:AI 助手面板生成的语音拖到画布时正确生成 TTS 节点并保留文本 / 音色 / 风格 / 多说话人配置,不再误建为普通音频节点。
- 移除已弃用的 `LoadingDots` 组件及其 barrel 导出、孤立的 `nodeEffectPulse` 关键帧。

### 🐛 修复

- **画布节点类型错误**:TTS 工具生成的音频拖拽到画布被渲染为 `AudioNode` 而非 `TtsNode` —— `TtsTaskCard` 改用 `handleTtsDragStart`(写入 `application/reactflow='tts'`),`dragToCanvas` 新增 tts 节点配置与 TTS 特有字段透传。

### 🔒 依赖与安全

- **9 个后端依赖安全下界抬升**(PR #327,排除已知漏洞版本):`python-multipart>=0.0.32`、`psycopg2-binary>=2.9.12`、`bcrypt>=5.0.0`、`google-genai>=2.10.0`、`ollama>=0.6.2`、`python-frontmatter>=1.3.0`、`packaging>=26.2`、`cachetools>=7.1.4`、`purgatory>=3.0.1`;`redis` 因 arq 0.28 约束维持 `>=5,<6`。
- **agentscope 升级 `>=2.0.4.post1 → >=2.0.9`**;**移除 `ripgrep==14.1.0` 锁定**(自 agentscope 2.0.4 起 ripgrep 为可选依赖,本项目不使用内置 Grep 工具)。
- **不再需要 Rust 工具链**:`dev.py` 移除 Rust 检测、`backend.Dockerfile` 与 README / README_EN / UPGRADE 移除 Rust 1.85+ 要求与安装步骤,本地 / Docker 安装不再触发 cargo 编译。
- **前端新增依赖**:`border-beam@^1.4.1`、`thinking-orbs@^0.3.2`(均零运行时依赖,peer React>=18)。

### ✅ 测试与验证

- 前端 `tsc --noEmit`:新增/改动文件(MessageInput、ChatMessage、Single/MultiAgentPanel、NodeEffectOverlay、GhostNode、dragToCanvas、TtsTaskCard、orbs-demo)零类型错误,仅剩既有 `theater/[id]/page.tsx` 的 OnNodeDrag 基线告警。
- ESLint:新增代码零告警,orbs-demo 页 0 问题。
- 后端 `tts_gen.py` `py_compile` 通过;音色清单断言(女 14 / 男 16 带语气)+ 括注剥离正则离线校验通过。
- 两个 i18n locale(zh-CN / en-US)JSON 合法(Node `JSON.parse` 通过)。

### 📌 升级说明

1. **无需执行数据库迁移**。
2. 前端新增依赖:`cd frontend && npm install`(安装 border-beam、thinking-orbs)后重启 dev server。
3. 后端依赖下界抬升属安全加固,`pip install -r requirements.txt` 按新下界解析;agentscope 升到 2.0.9、不再需要 ripgrep / Rust。
4. **合并提示**:本版本 `requirements.txt` 已并入 main 上 PR #327 的 9 个安全下界,与 main 合并时该文件应干净自动合并(数值一致)。
5. 后端 Python 改动需重启服务生效;纯前端改动热更即可。

### 📁 主要变更文件

**后端**

```
backend/config.py 版本号 0.1.5(单一来源)
backend/requirements.txt agentscope>=2.0.9、移除 ripgrep、9 依赖安全下界
backend/services/tool_manager/providers/tts_gen.py 音色性别+语气描述、防御式括注剥离
backend/skills/{builtin,active}_skills/tts_tools/SKILL.md 音色清单细化
```

**构建 / 脚本 / 文档**

```
dev.py 移除 Rust 工具链检测
deploy/backend.Dockerfile ripgrep 为可选依赖说明,无需 Rust
README.md / README_EN.md 移除 Rust 1.85+ 环境要求
UPGRADE.md 精简,移除 Rust 安装步骤
```

**前端**

```
frontend/package.json / package-lock.json 新增 border-beam、thinking-orbs;版本号 0.1.5
frontend/src/components/ai-assistant/MessageInput.tsx 输入框 BorderBeam 描边流光
frontend/src/components/ai-assistant/ChatMessage.tsx StreamingIndicator → ThinkingOrb(listening)
frontend/src/components/ai-assistant/SingleAgentThinkPanel.tsx LoadingDots → ThinkingOrb(searching)
frontend/src/components/ai-assistant/MultiAgentPanel.tsx LoadingDots → ThinkingOrb(connecting/working)
frontend/src/components/ai-assistant/LoadingDots.tsx 删除
frontend/src/components/ai-assistant/index.ts 移除 LoadingDots 导出
frontend/src/components/ai-assistant/TtsTaskCard.tsx 拖拽生成 TTS 节点
frontend/src/lib/dragToCanvas.ts handleTtsDragStart + tts 节点配置
frontend/src/components/canvas/NodeEffectOverlay.tsx 5 效果脉冲边框 → BorderBeam 流光
frontend/src/components/canvas/GhostNode.tsx 创建态脉冲边框 → BorderBeam 流光
frontend/src/app/globals.css 移除孤立 nodeEffectPulse 关键帧
frontend/src/app/demo/orbs-demo/page.tsx 新增:Orb + 节点描边演示页
frontend/src/i18n/locales/{zh-CN,en-US}.json 状态文案键
```

**管理端**

```
backend/admin/package.json / package-lock.json 版本号 0.1.5
```

**文档**

```
CHANGELOG.md 本文件
```

---

## [v0.1.4] - 2026-09-28

**主题:Gemini TTS 语音合成节点全栈接入(画布节点 + 音色复刻/扩展音色库/试听 + Agent 技能 + 管理端配置)**
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ KunFlix 专为**影视广告与短剧创作**打造的开放式AI内容创作生
### 环境要求

- **Python 3.12+**(AgentScope 2.0 强制要求;旧 3.10 venv 需删除重建)
- **Rust 1.85+**(仅当从源码编译 ripgrep 时需要;首次安装会触发,参见 [UPGRADE.md](./UPGRADE.md))
- Node.js 20+
- Docker 24+(Docker 部署时需要)
- PostgreSQL 18(开发与生产统一;本地可用 `docker compose -f deploy/docker-compose.dev.yml up -d` 一键启动 PostgreSQL + Redis)
Expand Down
1 change: 0 additions & 1 deletion README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ KunFlix is an open AI content creation ecosystem designed for **film advertising
### Prerequisites

- **Python 3.12+** (required by AgentScope 2.0; old 3.10 venvs must be recreated)
- **Rust 1.85+** (only when compiling ripgrep from source; triggered on first install, see [UPGRADE.md](./UPGRADE.md))
- Node.js 20+
- Docker 24+ (required for Docker deployment)
- PostgreSQL 18 (unified for dev & prod; start locally with `docker compose -f deploy/docker-compose.dev.yml up -d` for PostgreSQL + Redis)
Expand Down
100 changes: 16 additions & 84 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
| 组件 | 旧版本 | 新版本 | 是否必装 |
|---|---|---|---|
| **Python** | 3.10+ | **3.11+** | 必须 |
| **Rust toolchain** | 不需要 | **stable ≥ 1.85**(含 cargo) | 仅本地首次安装需要(运行时不依赖) |
| Node.js | 20+ | 20+ | 不变 |
| AgentScope | `1.0.18` | `>=2.0.0` | 由 `requirements.txt` 锁定 |
| AgentScope | `1.0.18` | `>=2.0.9` | 由 `requirements.txt` 锁定 |

**为什么需要 Rust?** AgentScope 2.0 把 [`Grep` 工具](https://docs.agentscope.io/v2/building-blocks/tool.md) 的实现交给了 PyPI 上的 [`ripgrep`](https://pypi.org/project/ripgrep/) 包;这个包在 Linux / macOS 没有预编译 wheel,必须本地用 cargo 编译。**项目运行时不会用到 Grep 工具**,但 ripgrep 是 agentscope 的硬安装依赖,跳不掉。编译只在首次 `pip install` 时一次性发生,之后 wheel 进入 pip 缓存,重装秒过。
**不再需要 Rust。** AgentScope 自 2.0.4 起把 [`ripgrep`](https://pypi.org/project/ripgrep/)(内置 [`Grep` 工具](https://docs.agentscope.io/v2/building-blocks/tool.md) 的实现)改为**可选依赖**,2.0.8 起又将其锁定在 `<15.x`。KunFlix 运行时不使用内置 `Grep` 工具,`requirements.txt` 也已移除对 ripgrep 的显式锁定,因此本地 / Docker 安装都不会再触发 cargo 编译,无需安装 Rust 工具链。

---

Expand All @@ -29,20 +28,16 @@
# 1. 安装 Python 3.12(如已有 3.11+ 可跳过)
winget install -e --id Python.Python.3.12

# 2. 安装 Rust(如已有 stable ≥ 1.85 可跳过)
winget install -e --id Rustlang.Rustup
rustup default stable

# 3. 删旧 venv,用 3.12 重建
# 2. 删旧 venv,用 3.12 重建
Remove-Item -Recurse -Force "$PWD\backend\venv"
& "$env:LOCALAPPDATA\Programs\Python\Python312\python.exe" -m venv backend\venv

# 4. 安装依赖(首次会触发 ripgrep cargo 编译,约 3-8 分钟)
# 3. 安装依赖
$env:PYTHONUTF8="1"; $env:PYTHONIOENCODING="utf-8"
.\backend\venv\Scripts\python.exe -m pip install --upgrade pip
.\backend\venv\Scripts\python.exe -m pip install -r .\backend\requirements.txt

# 5. 验证
# 4. 验证
.\backend\venv\Scripts\python.exe -c "import agentscope; print(agentscope.__version__)"
# 预期:2.0.x
```
Expand All @@ -53,75 +48,23 @@ $env:PYTHONUTF8="1"; $env:PYTHONIOENCODING="utf-8"
brew install python@3.12 # macOS
# Linux: 用包管理器 / pyenv install 3.12

# 2. 安装 Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"

# 3. 重建 venv
# 2. 重建 venv
rm -rf backend/venv
python3.12 -m venv backend/venv

# 4. 安装依赖
# 3. 安装依赖
backend/venv/bin/pip install --upgrade pip
backend/venv/bin/pip install -r backend/requirements.txt

# 5. 验证
# 4. 验证
backend/venv/bin/python -c "import agentscope; print(agentscope.__version__)"
```

之后 `python dev.py` 启动开发环境,[dev.py](./dev.py) 会在启动前自动校验 Python 与 cargo 是否就绪,若 venv 仍是 3.10 会主动提示重建。
之后 `python dev.py` 启动开发环境,[dev.py](./dev.py) 会在启动前自动校验 Python 版本,若 venv 仍是 3.10 会主动提示重建。

---

### 1.3 国内开发者:镜像加速(强烈推荐)

不配镜像,rustup 下载和 cargo 拉 crates.io 索引可能慢到 16 KiB/s。配完后 5–20 MiB/s。

#### rustup 镜像(环境变量,仅当前 shell 生效)

```powershell
$env:RUSTUP_DIST_SERVER = "https://rsproxy.cn"
$env:RUSTUP_UPDATE_ROOT = "https://rsproxy.cn/rustup"
rustup update stable
```

```bash
export RUSTUP_DIST_SERVER="https://rsproxy.cn"
export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup"
rustup update stable
```

#### cargo crates.io 镜像(写入 `~/.cargo/config.toml`,永久生效)

```toml
[source.crates-io]
replace-with = "rsproxy-sparse"

[source.rsproxy-sparse]
registry = "sparse+https://rsproxy.cn/index/"

[net]
git-fetch-with-cli = true
```

PowerShell 一行写好:

```powershell
$cargoDir = "$env:USERPROFILE\.cargo"
New-Item -ItemType Directory -Force -Path $cargoDir | Out-Null
@"
[source.crates-io]
replace-with = "rsproxy-sparse"

[source.rsproxy-sparse]
registry = "sparse+https://rsproxy.cn/index/"

[net]
git-fetch-with-cli = true
"@ | Set-Content "$cargoDir\config.toml" -Encoding UTF8
```

#### pip 镜像
### 1.3 国内开发者:pip 镜像加速(推荐)

`requirements.txt` 默认走 `pypi.tuna.tsinghua.edu.cn`(在 [dev.py](./dev.py) 中通过 `pip config` 已配置)。如果你的环境没配,可手动指定:

Expand All @@ -133,25 +76,18 @@ pip install -r backend/requirements.txt -i https://mirrors.aliyun.com/pypi/simpl

### 1.4 生产 / 测试环境(Docker 路径)

[deploy/backend.Dockerfile](./deploy/backend.Dockerfile) 已经改造为 multi-stage:

| Stage | 作用 | 是否进运行镜像 |
|---|---|---|
| `rust-builder` | 装 Rust + cargo + 编译 ripgrep wheel | 否(仅产出 `/wheels`) |
| `base` | 纯 Python 3.14 + `pip install --no-index --find-links /wheels` | 是(运行镜像) |

**好处**:运行镜像不带 Rust toolchain(节省 ~1GB),且 builder 内置 `rsproxy.cn` 镜像,crate 拉取无需翻墙。
[deploy/backend.Dockerfile](./deploy/backend.Dockerfile) 为**单阶段构建**:基于 `python:3.14-slim`,直接 `pip install -r requirements.txt`。由于 ripgrep 已是 agentscope 可选依赖且项目不使用,镜像内**不再包含 Rust 构建阶段**,构建更快、体积更小。

#### 2c4g 测试 / 生产服务器的部署流程

```bash
cd /opt/kunflix/deploy

# 串行构建(避免 cargo 并发编译爆 CPU/内存)
# 串行构建(避免多镜像并发 build 爆 CPU/内存)
sudo bash scripts/update.sh --serial
```

[deploy/scripts/update.sh](./deploy/scripts/update.sh) 中已有 `--serial` 参数,按 backend → admin → frontend 串行 build,对 2c4g 友好。**首次构建仍会触发 cargo 编译 ripgrep(~5-8 分钟),后续构建命中 BuildKit 缓存秒过。**
[deploy/scripts/update.sh](./deploy/scripts/update.sh) 中已有 `--serial` 参数,按 backend → admin → frontend 串行 build,对 2c4g 友好。


---
Expand All @@ -160,13 +96,9 @@ sudo bash scripts/update.sh --serial

| 报错关键字 | 根因 | 解决 |
|---|---|---|
| `Could not find a version that satisfies agentscope>=2.0.0` | Python < 3.11 | 装 3.11+,删 venv 重建 |
| `Ignored the following versions that require a different python version: 2.0.0 Requires-Python >=3.11` | 同上(pip 静默过滤) | 同上 |
| `feature edition2024 is required` / `not stabilized in this version of Cargo (1.80.x)` | Rust < 1.85 | `rustup update stable` |
| `rustup could not choose a version of cargo to run` | rustup 装了但没设默认 toolchain | `rustup default stable` |
| `Preparing metadata (pyproject.toml) ...` 长时间卡住 | cargo 拉 crates.io 慢 | 配 cargo `rsproxy.cn` 镜像,重新 `pip install` |
| `error: could not create link from rustup.exe to cargo-miri.exe (os error 183)` | rustup self-update 旧 shim 残留(不影响 toolchain 升级) | 忽略;toolchain 已升级 |
| Docker 构建期 OOM | 2c4g 并发跑 cargo 内存不够 | `update.sh --serial`;提前 `docker compose stop frontend admin` 腾资源 |
| `Could not find a version that satisfies agentscope>=2.0.9` | Python < 3.11 | 装 3.11+,删 venv 重建 |
| `Ignored the following versions that require a different python version: ... Requires-Python >=3.11` | 同上(pip 静默过滤) | 同上 |
| Docker 构建期 OOM | 2c4g 并发 build 内存不够 | `update.sh --serial`;提前 `docker compose stop frontend admin` 腾资源 |

---

4 changes: 2 additions & 2 deletions backend/admin/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/admin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "admin-dashboard",
"version": "0.1.4",
"version": "0.1.5",
"private": true,
"scripts": {
"dev": "next dev -p 3888",
Expand Down
2 changes: 1 addition & 1 deletion backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Settings(BaseSettings):
PROJECT_NAME: str = "KunFlix"
# 后端版本号 —— 全项目版本的单一来源,与 frontend/package.json、
# backend/admin/package.json 及 CHANGELOG.md 保持同步
VERSION: str = "0.1.4"
VERSION: str = "0.1.5"

# ---------------------------------------------------------------
# Database
Expand Down
5 changes: 1 addition & 4 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ aiosqlite>=0.22.1
redis[hiredis]>=5.0.0,<6.0.0
websockets>=16.0
python-dotenv>=1.2.1
agentscope>=2.0.4.post1
# ripgrep 15.x 无预编译 Linux wheel 需 Rust 从源码编译(首次构建 30+ min),
# 14.1.0 提供 manylinux wheel,功能上 agentscope 无版本约束,锁定以避免 Rust 工具链
ripgrep==14.1.0
agentscope>=2.0.9
openai>=2.36.0
python-multipart>=0.0.32
aiofiles>=25.1.0
Expand Down
Loading
Loading