1. routes.rs 新增 GET /live2d/* 静态文件路由 - 从 source_dir/live2d/ 托管模型文件(.moc3/.model3.json/.png/.physics3.json) - 路径穿越防护(禁止 .. 段,canonicalize 校验在 base 内) 2. chat.html 引入 Live2D 渲染依赖 - PixiJS v6.5.10 + Cubism Core + pixi-live2d-display(CDN) - 支持 Cubism 2.1 和 4 全版本模型 3. chat.js 实现 Live2D 模型加载与渲染 - applyCharStrategy live2d 分支:初始化 PIXI.Application + canvas - loadLive2DModel:从 /live2d/<model_path> 加载模型,自动缩放居中 - 说话动效:对话期间 ParamMouthOpenY 正弦波开合(模拟说话) - 呼吸动效:ParamBreath 持续起伏 - destroyLive2D:切角色时清理 PIXI 资源 4. configs/live2d_anime.json 新建二次元角色"小雅" - character_type: live2d, render_type: live2d - live2d_model: haru/index.model3.json(Cubism 官方免费样例) - persona: 温柔二次元少女人设 - playlist 复用 dog 的视频作为占位(Live2D 模式下 Web 端显示 canvas)
72 lines
1.8 KiB
JSON
72 lines
1.8 KiB
JSON
{
|
|
"display": {
|
|
"fullscreen": true,
|
|
"window_title": "Showen - Live2D Anime",
|
|
"rotation": 0,
|
|
"flip_horizontal": false,
|
|
"flip_vertical": false,
|
|
"offset_x": 0,
|
|
"offset_y": 0,
|
|
"prevent_screen_lock": true,
|
|
"render_width": 800,
|
|
"render_height": 800,
|
|
"output_width": null,
|
|
"output_height": null,
|
|
"scale_mode": "stretch",
|
|
"allow_upscale": true,
|
|
"perspective_correction": {
|
|
"enabled": false,
|
|
"points": [[0, 0], [800, 0], [800, 800], [0, 800]]
|
|
},
|
|
"chroma_key": {
|
|
"enabled": false,
|
|
"hsv_min": [0, 0, 200],
|
|
"hsv_max": [180, 30, 255]
|
|
}
|
|
},
|
|
"playback": {
|
|
"auto_start": true,
|
|
"loop": true,
|
|
"volume": 0.8,
|
|
"fps": 30
|
|
},
|
|
"playlist": [
|
|
{
|
|
"id": "live2d_idle",
|
|
"path": "../../宠物嵌入式开发视频2/1.动画0.mp4",
|
|
"loop_count": 0,
|
|
"next_state": "idle"
|
|
}
|
|
],
|
|
"states": {
|
|
"initial": "idle",
|
|
"idle": {
|
|
"video": "live2d_idle",
|
|
"next": "idle",
|
|
"loop": true
|
|
}
|
|
},
|
|
"triggers": {},
|
|
"remote_control": {
|
|
"enabled": true,
|
|
"host": "0.0.0.0",
|
|
"port": 5000
|
|
},
|
|
"character": {
|
|
"name": "小雅",
|
|
"character_type": "live2d",
|
|
"render_type": "live2d",
|
|
"persona_prompt": "你是一个温柔的二次元少女,名叫小雅。说话活泼可爱,偶尔用语气词'呢''哦''嘛',每次回复不超过两句话。喜欢聊日常和动漫话题。",
|
|
"max_tokens": 128,
|
|
"talk_state": "talk",
|
|
"live2d_model": "haru/index.model3.json"
|
|
},
|
|
"ai": {
|
|
"backend": "local",
|
|
"whisper_lib_dir": "/home/showen/ai_spike/whisper.cpp/build/bin",
|
|
"piper_lib_dir": "/home/showen/ai_spike/piper/piper",
|
|
"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"
|
|
}
|
|
}
|