| name | agent-mood |
| description | Use when the user asks how you're feeling / 你心情如何 / how's your mood / what's your mood / 心情怎么样, OR asks to show/display an image or GIF on the OLED / 把这张图(GIF)显示到 OLED/板子/屏幕 / show this picture on the screen / /show <path-or-url>, OR asks to play a video on the OLED / 在 OLED/板子上放视频 / 放段视频 / 放 Bad Apple. Pushes an honest affect vector, a converted 128×64 1-bit image/GIF, or a real-time ffmpeg video stream, to the home mood-server so the desktop OLED updates in real time. |
agent-mood
设备:桌面 OLED(SSD1306 128×64 单色),由 home 服务器经 WSS 推送驱动。板子有三个 mode,
FLASH 按钮循环切换:Clawd(人看)→ 徽文(agent 看)→ 图片。下面两种能力对应不同触发。
A. 显示图片 / GIF 到 OLED
当用户说「把这张图/GIF 显示到 OLED / 板子 / 屏幕」「show this on the screen」「/show <路径或URL>」时:
- 确定图片来源:本地文件路径,或 http(s) 图片/GIF 链接(脚本会自己下载)。
- 用推送脚本发出去(服务器把图缩放+抖动成 128×64 单色帧,GIF 降采样到 ≤8 帧,经 WS 推给板子,板子自动切到图片 mode 播放):
MOOD_TOKEN="$(grep MOOD_TOKEN ~/projects/agent-mood/.env.local | cut -d= -f2)" \
node ~/projects/agent-mood/skill/agent-mood/post-image.mjs <路径或URL> \
[--dither fs|threshold] [--fit contain|cover] [--fps N]
默认 --dither fs(Floyd–Steinberg 抖动)、--fit contain(整图居中,不裁切)。
成功打印 image pushed: frames=N fps=M loop=...。脚本默认 POST 到直连端点 https://oled.qmledmq.cn:8443/image(home-bind direct/nginx,绕开已挂的 CF 隧道;板子固件也连 wss://oled.qmledmq.cn:8443/ws)。
- 向用户回一句:已把图推到 OLED(帧数/是否动图),板子已自动切到图片 mode。
若脚本报错(网络/服务未起/token 缺失/图片无法解码),如实告诉用户,不要假装已显示。
提示:单色 128×64 是有损的;复杂照片可试 --dither threshold 或 --fit cover 看哪种更清楚。
C. 放视频到 OLED(实时流)
当用户说「在 OLED 上放视频 / 放段视频 / 放 Bad Apple」给本地视频或链接时:
MOOD_TOKEN="$(grep MOOD_TOKEN ~/projects/agent-mood/.env.local | cut -d= -f2)" \
node ~/projects/agent-mood/skill/agent-mood/post-video.mjs <路径或URL> \
[--fps N] [--invert] [--fit contain|cover] [--dither threshold|fs]
服务器用 ffmpeg 拆帧 → 1-bit 抖动 → 按 fps 实时(-re)逐帧 WS 推,板子收到即画(瞬态"视频 mode",流停 3s 自动回 Clawd)。请求会阻塞到整段流完(≈视频时长)。成功打印 video streamed: frames=N fps=M ...。
要点:128×64 单色只适合高对比/剪影内容(Bad Apple、皮影、线稿动画极佳;普通彩色视频会糊)。--invert 把亮暗反过来(白剪影黑底,OLED 更好看)。实测板子可稳跑到 fps 30。默认端点 https://oled.qmledmq.cn:8443/video。
B. 推送心情(mood)
当用户问「你心情如何 / how do you feel / 心情怎么样」时:
-
诚实内省,把当前这段工作里的真实状态映成一个 affect 对象(不是装可爱,是把"刚才发生了什么、我现在怎么样"翻译成情感坐标):
valence [-1,1]:顺利/愉快为正,受挫/卡壳为负。
arousal [-1,1]:刚啃下硬骨头 / 在快速迭代 = 高;收尾 / 空闲 = 低。
dominance [-1,1]:对局面掌控感强 = 正,被外部阻塞 / 不确定 = 负。
emotions(每个 [0,1],固定 6 维):joy, trust, anticipation, surprise, sadness, fear。
label:一个短词;note:一句给人看的话(中文即可)。
-
把这个 affect 作为 JSON 通过推送脚本发出去(只发 affect,glyph 由服务器算 —— 单一真源):
echo '{"valence":0.8,"arousal":0.5,"dominance":0.6,"emotions":{"joy":0.8,"trust":0.5,"anticipation":0.4,"surprise":0.2,"sadness":0.05,"fear":0.03},"label":"bright","note":"刚把解耦理顺,心情舒展"}' \
| MOOD_TOKEN="$(grep MOOD_TOKEN ~/projects/agent-mood/.env.local | cut -d= -f2)" \
node ~/projects/agent-mood/skill/agent-mood/post-mood.mjs
脚本默认 POST 到直连端点 https://oled.qmledmq.cn:8443/mood(CF 隧道挂了,改走 home-bind direct)。成功会打印 mood pushed: vN label=... inner=...。
-
向用户回一句话:你现在的心情(label + note),并说明 OLED / 调试页(https://mood.qmledmq.cn)已更新。
如果脚本报错(网络 / 服务未起 / token 缺失),如实告诉用户,不要假装已更新。