Skip to content

anbeime/skill / skills/agentkit-multimedia-shopping/agentkit-multimedia-shopping

agentkit-multimedia-shopping

Verified

电商运营与内容创作者在需要制作带货短视频时,用此技能一键生成9:16竖屏数字人成片。自动编排AI绘画、语音合成与视频生成,快速产出“小省导购员”专属形象与专业配音,让多模态视频制作省时省力。

scripts/generate_voice.py

View on GitHub
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
语音合成脚本
基于ByteDance agentkit-samples多媒体用例
"""

import sys
import os

def generate_voice(text, voice_type="standard", emotion="neutral", format="16khz_mono_wav"):
    """
    合成导购员语音

    Args:
        text (str): 话术内容
        voice_type (str): 语音类型(standard/friendly/professional),默认"standard"
        emotion (str): 情绪基调(enthusiastic/professional/friendly),默认"neutral"
        format (str): 音频格式(16khz_mono_wav),默认"16khz_mono_wav"

    Returns:
        object: 语音文件对象(根据实际工具返回)

    Raises:
        ValueError: 参数验证失败
        Exception: 生成失败
    """
    # 参数验证
    if not text:
        raise ValueError("话术内容不能为空")

    if voice_type not in ["standard", "friendly", "professional"]:
        raise ValueError("语音类型必须是standard/friendly/professional之一")

    if emotion not in ["enthusiastic", "professional", "friendly", "neutral"]:
        raise ValueError("情绪基调必须是enthusiastic/professional/friendly/neutral之一")

    if format != "16khz_mono_wav":
        raise ValueError("音频格式必须是16khz_mono_wav")

    # TODO: 调用实际的TTS工具
    # 这里需要根据ByteDance agentkit-samples的实际实现来调用
    # 示例代码(伪代码):
    #
    # from agentkit import TTSGenerator
    #
    # generator = TTSGenerator()
    # audio = generator.generate(
    #     text=text,
    #     voice_type=voice_type,
    #     emotion=emotion,
    #     format=format
    # )
    #
    # return audio

    # 占位符返回
    print(f"[generate_voice] 合成语音")
    print(f"  话术内容: {text[:50]}...")
    print(f"  语音类型: {voice_type}")
    print(f"  情绪基调: {emotion}")
    print(f"  音频格式: {format}")

    return None


def main():
    """
    主函数:从命令行读取参数并合成语音
    """
    import argparse

    parser = argparse.ArgumentParser(description="合成导购员语音")
    parser.add_argument("--text", type=str, required=True, help="话术内容")
    parser.add_argument("--voice-type", type=str, default="standard", help="语音类型(standard/friendly/professional)")
    parser.add_argument("--emotion", type=str, default="neutral", help="情绪基调(enthusiastic/professional/friendly)")
    parser.add_argument("--format", type=str, default="16khz_mono_wav", help="音频格式(16khz_mono_wav)")
    parser.add_argument("--output", type=str, default="./output/voice.wav", help="输出文件路径")

    args = parser.parse_args()

    try:
        # 合成语音
        voice_file = generate_voice(
            text=args.text,
            voice_type=args.voice_type,
            emotion=args.emotion,
            format=args.format
        )

        # 保存语音文件
        if voice_file:
            # 确保输出目录存在
            output_dir = os.path.dirname(args.output)
            if output_dir and not os.path.exists(output_dir):
                os.makedirs(output_dir)

            voice_file.save(args.output)
            print(f"语音文件已保存至: {args.output}")
        else:
            print("警告: 语音合成返回为空(可能是占位符)")

        return 0

    except ValueError as e:
        print(f"参数错误: {e}", file=sys.stderr)
        return 1
    except Exception as e:
        print(f"生成失败: {e}", file=sys.stderr)
        return 2


if __name__ == "__main__":
    sys.exit(main())
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall