README
dsh-pet 🐾
<p align="center"> <a href="https://www.npmjs.com/package/dsh-pet"><img alt="npm version" src="https://img.shields.io/npm/v/dsh-pet?label=npm&color=blue"></a> <a href="https://www.npmjs.com/package/dsh-pet"><img alt="npm monthly downloads" src="https://img.shields.io/npm/dm/dsh-pet?label=月下载&color=brightgreen"></a> <a href="https://www.npmjs.com/package/dsh-pet"><img alt="total downloads" src="https://img.shields.io/npm/dt/dsh-pet?label=总下载&color=success"></a> <a href="https://github.com/PC2005-cloud/dsh-pet"><img alt="stars" src="https://img.shields.io/github/stars/PC2005-cloud/dsh-pet?style=social"></a> <a href="https://github.com/PC2005-cloud/dsh-pet/blob/master/LICENSE"><img alt="license" src="https://img.shields.io/github/license/PC2005-cloud/dsh-pet?color=orange"></a> <a href="https://awesome-dsh-plugin.com"><img alt="awesome dsh plugin" src="https://awesome-dsh-plugin.com/badge.svg"></a> <a href="https://github.com/PC2005-cloud/dsh-pet"><img alt="repo size" src="https://img.shields.io/github/repo-size/PC2005-cloud/dsh-pet"></a> <a href="https://github.com/PC2005-cloud/dsh-pet/issues"><img alt="issues" src="https://img.shields.io/github/issues/PC2005-cloud/dsh-pet"></a> <img alt="platform" src="https://img.shields.io/badge/platform-DeepSeek Harness Web-8A2BE2"> <img alt="assets" src="https://img.shields.io/badge/assets-51 animations-ff69b4"> </p>
一只住在 DeepSeek Harness Web 界面里的桌面宠物:待机呼吸、随机动作(含打瞌睡)、偶尔转向、屏幕漫游、点击反应、可拖拽。
这不是一个普通插件,而是完整的三件套项目:
① 提示词(配方) → ② 素材生成链(引擎) → ③ 插件(成品)
AI 生成动画的配方 源视频 → 透明动画的管线 运行在 DSH 里的宠物
任何人 clone 本仓库,都可以从零生成自己的桌面宠物——换角色、换动作、换风格,全流程可复现。
快速开始(安装插件)
dsh plugin --profile web add dsh-pet
重启 dsh web,宠物出现在右下角。
从零生成你自己的宠物(完整流程)
① 提示词 → 源视频
用 AI 视频生成工具(如可灵、Runway、豆包等,本项目素材即由豆包生成),按 prompts/桌面宠物 10 秒动作提示词.md 的配方生成 51 个 10 秒绿幕视频:
- 视频比例 16:9,背景纯绿幕(#00FF00)
- 人物位置/大小固定(头顶 ~20% 高度、脚底 ~85% 高度)
- 动作全程在画幅内,首尾帧为标准正面站立
- 每段动画按秒分解(0-10s 各阶段动作)
生成结果放入 video/(51 个 mp4)。
源视频获取:为控制仓库体积,
video/源视频不入 git。需要复现素材链时,从 Releasesassets-videos下载 51 个 mp4(拼音文件名),放入video/即可。一键批量下载(需 gh CLI):mkdir -p video && cd video && gh release download assets-videos --repo PC2005-cloud/dsh-pet
② 源视频 → 透明动画(素材链)
cd scripts
python watermark_step01.py # 水印遮罩填充 → step01/
python chroma_step02.py # 绿幕抠像转透明(HSV 色相)→ step02/
python normalize_step03.py # 归一化 2160×1215 统一站立居中 → step03/
python encode_thumbs.py # 转码 640×360 播放变体 → step04/
依赖:Python 3 + ffmpeg + numpy + scipy(素材链脚本自动用工作区 .tools/ 下的 ffmpeg)。
③ 动画 → 插件
# 把 step04 的播放变体同步进插件包
cp step04/*.webm dsh-pet/assets/thumb/
# 本地安装插件
dsh plugin --profile web add file:D:/path/to/dsh-pet
中间产物(step01-04)由脚本生成、不入仓库;
video/源视频和脚本是成果、入库维护。
项目结构
├── prompts/ # ① 51 个动作的生成提示词(绿幕规范 + 按秒分解)
├── scripts/ # ② 素材生成链(7 个 Python 脚本)
├── video/ # ② 源视频(51 个绿幕 mp4 + 水印 mask)
├── tools/ # 开发工具:preview.html(素材链各阶段效果预览)
├── dsh-pet/ # ③ 插件(可独立 npm 发布)
│ ├── lib/index.js # host 半侧:/pet 视频路由
│ ├── lib/client.js # 浏览器半侧:动画链 + 双缓冲播放
│ └── assets/thumb/ # 640×360 播放动画(51 个,~36MB)
├── DESIGN.md # 设计与实现文档(含踩坑记录)
└── LICENSE # MIT
插件功能
- 纯粹的桌宠:不掺任何业务功能——没有天气查询、系统监控、Agent 状态感知,就一件事:陪你。零核心改动(不碰 DSH 内核)、零模型成本(运行时不需要调用任何 LLM 或 API)
- 动画链:每个动画(含待机)播完立即按概率选下一个——30% 待机 / 10% 转向 / 40% 动作 / 20% 移动,首尾相接永不停止
- 屏幕漫游:朝 facing 方向行走,先检查空间、不走出屏幕
- 点击/拖拽:点击有回应动画,可拖到任意位置
- 左右朝向:所有动画可镜像,人物可朝左/朝右
- 落地对齐:动画统一脚底线,宠物始终站在地面上
- 流畅切换:双缓冲交叉淡入,切换无空白帧
运行效果
宠物实际运行在 DSH Web 界面中的样子:
<p> <img src="assets/screenshots/dsh-pet-running-1.png" width="380" alt="dsh-pet 运行效果 1" title="dsh-pet 运行效果 1"> <img src="assets/screenshots/dsh-pet-running-2.png" width="380" alt="dsh-pet 运行效果 2" title="dsh-pet 运行效果 2"> </p>
效果预览
全部 51 个动画(640×360,插件实际播放用的资源)——GIF 预览存放于仓库 dsh-pet/assets/preview/(raw 直链渲染,文件名采用拼音便于跨平台);完整透明视频见 dsh-pet/assets/thumb/:
待机 / 转向
<p> <img src="dsh-pet/assets/preview/daiji-huxi-xiuxian.gif" width="160" alt="待机呼吸休闲" title="待机呼吸休闲"> <img src="dsh-pet/assets/preview/dongzhangxiwang.gif" width="160" alt="东张西望" title="东张西望"> </p>
移动
<p> <img src="dsh-pet/assets/preview/pangxie-zoulu.gif" width="160" alt="螃蟹走路" title="螃蟹走路"> <img src="dsh-pet/assets/preview/yuandi-piaofu-tabu.gif" width="160" alt="原地漂浮踏步" title="原地漂浮踏步"> <img src="dsh-pet/assets/preview/yuandi-zuozhuan-benpao.gif" width="160" alt="原地左转奔跑" title="原地左转奔跑"> </p>
动作
<p> <img src="dsh-pet/assets/preview/youxian-hengga.gif" width="160" alt="悠闲哼歌" title="悠闲哼歌"> <img src="dsh-pet/assets/preview/chaoda-shenlanyao.gif" width="160" alt="超大伸懒腰" title="超大伸懒腰"> <img src="dsh-pet/assets/preview/yuandi-zhuanxin-wan-mofang.gif" width="160" alt="原地专心玩魔方" title="原地专心玩魔方"> <img src="dsh-pet/assets/preview/yuandi-qiaoji-zhuomian-hudong.gif" width="160" alt="原地敲击桌面互动" title="原地敲击桌面互动"> <img src="dsh-pet/assets/preview/yuandi-zhongli-xiadun-yasuo.gif" width="160" alt="原地重力下蹲压缩" title="原地重力下蹲压缩"> <img src="dsh-pet/assets/preview/haqian-liantian.gif" width="160" alt="哈欠连天" title="哈欠连天"> <img src="dsh-pet/assets/preview/yuandi-xiaoqi-chenmian.gif" width="160" alt="原地小憩沉眠" title="原地小憩沉眠"> <img src="dsh-pet/assets/preview/yuandi-dunxia-wan-wanju-qiche.gif" width="160" alt="原地蹲下玩玩具汽车" title="原地蹲下玩玩具汽车"> <img src="dsh-pet/assets/preview/jingyu-tu-paopao-texiao.gif" width="160" alt="鲸鱼吐泡泡特效" title="鲸鱼吐泡泡特效"> <img src="dsh-pet/assets/preview/nvpu-quxi-liyi.gif" width="160" alt="女仆屈膝礼仪" title="女仆屈膝礼仪"> <img src="dsh-pet/assets/preview/beixiayitiao-zhamao.gif" width="160" alt="被吓一跳(炸毛)" title="被吓一跳(炸毛)"> <img src="dsh-pet/assets/preview/yuandi-tiaoyue-zhuasui-touding-wupin.gif" width="160" alt="原地跳跃抓碎头顶物品" title="原地跳跃抓碎头顶物品"> <img src="dsh-pet/assets/preview/xiaofudu-yuandi-360du-xuanzhuan-zhanshi.gif" width="160" alt="小幅度原地 360 度旋转展示" title="小幅度原地 360 度旋转展示"> <img src="dsh-pet/assets/preview/touchi-lingshi-bei-zhuazhu.gif" width="160" alt="偷吃零食被抓住" title="偷吃零食被抓住"> <img src="dsh-pet/assets/preview/wan-youxi-qijibaituai.gif" width="160" alt="玩游戏气急败坏" title="玩游戏气急败坏"> <img src="dsh-pet/assets/preview/yong-jingyu-weiba-paidadi.gif" width="160" alt="用鲸鱼尾巴拍打地面" title="用鲸鱼尾巴拍打地面"> <img src="dsh-pet/assets/preview/da-keshui-bei-jingxing.gif" width="160" alt="打瞌睡被惊醒" title="打瞌睡被惊醒"> <img src="dsh-pet/assets/preview/wan-shuiqiang.gif" width="160" alt="玩水枪" title="玩水枪"> <img src="dsh-pet/assets/preview/xiaotiqin-yanzou.gif" width="160" alt="小提琴演奏" title="小提琴演奏"> <img src="dsh-pet/assets/preview/lanjing-xianshi.gif" width="160" alt="蓝鲸现世" title="蓝鲸现世"> <img src="dsh-pet/assets/preview/chi-baifan.gif" width="160" alt="吃白饭" title="吃白饭"> <img src="dsh-pet/assets/preview/zhao-jingzi.gif" width="160" alt="照镜子" title="照镜子"> <img src="dsh-pet/assets/preview/youya-nvpuwu.gif" width="160" alt="优雅女仆舞" title="优雅女仆舞"> <img src="dsh-pet/assets/preview/qingkuai-yaobaiwu.gif" width="160" alt="轻快摇摆舞" title="轻快摇摆舞"> <img src="dsh-pet/assets/preview/keai-zhaiwu.gif" width="160" alt="可爱宅舞" title="可爱宅舞"> <img src="dsh-pet/assets/preview/zhengti-huanzhuang-shise.gif" width="160" alt="整体换装试色" title="整体换装试色"> <img src="dsh-pet/assets/preview/dakou-chi-lingshi.gif" width="160" alt="大口吃零食" title="大口吃零食"> <img src="dsh-pet/assets/preview/chui-qiqiu.gif" width="160" alt="吹气球" title="吹气球"> <img src="dsh-pet/assets/preview/dongwu-huanrao.gif" width="160" alt="动物环绕" title="动物环绕"> <img src="dsh-pet/assets/preview/shendu-sikao-suisuinian.gif" width="160" alt="深度思考碎碎念" title="深度思考碎碎念"> <img src="dsh-pet/assets/preview/qingkuai-jilu.gif" width="160" alt="轻快记录" title="轻快记录"> <img src="dsh-pet/assets/preview/xie-daima.gif" width="160" alt="写代码" title="写代码"> </p>
点击回应
<p> <img src="dsh-pet/assets/preview/dianji-huiying-kaixin-yuedong.gif" width="160" alt="点击回应 - 开心跃动" title="点击回应 - 开心跃动"> <img src="dsh-pet/assets/preview/dianji-huiying-haixiu-jingya.gif" width="160" alt="点击回应 - 害羞惊讶" title="点击回应 - 害羞惊讶"> <img src="dsh-pet/assets/preview/dianji-huiying-aojiao-shengqi-ceshen-zhanshi.gif" width="160" alt="点击回应 - 傲娇生气(侧身展示)" title="点击回应 - 傲娇生气(侧身展示)"> </p>
拖拽
<p> <img src="dsh-pet/assets/preview/beishubiao-tuozhuai-xuankong-fankui.gif" width="160" alt="被鼠标拖拽悬空反馈" title="被鼠标拖拽悬空反馈"> </p>
注:动画为透明背景;GIF 预览中透明部分显示为页面底色,实际 webm 播放为透明。
文档
- 设计与实现 —— 架构、动画链模型、素材链、踩坑记录
许可
- 代码:MIT
- 素材(动画/提示词):见仓库说明
更多「纯属好玩」插件
dsh-stock-watch
作者 awu12277
A股自选股实时行情盯盘插件 - DeepSeek Harness Web 右上角可折叠弹窗
dsh-desktop-pet
作者 xiaoshihou514
DeepSeek Harness:鲸鱼娘桌宠!
dsh-lorebookmd
作者 609476965
DSH lorebook-driven fiction writer plugin: import Tavern/SillyTavern character cards & world books, save local Markdown settings, generate novel prose referencing the world.
dsh-codex-pet
作者 skr311
dsh-codex-pet · DSH 桌面宠物插件 — 导入精灵图序列帧宠物,悬浮浮层渲染 + Agent 状态联动
