From 53ed155299ed135978208187693a87bae4e4aaf9 Mon Sep 17 00:00:00 2001 From: pulsareonbot Date: Tue, 7 Jul 2026 12:18:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(Live2D):=20=E7=94=A8=E5=AE=8C=E6=95=B4=20do?= =?UTF-8?q?g=20=E9=85=8D=E7=BD=AE=E7=BB=93=E6=9E=84=E7=94=9F=E6=88=90=20li?= =?UTF-8?q?ve2d=5Fanime.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前手写的配置缺少 scenes/triggers/transition 等必需字段导致解析失败。 改为基于 dog_state_machine.json 复制并替换 character 块 + display 块, 保留完整的 playlist/scenes/state_machine 结构,仅修改角色相关字段。 设备验证:--validate 通过,配置切换成功,文字对话正常(小雅人设生效)。 --- configs/live2d_anime.json | 1166 ++++++++++++++++++++++++++++++++++++- 1 file changed, 1143 insertions(+), 23 deletions(-) diff --git a/configs/live2d_anime.json b/configs/live2d_anime.json index 93d4e25..894447f 100644 --- a/configs/live2d_anime.json +++ b/configs/live2d_anime.json @@ -10,43 +10,1163 @@ "prevent_screen_lock": true, "render_width": 800, "render_height": 800, - "output_width": null, - "output_height": null, + "output_width": 1920, + "output_height": 1080, "scale_mode": "stretch", "allow_upscale": true, "perspective_correction": { "enabled": false, - "points": [[0, 0], [800, 0], [800, 800], [0, 800]] + "points": [ + [ + 0, + 0 + ], + [ + 1920, + 0 + ], + [ + 1920, + 1080 + ], + [ + 0, + 1080 + ] + ] }, "chroma_key": { "enabled": false, - "hsv_min": [0, 0, 200], - "hsv_max": [180, 30, 255] + "hsv_min": [ + 0, + 0, + 200 + ], + "hsv_max": [ + 180, + 30, + 255 + ], + "invert": false, + "feather": 3 + }, + "brightness_adjust": { + "enabled": true, + "subject_boost": 2, + "background_suppress": 0.3, + "threshold": 30 } }, - "playback": { - "auto_start": true, - "loop": true, - "volume": 0.8, - "fps": 30 - }, "playlist": [ { - "id": "live2d_idle", + "id": "anim_0", "path": "../../宠物嵌入式开发视频2/1.动画0.mp4", - "loop_count": 0, - "next_state": "idle" + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_1", + "path": "../../宠物嵌入式开发视频2/2.趴着休息/动画1.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_2", + "path": "../../宠物嵌入式开发视频2/2.趴着休息/动画2.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_3", + "path": "../../宠物嵌入式开发视频2/2.趴着休息/动画3.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_4", + "path": "../../宠物嵌入式开发视频2/3.站起来活动/动画4.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_5", + "path": "../../宠物嵌入式开发视频2/3.站起来活动/动画5.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_6", + "path": "../../宠物嵌入式开发视频2/3.站起来活动/动画6.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_7", + "path": "../../宠物嵌入式开发视频2/4.趴下睡觉/动画7.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_8", + "path": "../../宠物嵌入式开发视频2/4.趴下睡觉/动画8.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_9", + "path": "../../宠物嵌入式开发视频2/4.趴下睡觉/动画9.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_10", + "path": "../../宠物嵌入式开发视频2/5.狗舔爪子 动画10.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_11", + "path": "../../宠物嵌入式开发视频2/6.口渴动画/动画11.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_12", + "path": "../../宠物嵌入式开发视频2/6.口渴动画/动画12.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_13", + "path": "../../宠物嵌入式开发视频2/6.口渴动画/动画13.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_14", + "path": "../../宠物嵌入式开发视频2/7.被叫名字1/动画14.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_15", + "path": "../../宠物嵌入式开发视频2/7.被叫名字1/动画15.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_16", + "path": "../../宠物嵌入式开发视频2/7.被叫名字1/动画16.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_17", + "path": "../../宠物嵌入式开发视频2/8.握手/动画17.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_18", + "path": "../../宠物嵌入式开发视频2/9.喂食动画/动画18.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_19", + "path": "../../宠物嵌入式开发视频2/10.喂水动画/动画19.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null + }, + { + "id": "anim_20", + "path": "../../宠物嵌入式开发视频2/11.摸狗狗头/动画22.mp4", + "duration": null, + "loop_count": 1, + "random_loop_range": null } ], - "states": { - "initial": "idle", - "idle": { - "video": "live2d_idle", - "next": "idle", - "loop": true + "transition": { + "enabled": true, + "type": "fade", + "duration": 0.5 + }, + "playback": { + "loop_playlist": true, + "auto_start": true + }, + "scenes": { + "rest": [], + "active": [], + "sleep": [], + "interact": [], + "state_machine": { + "initial_state": "default", + "states": { + "stand_active": { + "name": "站起来活动", + "mode": "free_mode", + "sequence": [ + { + "video_id": "anim_4", + "loop_count": 1, + "random_loop_range": null + }, + { + "video_id": "anim_5", + "loop_count": null, + "random_loop_range": [ + 2, + 10 + ] + }, + { + "video_id": "anim_6", + "loop_count": 1, + "random_loop_range": null + } + ], + "next_state": null, + "next_states": [ + { + "state": "default", + "weight": 1 + }, + { + "state": "rest_lying", + "weight": 1 + }, + { + "state": "sleep", + "weight": 1 + }, + { + "state": "lick_paw", + "weight": 1 + }, + { + "state": "thirsty", + "weight": 1 + } + ], + "transitions": [ + { + "trigger": { + "voice": { + "keyword": "name" + } + }, + "target_state": "called_name", + "priority": 10 + }, + { + "trigger": { + "button": { + "name": "button1" + } + }, + "target_state": "shake_hand", + "priority": 10 + }, + { + "trigger": { + "voice": { + "keyword": "握手" + } + }, + "target_state": "shake_hand", + "priority": 10 + }, + { + "trigger": { + "button": { + "name": "button2" + } + }, + "target_state": "feeding", + "priority": 10 + }, + { + "trigger": { + "voice": { + "keyword": "吃饭" + } + }, + "target_state": "feeding", + "priority": 10 + }, + { + "trigger": { + "button": { + "name": "button3" + } + }, + "target_state": "drinking", + "priority": 10 + }, + { + "trigger": { + "voice": { + "keyword": "喝水" + } + }, + "target_state": "drinking", + "priority": 10 + }, + { + "trigger": { + "sensor": { + "name": "touch" + } + }, + "target_state": "pet_head", + "priority": 10 + } + ], + "weight": 1, + "defer_triggers": true, + "ignore_triggers": false + }, + "sleep": { + "name": "趴下睡觉", + "mode": "free_mode", + "sequence": [ + { + "video_id": "anim_7", + "loop_count": 1, + "random_loop_range": null + }, + { + "video_id": "anim_8", + "loop_count": null, + "random_loop_range": [ + 25, + 100 + ] + }, + { + "video_id": "anim_9", + "loop_count": 1, + "random_loop_range": null + } + ], + "next_state": null, + "next_states": [ + { + "state": "default", + "weight": 1 + }, + { + "state": "rest_lying", + "weight": 1 + }, + { + "state": "stand_active", + "weight": 1 + }, + { + "state": "sleep", + "weight": 0.5 + }, + { + "state": "lick_paw", + "weight": 1 + }, + { + "state": "thirsty", + "weight": 1 + } + ], + "transitions": [ + { + "trigger": { + "voice": { + "keyword": "name" + } + }, + "target_state": "called_name", + "priority": 10 + }, + { + "trigger": { + "button": { + "name": "button1" + } + }, + "target_state": "shake_hand", + "priority": 10 + }, + { + "trigger": { + "voice": { + "keyword": "握手" + } + }, + "target_state": "shake_hand", + "priority": 10 + }, + { + "trigger": { + "button": { + "name": "button2" + } + }, + "target_state": "feeding", + "priority": 10 + }, + { + "trigger": { + "voice": { + "keyword": "吃饭" + } + }, + "target_state": "feeding", + "priority": 10 + }, + { + "trigger": { + "button": { + "name": "button3" + } + }, + "target_state": "drinking", + "priority": 10 + }, + { + "trigger": { + "voice": { + "keyword": "喝水" + } + }, + "target_state": "drinking", + "priority": 10 + }, + { + "trigger": { + "sensor": { + "name": "touch" + } + }, + "target_state": "pet_head", + "priority": 10 + } + ], + "weight": 1, + "defer_triggers": true, + "ignore_triggers": false + }, + "drinking": { + "name": "喂水", + "mode": "interactive_mode", + "sequence": [ + { + "video_id": "anim_19", + "loop_count": 1, + "random_loop_range": null + } + ], + "next_state": null, + "next_states": [ + { + "state": "default", + "weight": 1 + }, + { + "state": "rest_lying", + "weight": 1 + }, + { + "state": "stand_active", + "weight": 1 + }, + { + "state": "sleep", + "weight": 1 + }, + { + "state": "lick_paw", + "weight": 1 + }, + { + "state": "thirsty", + "weight": 1 + } + ], + "transitions": [], + "weight": 1, + "defer_triggers": false, + "ignore_triggers": true + }, + "shake_hand": { + "name": "握手", + "mode": "interactive_mode", + "sequence": [ + { + "video_id": "anim_17", + "loop_count": 1, + "random_loop_range": null + } + ], + "next_state": null, + "next_states": [ + { + "state": "default", + "weight": 1 + }, + { + "state": "rest_lying", + "weight": 1 + }, + { + "state": "stand_active", + "weight": 1 + }, + { + "state": "sleep", + "weight": 1 + }, + { + "state": "lick_paw", + "weight": 1 + }, + { + "state": "thirsty", + "weight": 1 + } + ], + "transitions": [], + "weight": 1, + "defer_triggers": false, + "ignore_triggers": true + }, + "called_name": { + "name": "被叫名字", + "mode": "interactive_mode", + "sequence": [ + { + "video_id": "anim_14", + "loop_count": 1, + "random_loop_range": null + }, + { + "video_id": "anim_15", + "loop_count": 1, + "random_loop_range": null + }, + { + "video_id": "anim_16", + "loop_count": 1, + "random_loop_range": null + } + ], + "next_state": null, + "next_states": [ + { + "state": "default", + "weight": 1 + }, + { + "state": "rest_lying", + "weight": 1 + }, + { + "state": "stand_active", + "weight": 1 + }, + { + "state": "sleep", + "weight": 1 + }, + { + "state": "lick_paw", + "weight": 1 + }, + { + "state": "thirsty", + "weight": 1 + } + ], + "transitions": [], + "weight": 1, + "defer_triggers": false, + "ignore_triggers": true + }, + "rest_lying": { + "name": "趴着休息", + "mode": "free_mode", + "sequence": [ + { + "video_id": "anim_1", + "loop_count": 1, + "random_loop_range": null + }, + { + "video_id": "anim_2", + "loop_count": null, + "random_loop_range": [ + 2, + 15 + ] + }, + { + "video_id": "anim_3", + "loop_count": 1, + "random_loop_range": null + } + ], + "next_state": null, + "next_states": [ + { + "state": "default", + "weight": 1 + }, + { + "state": "stand_active", + "weight": 1 + }, + { + "state": "sleep", + "weight": 1 + }, + { + "state": "lick_paw", + "weight": 1 + }, + { + "state": "thirsty", + "weight": 1 + } + ], + "transitions": [ + { + "trigger": { + "voice": { + "keyword": "name" + } + }, + "target_state": "called_name", + "priority": 10 + }, + { + "trigger": { + "button": { + "name": "button1" + } + }, + "target_state": "shake_hand", + "priority": 10 + }, + { + "trigger": { + "voice": { + "keyword": "握手" + } + }, + "target_state": "shake_hand", + "priority": 10 + }, + { + "trigger": { + "button": { + "name": "button2" + } + }, + "target_state": "feeding", + "priority": 10 + }, + { + "trigger": { + "voice": { + "keyword": "吃饭" + } + }, + "target_state": "feeding", + "priority": 10 + }, + { + "trigger": { + "button": { + "name": "button3" + } + }, + "target_state": "drinking", + "priority": 10 + }, + { + "trigger": { + "voice": { + "keyword": "喝水" + } + }, + "target_state": "drinking", + "priority": 10 + }, + { + "trigger": { + "sensor": { + "name": "touch" + } + }, + "target_state": "pet_head", + "priority": 10 + } + ], + "weight": 1, + "defer_triggers": true, + "ignore_triggers": false + }, + "thirsty": { + "name": "口渴", + "mode": "free_mode", + "sequence": [ + { + "video_id": "anim_11", + "loop_count": 1, + "random_loop_range": null + }, + { + "video_id": "anim_12", + "loop_count": null, + "random_loop_range": [ + 2, + 30 + ] + }, + { + "video_id": "anim_13", + "loop_count": 1, + "random_loop_range": null + } + ], + "next_state": null, + "next_states": [ + { + "state": "default", + "weight": 1 + }, + { + "state": "stand_active", + "weight": 1 + }, + { + "state": "sleep", + "weight": 1 + }, + { + "state": "lick_paw", + "weight": 1 + } + ], + "transitions": [ + { + "trigger": { + "voice": { + "keyword": "name" + } + }, + "target_state": "called_name", + "priority": 10 + }, + { + "trigger": { + "button": { + "name": "button1" + } + }, + "target_state": "shake_hand", + "priority": 10 + }, + { + "trigger": { + "voice": { + "keyword": "握手" + } + }, + "target_state": "shake_hand", + "priority": 10 + }, + { + "trigger": { + "button": { + "name": "button2" + } + }, + "target_state": "feeding", + "priority": 10 + }, + { + "trigger": { + "voice": { + "keyword": "吃饭" + } + }, + "target_state": "feeding", + "priority": 10 + }, + { + "trigger": { + "button": { + "name": "button3" + } + }, + "target_state": "drinking", + "priority": 10 + }, + { + "trigger": { + "voice": { + "keyword": "喝水" + } + }, + "target_state": "drinking", + "priority": 10 + }, + { + "trigger": { + "sensor": { + "name": "touch" + } + }, + "target_state": "pet_head", + "priority": 10 + } + ], + "weight": 1, + "defer_triggers": true, + "ignore_triggers": false + }, + "feeding": { + "name": "喂食", + "mode": "interactive_mode", + "sequence": [ + { + "video_id": "anim_18", + "loop_count": 1, + "random_loop_range": null + } + ], + "next_state": null, + "next_states": [ + { + "state": "default", + "weight": 1 + }, + { + "state": "rest_lying", + "weight": 1 + }, + { + "state": "stand_active", + "weight": 1 + }, + { + "state": "sleep", + "weight": 1 + }, + { + "state": "lick_paw", + "weight": 1 + }, + { + "state": "thirsty", + "weight": 1 + } + ], + "transitions": [], + "weight": 1, + "defer_triggers": false, + "ignore_triggers": true + }, + "default": { + "name": "默认状态", + "mode": "free_mode", + "sequence": [ + { + "video_id": "anim_0", + "loop_count": null, + "random_loop_range": [ + 2, + 15 + ] + } + ], + "next_state": null, + "next_states": [ + { + "state": "rest_lying", + "weight": 1 + }, + { + "state": "stand_active", + "weight": 1 + }, + { + "state": "sleep", + "weight": 1 + }, + { + "state": "lick_paw", + "weight": 1 + }, + { + "state": "thirsty", + "weight": 1 + } + ], + "transitions": [ + { + "trigger": { + "voice": { + "keyword": "name" + } + }, + "target_state": "called_name", + "priority": 10 + }, + { + "trigger": { + "button": { + "name": "button1" + } + }, + "target_state": "shake_hand", + "priority": 10 + }, + { + "trigger": { + "voice": { + "keyword": "握手" + } + }, + "target_state": "shake_hand", + "priority": 10 + }, + { + "trigger": { + "button": { + "name": "button2" + } + }, + "target_state": "feeding", + "priority": 10 + }, + { + "trigger": { + "voice": { + "keyword": "吃饭" + } + }, + "target_state": "feeding", + "priority": 10 + }, + { + "trigger": { + "button": { + "name": "button3" + } + }, + "target_state": "drinking", + "priority": 10 + }, + { + "trigger": { + "voice": { + "keyword": "喝水" + } + }, + "target_state": "drinking", + "priority": 10 + }, + { + "trigger": { + "sensor": { + "name": "touch" + } + }, + "target_state": "pet_head", + "priority": 10 + } + ], + "weight": 1, + "defer_triggers": true, + "ignore_triggers": false + }, + "pet_head": { + "name": "摸头", + "mode": "interactive_mode", + "sequence": [ + { + "video_id": "anim_20", + "loop_count": 1, + "random_loop_range": null + } + ], + "next_state": null, + "next_states": [ + { + "state": "default", + "weight": 1 + }, + { + "state": "rest_lying", + "weight": 1 + }, + { + "state": "stand_active", + "weight": 1 + }, + { + "state": "sleep", + "weight": 1 + }, + { + "state": "lick_paw", + "weight": 1 + }, + { + "state": "thirsty", + "weight": 1 + } + ], + "transitions": [], + "weight": 1, + "defer_triggers": false, + "ignore_triggers": true + }, + "lick_paw": { + "name": "狗舔爪子", + "mode": "free_mode", + "sequence": [ + { + "video_id": "anim_10", + "loop_count": 1, + "random_loop_range": null + } + ], + "next_state": null, + "next_states": [ + { + "state": "default", + "weight": 1 + }, + { + "state": "rest_lying", + "weight": 1 + }, + { + "state": "stand_active", + "weight": 1 + }, + { + "state": "sleep", + "weight": 1 + }, + { + "state": "thirsty", + "weight": 1 + } + ], + "transitions": [ + { + "trigger": { + "voice": { + "keyword": "name" + } + }, + "target_state": "called_name", + "priority": 10 + }, + { + "trigger": { + "button": { + "name": "button1" + } + }, + "target_state": "shake_hand", + "priority": 10 + }, + { + "trigger": { + "voice": { + "keyword": "握手" + } + }, + "target_state": "shake_hand", + "priority": 10 + }, + { + "trigger": { + "button": { + "name": "button2" + } + }, + "target_state": "feeding", + "priority": 10 + }, + { + "trigger": { + "voice": { + "keyword": "吃饭" + } + }, + "target_state": "feeding", + "priority": 10 + }, + { + "trigger": { + "button": { + "name": "button3" + } + }, + "target_state": "drinking", + "priority": 10 + }, + { + "trigger": { + "voice": { + "keyword": "喝水" + } + }, + "target_state": "drinking", + "priority": 10 + }, + { + "trigger": { + "sensor": { + "name": "touch" + } + }, + "target_state": "pet_head", + "priority": 10 + } + ], + "weight": 1, + "defer_triggers": true, + "ignore_triggers": false + } + } } }, - "triggers": {}, "remote_control": { "enabled": true, "host": "0.0.0.0", @@ -56,7 +1176,7 @@ "name": "小雅", "character_type": "live2d", "render_type": "live2d", - "persona_prompt": "你是一个温柔的二次元少女,名叫小雅。说话活泼可爱,偶尔用语气词'呢''哦''嘛',每次回复不超过两句话。喜欢聊日常和动漫话题。", + "persona_prompt": "你是一个温柔的二次元少女,名叫小雅。说话活泼可爱,偶尔用语气词,每次回复不超过两句话。", "max_tokens": 128, "talk_state": "talk", "live2d_model": "haru/Haru.model3.json" @@ -68,4 +1188,4 @@ "piper_config": "/home/showen/ai_spike/piper/zh_CN-huayan-medium.onnx.json", "espeak_data_dir": "/home/showen/ai_spike/piper/piper/espeak-ng-data" } -} +} \ No newline at end of file