Local-Voice/scratch/project-config.json
2025-11-04 22:38:42 +08:00

264 lines
8.5 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"project_name": "Scratch语音助手",
"description": "基于Python多进程语音系统的简化版Scratch实现",
"version": "1.0.0",
"target_platform": "Scratch 3.0",
"complexity": "初级",
"estimated_time": "2-3小时",
"skills_required": [
"Scratch基础操作",
"变量使用",
"广播消息",
"角色造型切换",
"语音识别和合成"
],
"project_structure": {
"roles": [
{
"name": "MainController",
"type": "controller",
"description": "主控制角色,负责初始化和状态管理",
"costumes": ["controller"],
"scripts": ["initialization", "event_handling"]
},
{
"name": "LiBai",
"type": "character",
"description": "李白角色,诗人风格",
"costumes": ["libai_normal", "libai_speaking", "libai_thinking"],
"personality": {
"style": "文言文,诗意",
"keywords": ["诗", "酒", "朋友", "月亮"],
"greeting": "吾乃李白,字太白,号青莲居士"
},
"responses": {
"诗": "诗歌乃吾之最爱!李白斗酒诗百篇,长安市上酒家眠。",
"酒": "人生得意须尽欢,莫使金樽空对月!来,共饮一杯!",
"朋友": "桃花潭水深千尺,不及汪伦送我情。友情珍贵啊!",
"default": "吾乃李白,今天诗兴大发,想听什么诗?"
}
},
{
"name": "ZhuBajie",
"type": "character",
"description": "猪八戒角色,幽默贪吃",
"costumes": ["zhubajie_normal", "zhubajie_speaking", "zhubajie_hungry"],
"personality": {
"style": "口语化,幽默",
"keywords": ["吃", "睡觉", "师父", "大师兄"],
"greeting": "嘿嘿,俺老猪来也!有什么好吃的吗?"
},
"responses": {
"吃": "嘿嘿,说到吃俺老猪就来劲了!有没有包子馒头?",
"睡觉": "睡个好觉真舒服!师父说我又偷懒了,嘿嘿。",
"师父": "师父真是的,老让俺老猪干活。大师兄呢?",
"default": "俺老猪饿了,有没有好吃的?"
}
},
{
"name": "TangMonk",
"type": "character",
"description": "唐僧角色,慈悲为怀",
"costumes": ["tangseng_normal", "tangseng_speaking", "tangseng_praying"],
"personality": {
"style": "温文尔雅,经常念经",
"keywords": ["佛", "徒弟", "经", "阿弥陀佛"],
"greeting": "阿弥陀佛,善哉善哉。贫僧唐三藏,有何指教?"
},
"responses": {
"佛": "阿弥陀佛。佛法无边,普度众生。善哉善哉。",
"徒弟": "为师有三个徒弟,虽然各有缺点,但都是好心肠。",
"经": "真经取来不易,我们要好好研读,弘扬佛法。",
"default": "阿弥陀佛,施主有何烦心事?"
}
},
{
"name": "ShaMonk",
"type": "character",
"description": "沙僧角色,忠厚老实",
"costumes": ["shaseng_normal", "shaseng_speaking", "shaseng_carrying"],
"personality": {
"style": "简洁朴实,忠诚可靠",
"keywords": ["行李", "大师兄", "二师兄", "干活"],
"greeting": "大师兄说得对。我来扛行李!"
},
"responses": {
"行李": "行李我来扛!大师兄打妖怪,二师兄吃东西,我干活。",
"大师兄": "大师兄孙悟空最厉害了!七十二变,火眼金睛!",
"二师兄": "二师兄猪八戒又偷懒了,师父让他去化缘。",
"default": "我在,我来扛行李。"
}
}
],
"backgrounds": [
{
"name": "MainBackground",
"description": "主界面背景",
"elements": ["title", "character_selector", "conversation_area", "control_buttons"]
}
]
},
"variables": {
"current_character": {
"type": "text",
"default": "libai",
"description": "当前选择的角色"
},
"conversation_state": {
"type": "text",
"default": "idle",
"description": "对话状态idle/recording/processing"
},
"recording_state": {
"type": "text",
"default": "stopped",
"description": "录音状态stopped/recording/processing"
},
"recognition_result": {
"type": "text",
"default": "",
"description": "语音识别结果"
},
"response_text": {
"type": "text",
"default": "",
"description": "生成的回复内容"
}
},
"lists": {
"conversation_history": {
"type": "text",
"description": "对话历史记录"
},
"character_names": {
"type": "text",
"items": ["libai", "zhubajie", "tangseng", "shaseng"],
"description": "角色标识列表"
},
"keywords": {
"type": "text",
"items": ["你好", "谢谢", "再见", "诗", "酒", "吃", "佛", "行李", "师父", "大师兄"],
"description": "关键词列表"
}
},
"broadcasts": {
"setup": "初始化系统",
"start_recording": "开始录音",
"stop_recording": "停止录音",
"change_character": "切换角色",
"show_response": "显示回复",
"clear_conversation": "清除对话",
"switch_to_libai": "切换到李白",
"switch_to_zhubajie": "切换到猪八戒",
"switch_to_tangseng": "切换到唐僧",
"switch_to_shaseng": "切换到沙僧"
},
"implementation_steps": [
{
"step": 1,
"title": "创建项目和角色",
"description": "创建新项目删除默认角色创建5个主要角色",
"tasks": [
"创建MainController控制角色",
"创建李白角色并添加3个造型",
"创建猪八戒角色并添加3个造型",
"创建唐僧角色并添加3个造型",
"创建沙僧角色并添加3个造型"
]
},
{
"step": 2,
"title": "设计背景和界面",
"description": "创建主背景添加UI元素",
"tasks": [
"设计主背景界面",
"添加标题和状态显示区域",
"创建角色选择按钮区域",
"设计对话显示区域"
]
},
{
"step": 3,
"title": "实现变量和列表",
"description": "创建所需的变量和列表",
"tasks": [
"创建5个主要变量",
"创建3个列表并初始化",
"设置变量初始值"
]
},
{
"step": 4,
"title": "实现核心功能",
"description": "实现语音识别和回复生成逻辑",
"tasks": [
"实现主控制器的初始化功能",
"实现语音识别功能",
"实现角色回复逻辑",
"实现角色切换功能"
]
},
{
"step": 5,
"title": "添加交互功能",
"description": "完善用户交互和界面反馈",
"tasks": [
"实现录音按钮功能",
"实现清除对话按钮",
"添加角色点击事件",
"实现对话历史显示"
]
},
{
"step": 6,
"title": "测试和优化",
"description": "测试所有功能并优化用户体验",
"tasks": [
"测试角色切换功能",
"测试语音识别和回复",
"测试对话历史功能",
"优化动画和过渡效果"
]
}
],
"tips": {
"development": [
"建议使用Scratch桌面版开发",
"确保设备有麦克风和扬声器",
"测试时先测试基本功能",
"逐步添加复杂功能"
],
"testing": [
"测试不同网络环境下的语音识别",
"测试角色切换的流畅性",
"验证关键词匹配的准确性",
"测试对话历史功能"
],
"optimization": [
"优化关键词匹配算法",
"添加更多角色回复内容",
"改进语音识别的错误处理",
"增加动画和音效"
]
},
"troubleshooting": {
"voice_recognition_not_working": [
"检查麦克风权限",
"确认网络连接正常",
"尝试重新启动Scratch",
"检查设备音频设置"
],
"character_switch_not_working": [
"检查广播消息拼写",
"确认角色变量设置正确",
"验证角色点击事件",
"检查角色造型存在"
],
"response_generation_slow": [
"简化关键词匹配逻辑",
"减少回复内容的长度",
"优化广播消息处理",
"检查变量和列表使用"
]
}
}