📅 分析日期:2026-06-05 📌 对比项目:你的项目 vs Pixelle-Video
| 能力 | 你的项目 | Pixelle-Video | 优势方 |
|---|---|---|---|
| 多供应商注册 | ✅ ProviderRegistry | ❌ 单供应商 | 你的 |
| 熔断保护 | ✅ Circuit Breaker | ❌ 无 | 你的 |
| 自动故障切换 | ✅ 30s 健康检查 | ❌ 无 | 你的 |
| 额度管理 | ✅ 额度追踪 | ❌ 无 | 你的 |
| 上下文追踪 | ✅ AsyncLocalStorage | ❌ 无 | 你的 |
| 策略模式 | ✅ 多种生成策略 | ✅ Pipeline 模式 | 平手 |
| 结构化输出 | ✅ Pydantic | ✅ Pydantic | 平手 |
你的实现 (services/llm/provider.registry.ts):
// 多供应商注册,自动故障切换
_registry.register(provider, {
enabled: true,
breakerConfig: {
name: `${vendorKey}-llm`,
failureThreshold: 3, // 3次失败触发熔断
cooldownMs: 60000, // 60秒冷却
},
});
// 定时健康检查,自动恢复
setInterval(async () => {
const broken = registry.listBroken();
for (const node of broken) {
if (node.breaker.getState() === 'HALF_OPEN') {
const healthy = await node.provider.healthCheck?.();
if (healthy) node.breaker.reset();
}
}
}, 30_000);
Pixelle-Video 实现:
# 简单直接调用,无容错
response = await client.chat.completions.create(
model=final_model,
messages=[{"role": "user", "content": prompt}],
)
优势:
你的实现 (services/llm-context.ts):
import { AsyncLocalStorage } from 'async_hooks';
const storage = new AsyncLocalStorage<LlmContext>();
interface LlmContext {
userId?: number;
bookId?: number;
chapterId?: number;
}
// 所有 LLM/TTS 调用自动携带上下文
export async function runWithContext<T>(
ctx: LlmContext,
fn: () => Promise<T>,
): Promise<T> {
return storage.run(ctx, fn);
}
// 用法示例
await runWithContext({ bookId: 17, chapterId: 5 }, async () => {
await callLLMWithMessages(...); // 自动携带 bookId
await ttsProvider.synthesize(...); // 自动携带 chapterId
});
Pixelle-Video:
优势:
你的实现 (modules/tts/tts.service.ts):
// 情感关键词库
const EMOTION_KEYWORDS = [
{ emotion: 'fearful', keywords: ['恐怖', '可怕', '惊悚', '恐惧', ...] },
{ emotion: 'sad', keywords: ['悲伤', '难过', '哭泣', ...] },
{ emotion: 'angry', keywords: ['愤怒', '生气', '怒火', ...] },
{ emotion: 'happy', keywords: ['快乐', '开心', '幸福', ...] },
];
// 场景关键词库
const SCENE_KEYWORDS = [
{ scene: '新闻播报', keywords: ['新闻', '报道', '记者', ...] },
{ scene: '儿童内容', keywords: ['童话', '儿童', '小朋友', ...] },
{ scene: '广告促销', keywords: ['促销', '优惠', '折扣', ...] },
{ scene: '比赛解说', keywords: ['比赛', '进球', '冠军', ...] },
];
// 自动检测并调整 TTS 参数
function detectEmotion(text: string): string { ... }
function detectScene(text: string): string { ... }
Pixelle-Video:
优势:
你的实现 (modules/book-generator/):
// 多种生成策略
const strategies = {
'sequential': '串行生成',
'one-step-outline': '一步大纲 + 并行内容',
'per-chapter': '逐章内聚',
'deep-plan-parallel': 'DeepPlan + RichOutline + 并行编辑', // 当前推荐
};
// DAG 工作流
const graph = {
nodes: [
'deep-plan', // 深度规划
'rich-outline', // 丰富大纲
'write-chapters', // 并行写作
'continuity-edit' // 连续性编辑
],
edges: [
{ from: 'deep-plan', to: 'rich-outline' },
{ from: 'rich-outline', to: 'write-chapters' },
{ from: 'write-chapters', to: 'continuity-edit' },
]
};
Pixelle-Video:
优势:
你的实现 (modules/tts/tts.service.ts):
// 10个统一音色 ID,前端使用
const UNIFIED_VOICES = [
{ id: 'voice_01', name: '温柔女声', gender: 'female' },
{ id: 'voice_02', name: '磁性男声', gender: 'male' },
// ... 10个音色
];
// 统一音色 → 不同供应商的映射
const ALIYUN_VOICE_MAP = { voice_01: 'longanyang', ... };
const EDGE_VOICE_MAP = { voice_01: 'zh-CN-XiaoxiaoNeural', ... };
// 自动映射到实际供应商音色
function mapToProviderVoice(unifiedVoiceId: string, providerVendor: string): string {
if (providerVendor === 'edge') return EDGE_VOICE_MAP[unifiedVoiceId];
return ALIYUN_VOICE_MAP[unifiedVoiceId];
}
Pixelle-Video:
优势:
你的实现 (nodes/continuity-edit.node.ts):
// 章节间连续性保证
async function continuityEdit(chapters: Chapter[]) {
// 1. 提取每个章节的关键信息
const summaries = await Promise.all(
chapters.map(ch => summarize(ch.content))
);
// 2. 确保情节/人物/设定在章节间一致
const consistency = await checkConsistency(summaries);
// 3. 修正不一致之处
if (consistency.issues.length > 0) {
await fixInconsistencies(chapters, consistency.issues);
}
}
Pixelle-Video:
优势:
| 能力 | 你的项目 | Pixelle-Video | 优势方 |
|---|---|---|---|
| 多供应商 | ✅ Edge + 阿里云 | ⚠️ Edge + ComfyUI | 你的 |
| 音色数量 | ✅ 10+ 固定音色 | ❌ 无统一管理 | 你的 |
| 情感识别 | ✅ 7种情感 | ❌ 无 | 你的 |
| 场景适配 | ✅ 6种场景 | ❌ 无 | 你的 |
| 语速调节 | ✅ 支持 | ✅ 支持 | 平手 |
| 长文本 | ✅ 分段处理 | ⚠️ 基本支持 | 你的 |
| 实时 TTS | ✅ 通义千问实时 | ❌ 无 | 你的 |
| 音色映射 | ✅ 统一抽象层 | ❌ 无 | 你的 |
| # | 优势 | 竞争力 |
|---|---|---|
| 1 | ProviderRegistry + 熔断 | 企业级可靠性 |
| 2 | AsyncLocalStorage 追踪 | 精确计费/配额 |
| 3 | TTS 情感/场景识别 | 更自然的语音 |
| 4 | 多策略书籍生成 | 灵活适配场景 |
| 5 | 统一音色抽象层 | 易用性 + 可扩展 |
| 6 | 章节连续性编辑 | 高质量长内容 |