dsh-chat-comprehension 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE.md +20 -0
- package/README.md +20 -9
- package/client.js +41 -9
- package/lib/engines.mjs +136 -0
- package/lib/index.js +54 -4
- package/lib/qqbot-0.5.3-patches.json +75 -70
- package/lib/qqbot-patch.mjs +12 -7
- package/lib/video.mjs +11 -2
- package/package.json +7 -23
- package/vendor/dsh-agent-md/LICENSE +21 -0
- package/vendor/dsh-agent-md/cordis.patch.yml +8 -0
- package/vendor/dsh-agent-md/lib/index.js +775 -0
- package/vendor/dsh-agent-md/lib/persona.js +634 -0
- package/vendor/dsh-agent-md/lib/qq.js +527 -0
- package/vendor/dsh-agent-md/package.json +50 -0
- package/vendor/dsh-bili-scroll/LICENSE +21 -0
- package/vendor/dsh-bili-scroll/NOTICE.md +18 -0
- package/vendor/dsh-bili-scroll/cordis.patch.yml +20 -0
- package/vendor/dsh-bili-scroll/index.js +3293 -0
- package/vendor/dsh-bili-scroll/lib/asr.py +141 -0
- package/vendor/dsh-bili-scroll/lib/diagnose.mjs +95 -0
- package/vendor/dsh-bili-scroll/lib/dm.mjs +110 -0
- package/vendor/dsh-bili-scroll/lib/favops.py +90 -0
- package/vendor/dsh-bili-scroll/lib/hostdeps.mjs +148 -0
- package/vendor/dsh-bili-scroll/lib/login.mjs +141 -0
- package/vendor/dsh-bili-scroll/lib/mcp.mjs +144 -0
- package/vendor/dsh-bili-scroll/lib/state.mjs +236 -0
- package/vendor/dsh-bili-scroll/lib/uid.mjs +61 -0
- package/vendor/dsh-bili-scroll/lib/uvfetch.mjs +217 -0
- package/vendor/dsh-bili-scroll/lib/verify.mjs +184 -0
- package/vendor/dsh-bili-scroll/package.json +84 -0
- package/vendor/dsh-bili-scroll/profile-template/bili-duty/cordis.patch.yml +116 -0
- package/vendor/dsh-bili-scroll/profile-template/bili-duty/cordis.yml +4 -0
- package/vendor/dsh-bili-scroll/profile-template/bili-duty/package.json +13 -0
- package/vendor/dsh-bili-scroll/prompts/duty.md +296 -0
- package/vendor/dsh-bili-scroll/vendor/bilibili-mcp/LICENSE +21 -0
- package/vendor/dsh-bili-scroll/vendor/bilibili-mcp/README.md +176 -0
- package/vendor/dsh-bili-scroll/vendor/bilibili-mcp/mcp_server.py +2015 -0
- package/vendor/dsh-bili-scroll/vendor/bilibili-mcp/requirements.txt +10 -0
- package/vendor/dsh-meme/.dsh/skills/dsh-meme-maintenance/SKILL.md +50 -0
- package/vendor/dsh-meme/LICENSE +21 -0
- package/vendor/dsh-meme/anim.js +588 -0
- package/vendor/dsh-meme/cordis.patch.yml +13 -0
- package/vendor/dsh-meme/icon.jpg +0 -0
- package/vendor/dsh-meme/index.js +2616 -0
- package/vendor/dsh-meme/locale/en.json +6 -0
- package/vendor/dsh-meme/locale/zh.json +6 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/index.db +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/manifest.json +13 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/angry/shengqi.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/baka/xianqi.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/color/huachi.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/confused/jiazai.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/confused/wenhao.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/cpu/jiaban.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/daily/ganfan.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/fool/buyao.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/givemoney/yaoqian.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/happy/deyi.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/happy/ok.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/happy/piaole.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/like/bixin.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/meow/maozhua.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/morning/zaoshanghao.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/sad/qiurao.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/sad/yun.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/see/zhenjing.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/shy/haixiu.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/shy/toukan.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/sigh/wuyu.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/sleep/shuijiao.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/surprised/xia.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/work/tangping.jpg +0 -0
- package/vendor/dsh-meme/memes.js +998 -0
- package/vendor/dsh-meme/package.json +67 -0
- package/vendor/dsh-meme/panel.html +210 -0
- package/vendor/dsh-video-storyboard/LICENSE +21 -0
- package/vendor/dsh-video-storyboard/NOTICE +12 -0
- package/vendor/dsh-video-storyboard/bin/_args.mjs +16 -0
- package/vendor/dsh-video-storyboard/bin/asr-check.mjs +85 -0
- package/vendor/dsh-video-storyboard/bin/scan-stats.mjs +43 -0
- package/vendor/dsh-video-storyboard/bin/scan-video.mjs +38 -0
- package/vendor/dsh-video-storyboard/bin/storyboard.mjs +195 -0
- package/vendor/dsh-video-storyboard/cordis.patch.yml +3 -0
- package/vendor/dsh-video-storyboard/dsh.plugin.json +12 -0
- package/vendor/dsh-video-storyboard/package.json +88 -0
- package/vendor/dsh-video-storyboard/scripts/check-syntax.mjs +56 -0
- package/vendor/dsh-video-storyboard/scripts/install-dev.mjs +104 -0
- package/vendor/dsh-video-storyboard/src/flicker.js +104 -0
- package/vendor/dsh-video-storyboard/src/index.js +82 -0
- package/vendor/dsh-video-storyboard/src/ocr_bridge.py +103 -0
- package/vendor/dsh-video-storyboard/src/storyboard/asr-lifecycle.js +262 -0
- package/vendor/dsh-video-storyboard/src/storyboard/asr.js +488 -0
- package/vendor/dsh-video-storyboard/src/storyboard/audio.js +168 -0
- package/vendor/dsh-video-storyboard/src/storyboard/binaries.js +69 -0
- package/vendor/dsh-video-storyboard/src/storyboard/board.js +121 -0
- package/vendor/dsh-video-storyboard/src/storyboard/browser-time.js +504 -0
- package/vendor/dsh-video-storyboard/src/storyboard/cache.js +143 -0
- package/vendor/dsh-video-storyboard/src/storyboard/cells.js +70 -0
- package/vendor/dsh-video-storyboard/src/storyboard/density.js +545 -0
- package/vendor/dsh-video-storyboard/src/storyboard/direct-url.js +130 -0
- package/vendor/dsh-video-storyboard/src/storyboard/fetch.js +373 -0
- package/vendor/dsh-video-storyboard/src/storyboard/flash.js +180 -0
- package/vendor/dsh-video-storyboard/src/storyboard/format.js +573 -0
- package/vendor/dsh-video-storyboard/src/storyboard/frames.js +212 -0
- package/vendor/dsh-video-storyboard/src/storyboard/index.js +32 -0
- package/vendor/dsh-video-storyboard/src/storyboard/injection.js +76 -0
- package/vendor/dsh-video-storyboard/src/storyboard/layout-order.js +176 -0
- package/vendor/dsh-video-storyboard/src/storyboard/locate.js +113 -0
- package/vendor/dsh-video-storyboard/src/storyboard/media-store.js +106 -0
- package/vendor/dsh-video-storyboard/src/storyboard/memory.js +94 -0
- package/vendor/dsh-video-storyboard/src/storyboard/ocr-subs.js +107 -0
- package/vendor/dsh-video-storyboard/src/storyboard/ocr.js +167 -0
- package/vendor/dsh-video-storyboard/src/storyboard/pipeline.js +853 -0
- package/vendor/dsh-video-storyboard/src/storyboard/plan.js +400 -0
- package/vendor/dsh-video-storyboard/src/storyboard/probe.js +132 -0
- package/vendor/dsh-video-storyboard/src/storyboard/provenance.js +44 -0
- package/vendor/dsh-video-storyboard/src/storyboard/python.js +84 -0
- package/vendor/dsh-video-storyboard/src/storyboard/register.js +32 -0
- package/vendor/dsh-video-storyboard/src/storyboard/scan.js +486 -0
- package/vendor/dsh-video-storyboard/src/storyboard/segments.js +117 -0
- package/vendor/dsh-video-storyboard/src/storyboard/sheet.js +507 -0
- package/vendor/dsh-video-storyboard/src/storyboard/storage.js +93 -0
- package/vendor/dsh-video-storyboard/src/storyboard/subtitles.js +181 -0
- package/vendor/dsh-video-storyboard/src/storyboard/tool-spec.js +544 -0
- package/vendor/dsh-video-storyboard/src/storyboard/transcript-file.js +146 -0
- package/vendor/dsh-video-storyboard/src/storyboard/url.js +69 -0
- package/vendor/dsh-video-storyboard/src/storyboard/ytdlp.js +289 -0
- package/vendor/dsh-video-storyboard/src/tool-spec.js +17 -0
- package/vendor/dsh-video-storyboard/src/tools/locate.js +39 -0
- package/vendor/dsh-video-storyboard/src/tools/probe.js +23 -0
- package/vendor/dsh-video-storyboard/src/tools/shared.js +39 -0
- package/vendor/dsh-video-storyboard/src/tools/storyboard.js +20 -0
- package/vendor/dsh-video-storyboard/src/tools/zoom.js +56 -0
- package/vendor/dsh-world/LICENSE +21 -0
- package/vendor/dsh-world/assets/qq-card.png +0 -0
- package/vendor/dsh-world/cordis.patch.yml +6 -0
- package/vendor/dsh-world/lib/archive.d.ts +6 -0
- package/vendor/dsh-world/lib/archive.js +49 -0
- package/vendor/dsh-world/lib/archiveSelection.d.ts +8 -0
- package/vendor/dsh-world/lib/archiveSelection.js +20 -0
- package/vendor/dsh-world/lib/compaction.d.ts +124 -0
- package/vendor/dsh-world/lib/compaction.js +273 -0
- package/vendor/dsh-world/lib/compactionRegion.d.ts +42 -0
- package/vendor/dsh-world/lib/compactionRegion.js +210 -0
- package/vendor/dsh-world/lib/console/routes.d.ts +57 -0
- package/vendor/dsh-world/lib/console/routes.js +129 -0
- package/vendor/dsh-world/lib/console/snapshot.d.ts +39 -0
- package/vendor/dsh-world/lib/console/snapshot.js +51 -0
- package/vendor/dsh-world/lib/ecosystem/bridge/bridge.d.ts +36 -0
- package/vendor/dsh-world/lib/ecosystem/bridge/bridge.js +140 -0
- package/vendor/dsh-world/lib/ecosystem/bridge/route.d.ts +9 -0
- package/vendor/dsh-world/lib/ecosystem/bridge/route.js +46 -0
- package/vendor/dsh-world/lib/ecosystem/qq/bridge.d.ts +123 -0
- package/vendor/dsh-world/lib/ecosystem/qq/bridge.js +380 -0
- package/vendor/dsh-world/lib/ecosystem/qq/panel.d.ts +75 -0
- package/vendor/dsh-world/lib/ecosystem/qq/panel.js +187 -0
- package/vendor/dsh-world/lib/ecosystem/qq/route.d.ts +32 -0
- package/vendor/dsh-world/lib/ecosystem/qq/route.js +134 -0
- package/vendor/dsh-world/lib/ecosystem/qq/supervisor.d.ts +57 -0
- package/vendor/dsh-world/lib/ecosystem/qq/supervisor.js +188 -0
- package/vendor/dsh-world/lib/ecosystem/shared/context.d.ts +14 -0
- package/vendor/dsh-world/lib/ecosystem/shared/context.js +42 -0
- package/vendor/dsh-world/lib/ecosystem/shared/identity.d.ts +15 -0
- package/vendor/dsh-world/lib/ecosystem/shared/identity.js +36 -0
- package/vendor/dsh-world/lib/ecosystem/shared/outlets.d.ts +43 -0
- package/vendor/dsh-world/lib/ecosystem/shared/outlets.js +70 -0
- package/vendor/dsh-world/lib/ecosystem/shared/sessions.d.ts +16 -0
- package/vendor/dsh-world/lib/ecosystem/shared/sessions.js +52 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/archive.d.ts +24 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/archive.js +62 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/home.d.ts +21 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/home.js +111 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/images.d.ts +5 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/images.js +43 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/index.d.ts +41 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/index.js +166 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/messages.d.ts +24 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/messages.js +35 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/sending.d.ts +30 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/sending.js +216 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/supervisor.d.ts +39 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/supervisor.js +138 -0
- package/vendor/dsh-world/lib/faults.d.ts +10 -0
- package/vendor/dsh-world/lib/faults.js +13 -0
- package/vendor/dsh-world/lib/history.d.ts +16 -0
- package/vendor/dsh-world/lib/history.js +80 -0
- package/vendor/dsh-world/lib/hostContract.d.ts +19 -0
- package/vendor/dsh-world/lib/hostContract.js +1 -0
- package/vendor/dsh-world/lib/http.d.ts +18 -0
- package/vendor/dsh-world/lib/http.js +39 -0
- package/vendor/dsh-world/lib/index.d.ts +108 -0
- package/vendor/dsh-world/lib/index.js +356 -0
- package/vendor/dsh-world/lib/life/activity.d.ts +14 -0
- package/vendor/dsh-world/lib/life/activity.js +58 -0
- package/vendor/dsh-world/lib/life/alarm.d.ts +39 -0
- package/vendor/dsh-world/lib/life/alarm.js +132 -0
- package/vendor/dsh-world/lib/life/alarmTimer.d.ts +22 -0
- package/vendor/dsh-world/lib/life/alarmTimer.js +49 -0
- package/vendor/dsh-world/lib/life/diary.d.ts +4 -0
- package/vendor/dsh-world/lib/life/diary.js +9 -0
- package/vendor/dsh-world/lib/life/earlyStop.d.ts +19 -0
- package/vendor/dsh-world/lib/life/earlyStop.js +25 -0
- package/vendor/dsh-world/lib/life/home.d.ts +34 -0
- package/vendor/dsh-world/lib/life/home.js +91 -0
- package/vendor/dsh-world/lib/life/host.d.ts +22 -0
- package/vendor/dsh-world/lib/life/host.js +24 -0
- package/vendor/dsh-world/lib/life/journal.d.ts +20 -0
- package/vendor/dsh-world/lib/life/journal.js +59 -0
- package/vendor/dsh-world/lib/life/lifeStore.d.ts +16 -0
- package/vendor/dsh-world/lib/life/lifeStore.js +105 -0
- package/vendor/dsh-world/lib/life/messages.d.ts +17 -0
- package/vendor/dsh-world/lib/life/messages.js +53 -0
- package/vendor/dsh-world/lib/life/notify.d.ts +15 -0
- package/vendor/dsh-world/lib/life/notify.js +40 -0
- package/vendor/dsh-world/lib/life/pricing.d.ts +4 -0
- package/vendor/dsh-world/lib/life/pricing.js +30 -0
- package/vendor/dsh-world/lib/life/runtime.d.ts +52 -0
- package/vendor/dsh-world/lib/life/runtime.js +376 -0
- package/vendor/dsh-world/lib/life/toolRegistry.d.ts +22 -0
- package/vendor/dsh-world/lib/life/toolRegistry.js +64 -0
- package/vendor/dsh-world/lib/life/tools.d.ts +24 -0
- package/vendor/dsh-world/lib/life/tools.js +47 -0
- package/vendor/dsh-world/lib/life/types.d.ts +67 -0
- package/vendor/dsh-world/lib/life/types.js +1 -0
- package/vendor/dsh-world/lib/persona.d.ts +10 -0
- package/vendor/dsh-world/lib/persona.js +29 -0
- package/vendor/dsh-world/lib/promptSection.d.ts +30 -0
- package/vendor/dsh-world/lib/promptSection.js +81 -0
- package/vendor/dsh-world/lib/qqScope.d.ts +11 -0
- package/vendor/dsh-world/lib/qqScope.js +39 -0
- package/vendor/dsh-world/lib/runtime.d.ts +23 -0
- package/vendor/dsh-world/lib/runtime.js +206 -0
- package/vendor/dsh-world/lib/self.d.ts +10 -0
- package/vendor/dsh-world/lib/self.js +36 -0
- package/vendor/dsh-world/lib/sourceArchive.d.ts +28 -0
- package/vendor/dsh-world/lib/sourceArchive.js +156 -0
- package/vendor/dsh-world/lib/store.d.ts +30 -0
- package/vendor/dsh-world/lib/store.js +191 -0
- package/vendor/dsh-world/lib/timeContext.d.ts +3 -0
- package/vendor/dsh-world/lib/timeContext.js +13 -0
- package/vendor/dsh-world/lib/types.d.ts +118 -0
- package/vendor/dsh-world/lib/types.js +1 -0
- package/vendor/dsh-world/lib/worldPrompt.d.ts +47 -0
- package/vendor/dsh-world/lib/worldPrompt.js +49 -0
- package/vendor/dsh-world/lib/worldSwitch.d.ts +44 -0
- package/vendor/dsh-world/lib/worldSwitch.js +78 -0
- package/vendor/dsh-world/package-lock.json +1088 -0
- package/vendor/dsh-world/package.json +88 -0
- package/vendor/dsh-world/scripts/enable-tool-free-compaction.ps1 +33 -0
- package/vendor/dsh-world/src/archive.ts +45 -0
- package/vendor/dsh-world/src/archiveSelection.ts +27 -0
- package/vendor/dsh-world/src/compaction.ts +260 -0
- package/vendor/dsh-world/src/compactionRegion.ts +172 -0
- package/vendor/dsh-world/src/console/routes.ts +125 -0
- package/vendor/dsh-world/src/console/snapshot.ts +84 -0
- package/vendor/dsh-world/src/ecosystem/README.md +14 -0
- package/vendor/dsh-world/src/ecosystem/bridge/bridge.ts +121 -0
- package/vendor/dsh-world/src/ecosystem/bridge/route.ts +35 -0
- package/vendor/dsh-world/src/ecosystem/qq/bridge.ts +456 -0
- package/vendor/dsh-world/src/ecosystem/qq/panel.ts +178 -0
- package/vendor/dsh-world/src/ecosystem/qq/route.ts +130 -0
- package/vendor/dsh-world/src/ecosystem/qq/supervisor.ts +262 -0
- package/vendor/dsh-world/src/ecosystem/shared/context.ts +38 -0
- package/vendor/dsh-world/src/ecosystem/shared/identity.ts +42 -0
- package/vendor/dsh-world/src/ecosystem/shared/outlets.ts +75 -0
- package/vendor/dsh-world/src/ecosystem/shared/sessions.ts +47 -0
- package/vendor/dsh-world/src/ecosystem/wechat/archive.ts +66 -0
- package/vendor/dsh-world/src/ecosystem/wechat/home.ts +94 -0
- package/vendor/dsh-world/src/ecosystem/wechat/images.ts +38 -0
- package/vendor/dsh-world/src/ecosystem/wechat/index.ts +101 -0
- package/vendor/dsh-world/src/ecosystem/wechat/messages.ts +43 -0
- package/vendor/dsh-world/src/ecosystem/wechat/sending.ts +177 -0
- package/vendor/dsh-world/src/ecosystem/wechat/supervisor.ts +116 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/README.md +117 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/adapter.py +572 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/binding.py +52 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/engine/LICENSE +43 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/engine/NOTICE.md +10 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/engine/bridge.cpp +229 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/engine/build.ps1 +19 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/engine/profile.json +28 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/groups.py +42 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/incoming.py +157 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/native.py +168 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/outgoing.py +95 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/requirements.txt +1 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/sender.py +157 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/snapshot.py +32 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/stickers.py +60 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/wechat.ps1 +75 -0
- package/vendor/dsh-world/src/faults.ts +12 -0
- package/vendor/dsh-world/src/history.ts +77 -0
- package/vendor/dsh-world/src/hostContract.ts +9 -0
- package/vendor/dsh-world/src/http.ts +34 -0
- package/vendor/dsh-world/src/index.ts +286 -0
- package/vendor/dsh-world/src/life/activity.ts +48 -0
- package/vendor/dsh-world/src/life/alarm.ts +119 -0
- package/vendor/dsh-world/src/life/alarmTimer.ts +45 -0
- package/vendor/dsh-world/src/life/diary.ts +10 -0
- package/vendor/dsh-world/src/life/earlyStop.ts +27 -0
- package/vendor/dsh-world/src/life/home.ts +85 -0
- package/vendor/dsh-world/src/life/host.ts +50 -0
- package/vendor/dsh-world/src/life/journal.ts +44 -0
- package/vendor/dsh-world/src/life/lifeStore.ts +70 -0
- package/vendor/dsh-world/src/life/messages.ts +44 -0
- package/vendor/dsh-world/src/life/notify.ts +47 -0
- package/vendor/dsh-world/src/life/pricing.ts +37 -0
- package/vendor/dsh-world/src/life/runtime.ts +318 -0
- package/vendor/dsh-world/src/life/toolRegistry.ts +48 -0
- package/vendor/dsh-world/src/life/tools.ts +61 -0
- package/vendor/dsh-world/src/life/types.ts +19 -0
- package/vendor/dsh-world/src/persona.ts +26 -0
- package/vendor/dsh-world/src/promptSection.ts +71 -0
- package/vendor/dsh-world/src/qqScope.ts +51 -0
- package/vendor/dsh-world/src/runtime.ts +172 -0
- package/vendor/dsh-world/src/self.ts +32 -0
- package/vendor/dsh-world/src/sourceArchive.ts +132 -0
- package/vendor/dsh-world/src/store.ts +170 -0
- package/vendor/dsh-world/src/timeContext.ts +13 -0
- package/vendor/dsh-world/src/types.ts +112 -0
- package/vendor/dsh-world/src/worldPrompt.ts +64 -0
- package/vendor/dsh-world/src/worldSwitch.ts +82 -0
- package/vendor/dsh-world/templates/alarm.md +49 -0
- package/vendor/dsh-world/templates/world-prompt.md +7 -0
- package/vendor/dsh-world/tests/archive.test.ts +57 -0
- package/vendor/dsh-world/tests/archiveScope.test.ts +86 -0
- package/vendor/dsh-world/tests/bridge.test.ts +211 -0
- package/vendor/dsh-world/tests/channelSessions.test.ts +79 -0
- package/vendor/dsh-world/tests/clientHooks.test.ts +103 -0
- package/vendor/dsh-world/tests/compaction.test.ts +141 -0
- package/vendor/dsh-world/tests/console.test.ts +202 -0
- package/vendor/dsh-world/tests/consoleClient.test.ts +101 -0
- package/vendor/dsh-world/tests/enableCompaction.test.ts +19 -0
- package/vendor/dsh-world/tests/fixtures.ts +6 -0
- package/vendor/dsh-world/tests/history.test.ts +100 -0
- package/vendor/dsh-world/tests/hostFixture.ts +46 -0
- package/vendor/dsh-world/tests/lifeActivity.test.ts +70 -0
- package/vendor/dsh-world/tests/lifeAlarm.test.ts +87 -0
- package/vendor/dsh-world/tests/lifeDiary.test.ts +33 -0
- package/vendor/dsh-world/tests/lifeMessages.test.ts +61 -0
- package/vendor/dsh-world/tests/lifeNotify.test.ts +46 -0
- package/vendor/dsh-world/tests/lifeParts.test.ts +45 -0
- package/vendor/dsh-world/tests/lifeRuntime.test.ts +660 -0
- package/vendor/dsh-world/tests/lifeStore.test.ts +90 -0
- package/vendor/dsh-world/tests/lifeTools.test.ts +53 -0
- package/vendor/dsh-world/tests/outlets.test.ts +85 -0
- package/vendor/dsh-world/tests/panel.test.ts +85 -0
- package/vendor/dsh-world/tests/plugin.test.ts +614 -0
- package/vendor/dsh-world/tests/pricing.test.ts +21 -0
- package/vendor/dsh-world/tests/qq.test.ts +121 -0
- package/vendor/dsh-world/tests/qqSessionMode.test.ts +97 -0
- package/vendor/dsh-world/tests/qqSupervisor.test.ts +149 -0
- package/vendor/dsh-world/tests/sourceArchive.test.ts +58 -0
- package/vendor/dsh-world/tests/store.test.ts +82 -0
- package/vendor/dsh-world/tests/storeWriter.ts +5 -0
- package/vendor/dsh-world/tests/timeContext.test.ts +15 -0
- package/vendor/dsh-world/tests/wechat.test.ts +254 -0
- package/vendor/dsh-world/tests/wechatImages.test.ts +130 -0
- package/vendor/dsh-world/tests/wechatSending.test.ts +142 -0
- package/vendor/dsh-world/tests/wechatSupervisor.test.ts +91 -0
- package/vendor/dsh-world/tests/worldPrompt.test.ts +201 -0
- package/vendor/dsh-world/tsconfig.build.json +5 -0
- package/vendor/dsh-world/tsconfig.json +8 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# dsh-bili-scroll 用的 Python MCP 依赖
|
|
2
|
+
# (基座是 AGI_Ananas 的 bilibili-mcp,MIT;这里只按我们的实测改了版本约束)
|
|
3
|
+
bilibili-api-python>=17.4.1,<18
|
|
4
|
+
aiohttp>=3.9.0
|
|
5
|
+
# 🔴 必须锁 <2:mcp 2.x 的 server 没有 list_tools,起不来(2026-10-09 踩过)
|
|
6
|
+
mcp>=1.0.0,<2
|
|
7
|
+
# 插件用 Python 画登录二维码;不装就只能退回"只给 URL"
|
|
8
|
+
qrcode[pil]>=8.0
|
|
9
|
+
# bili_frames 裁画面帧要 Pillow。qrcode[pil] 会带进来,但那是传递依赖 —— 显式钉住
|
|
10
|
+
Pillow>=9.0
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dsh-meme-maintenance
|
|
3
|
+
description: dsh-meme 表情包图库的维护手册:meme_list 查清单、meme_update 改元数据、扫描新增入库、整理重复与错分类的完整流程。
|
|
4
|
+
whenToUse: 用户要整理/清理/核对表情包图库时——查重复、改分类、改描述、批量修元数据,或手动拷了图片文件要入库。
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# dsh-meme 图库维护手册
|
|
8
|
+
|
|
9
|
+
维护 = 看(meme_list)+ 改(meme_update);删除只在管理面板(不提供 agent 删除,误删成本高)。
|
|
10
|
+
|
|
11
|
+
## 1. 查清单:meme_list
|
|
12
|
+
|
|
13
|
+
- 参数:`q`(关键词,空格分隔多词全命中,按 描述/关键词/文件名 子串筛)、`tag`(分类)、`packId`(只看某个图库)、`limit`(默认 20,最大 100)。
|
|
14
|
+
- 默认范围 = **所有启用中的图库**;每行带 `library`(所属图库)、`tag`、`caption`、`keywords`、`path`。
|
|
15
|
+
- path 约定:**当前激活库不带前缀,其它库带 `packId/` 前缀**。把这个 path 原样传给 meme_update 一定能定位。
|
|
16
|
+
- 清单长就分批:先 `q` 粗筛,再对可疑的几条逐条看。
|
|
17
|
+
|
|
18
|
+
## 2. 改元数据:meme_update
|
|
19
|
+
|
|
20
|
+
- 参数:`path`(必填,用 meme_list/send_meme 候选里的原样) + `tag`/`caption`/`keywords` 至少一项。
|
|
21
|
+
- 只改索引,不动图片文件;没给的字段保留原值。
|
|
22
|
+
- 兼容三种 path:包前缀相对路径、当前库相对路径、绝对路径(IM 模式候选给的是绝对路径)。
|
|
23
|
+
|
|
24
|
+
## 3. 查重复
|
|
25
|
+
|
|
26
|
+
meme_list 没有内建去重,手动思路:
|
|
27
|
+
|
|
28
|
+
1. `meme_list` 按 `q` 拉同主题清单(如 `q=开心`);
|
|
29
|
+
2. 对比 caption 相近/文件名模式相同的行(上传落盘的文件名都是 `时间戳_随机数.扩展名`,人工收藏的常保留原名);
|
|
30
|
+
3. 确认重复后告诉用户哪几张是重复的,**让用户在管理面板里删**(agent 不执行删除)。
|
|
31
|
+
|
|
32
|
+
## 4. 手动拷贝的图片入库(扫描新增)
|
|
33
|
+
|
|
34
|
+
用户把图片文件直接放进图库目录时,面板里不会显示(索引只认 index.db):
|
|
35
|
+
|
|
36
|
+
1. 文件放到图库目录的子目录里,**子目录名就是分类**(如 `memes/work/躺平.gif` → work);散在根目录的会归 `misc`;
|
|
37
|
+
2. 管理面板 → 图库页 → 「扫描新增」;或调管理接口 `scanPack`;
|
|
38
|
+
3. 描述默认取文件名,入库后用 meme_update 补描述/关键词。
|
|
39
|
+
4. **动图 GIF 只能走这条路或面板上传保真**——聊天附件通道会把 GIF 压成单帧,这是宿主行为,无法还原。
|
|
40
|
+
|
|
41
|
+
## 5. 批量整理的推荐流程
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
meme_list (limit=100) # 全量拉一遍看分布
|
|
45
|
+
→ 按 tag 归类出问题清单 # 错分类/缺描述/疑似重复
|
|
46
|
+
→ 逐条 meme_update # 改分类/补描述(一次改一张,失败不影响其它)
|
|
47
|
+
→ 输出整理报告给用户 # 改了什么、建议手删哪些重复
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
注意:改的是**当前激活库以外的库**时也可以直接改(path 带前缀就行),不必让用户先切库。
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Selfloom contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 动图读取:零依赖 GIF 解码 + 胶片条合成。
|
|
3
|
+
*
|
|
4
|
+
* 背景:DSH 的图片入库管线会把动图归一化成单帧,模型看图片时只会看到第一帧,
|
|
5
|
+
* 「动」的信息在到达模型之前就丢了。dsh-meme 的 AI 学图(learn_meme / 上传弹窗的
|
|
6
|
+
* AI 识别)需要看懂表情包的动作,所以这里直接在字节层把 GIF 逐帧解码,按时间均匀
|
|
7
|
+
* 采样,拼成一张「胶片条」PNG 交给模型,并附上帧号/时间说明。
|
|
8
|
+
*
|
|
9
|
+
* 支持范围:
|
|
10
|
+
* - GIF:完整解码(调色板、透明、局部帧、处置方式 disposal、交错 interlace);
|
|
11
|
+
* - 动图 WebP / APNG:只识别元数据(帧数、总时长、是否循环),不做逐帧解码——
|
|
12
|
+
* 这两类要 VP8 / APNG 解码器,违背本插件「零第三方运行依赖」的约定。
|
|
13
|
+
*
|
|
14
|
+
* 所有函数只吃 Buffer、返回 Buffer / 纯对象,不碰文件系统,也不依赖插件上下文。
|
|
15
|
+
* PNG 编码用 node:zlib,不引入依赖。
|
|
16
|
+
*/
|
|
17
|
+
import { deflateSync } from 'node:zlib'
|
|
18
|
+
|
|
19
|
+
/** 胶片条长边上限(像素):再大对视觉模型没有收益,只会让附件变大 */
|
|
20
|
+
const STRIP_MAX_EDGE = 1600
|
|
21
|
+
/** 默认采样帧数 */
|
|
22
|
+
export const ANIM_DEFAULT_FRAMES = 8
|
|
23
|
+
/** 单帧画布像素上限,防超大 GIF 解码炸内存 */
|
|
24
|
+
const ANIM_MAX_PIXELS = 16 * 1024 * 1024
|
|
25
|
+
/** 超过这个帧数的动图不做逐帧解码 */
|
|
26
|
+
const ANIM_MAX_TOTAL_FRAMES = 2000
|
|
27
|
+
|
|
28
|
+
const u16le = (buf, off) => buf[off] | (buf[off + 1] << 8)
|
|
29
|
+
const u24le = (buf, off) => buf[off] | (buf[off + 1] << 8) | (buf[off + 2] << 16)
|
|
30
|
+
const u32be = (buf, off) => ((buf[off] << 24) | (buf[off + 1] << 16) | (buf[off + 2] << 8) | buf[off + 3]) >>> 0
|
|
31
|
+
const ascii = (buf, start, end) => buf.toString('latin1', start, end)
|
|
32
|
+
|
|
33
|
+
/** GIF 数据子块:每块一个长度字节 + 数据,0 结束。pos 指向第一个长度字节。 */
|
|
34
|
+
function skipSubBlocks(buf, pos) {
|
|
35
|
+
let p = pos
|
|
36
|
+
while (p < buf.length) {
|
|
37
|
+
const n = buf[p++]
|
|
38
|
+
if (n === 0) return p
|
|
39
|
+
p += n
|
|
40
|
+
}
|
|
41
|
+
return p
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 结构扫描:不碰像素,只把 GIF 的帧表/时序/循环读出来。
|
|
46
|
+
* 帧数据按子块拼好存进 frames[i].data,供真正需要采样时再解码。
|
|
47
|
+
*/
|
|
48
|
+
function scanGif(buf) {
|
|
49
|
+
if (!Buffer.isBuffer(buf) || buf.length < 13) return null
|
|
50
|
+
const sig = ascii(buf, 0, 6)
|
|
51
|
+
if (sig !== 'GIF87a' && sig !== 'GIF89a') return null
|
|
52
|
+
const width = u16le(buf, 6)
|
|
53
|
+
const height = u16le(buf, 8)
|
|
54
|
+
const packed = buf[10]
|
|
55
|
+
const bgIndex = buf[11]
|
|
56
|
+
let pos = 13
|
|
57
|
+
let gct = null
|
|
58
|
+
if (packed & 0x80) {
|
|
59
|
+
const n = 1 << ((packed & 7) + 1)
|
|
60
|
+
if (pos + n * 3 > buf.length) return null
|
|
61
|
+
gct = buf.subarray(pos, pos + n * 3)
|
|
62
|
+
pos += n * 3
|
|
63
|
+
}
|
|
64
|
+
const frames = []
|
|
65
|
+
let loop = 1
|
|
66
|
+
let hasLoop = false
|
|
67
|
+
// 图形控制扩展只作用于紧跟着的那一帧
|
|
68
|
+
let gce = { delayCs: 0, disposal: 0, transparentIndex: -1 }
|
|
69
|
+
while (pos < buf.length) {
|
|
70
|
+
const block = buf[pos++]
|
|
71
|
+
if (block === 0x3b) break // 文件结束
|
|
72
|
+
if (block === 0x21) {
|
|
73
|
+
if (pos >= buf.length) break
|
|
74
|
+
const label = buf[pos++]
|
|
75
|
+
if (label === 0xf9) {
|
|
76
|
+
const size = buf[pos]
|
|
77
|
+
if (size >= 4) {
|
|
78
|
+
const flags = buf[pos + 1]
|
|
79
|
+
gce = {
|
|
80
|
+
disposal: (flags >> 2) & 7,
|
|
81
|
+
transparentIndex: flags & 1 ? buf[pos + 4] : -1,
|
|
82
|
+
delayCs: buf[pos + 2] | (buf[pos + 3] << 8),
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
pos = skipSubBlocks(buf, pos)
|
|
86
|
+
} else if (label === 0xff) {
|
|
87
|
+
const size = buf[pos]
|
|
88
|
+
const id = ascii(buf, pos + 1, pos + 1 + size)
|
|
89
|
+
const dataPos = pos + 1 + size
|
|
90
|
+
if (id === 'NETSCAPE2.0' || id === 'ANIMEXTS1.0') {
|
|
91
|
+
// 循环块:第一个子块是 [1, loopLo, loopHi];loop=0 表示无限循环
|
|
92
|
+
let p = dataPos
|
|
93
|
+
while (p < buf.length) {
|
|
94
|
+
const n = buf[p++]
|
|
95
|
+
if (n === 0) break
|
|
96
|
+
if (n >= 3 && buf[p] === 1) {
|
|
97
|
+
loop = u16le(buf, p + 1)
|
|
98
|
+
hasLoop = true
|
|
99
|
+
}
|
|
100
|
+
p += n
|
|
101
|
+
}
|
|
102
|
+
pos = p
|
|
103
|
+
} else {
|
|
104
|
+
pos = skipSubBlocks(buf, pos)
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
pos = skipSubBlocks(buf, pos)
|
|
108
|
+
}
|
|
109
|
+
} else if (block === 0x2c) {
|
|
110
|
+
if (pos + 9 > buf.length) return null
|
|
111
|
+
const left = u16le(buf, pos)
|
|
112
|
+
const top = u16le(buf, pos + 2)
|
|
113
|
+
const w = u16le(buf, pos + 4)
|
|
114
|
+
const h = u16le(buf, pos + 6)
|
|
115
|
+
const ipacked = buf[pos + 8]
|
|
116
|
+
pos += 9
|
|
117
|
+
let palette = gct
|
|
118
|
+
if (ipacked & 0x80) {
|
|
119
|
+
const n = 1 << ((ipacked & 7) + 1)
|
|
120
|
+
if (pos + n * 3 > buf.length) return null
|
|
121
|
+
palette = buf.subarray(pos, pos + n * 3)
|
|
122
|
+
pos += n * 3
|
|
123
|
+
}
|
|
124
|
+
if (pos >= buf.length) return null
|
|
125
|
+
const minCodeSize = buf[pos++]
|
|
126
|
+
const end = skipSubBlocks(buf, pos)
|
|
127
|
+
// 把数据子块拼成连续字节,方便 LZW 按位读
|
|
128
|
+
const parts = []
|
|
129
|
+
let p = pos
|
|
130
|
+
while (p < end) {
|
|
131
|
+
const n = buf[p++]
|
|
132
|
+
if (n === 0 || p + n > end) break
|
|
133
|
+
parts.push(buf.subarray(p, p + n))
|
|
134
|
+
p += n
|
|
135
|
+
}
|
|
136
|
+
frames.push({
|
|
137
|
+
left, top, width: w, height: h,
|
|
138
|
+
interlaced: (ipacked & 0x40) !== 0,
|
|
139
|
+
palette,
|
|
140
|
+
minCodeSize,
|
|
141
|
+
data: parts.length === 1 ? parts[0] : Buffer.concat(parts),
|
|
142
|
+
delayMs: gce.delayCs > 0 ? gce.delayCs * 10 : 100,
|
|
143
|
+
disposal: gce.disposal,
|
|
144
|
+
transparentIndex: gce.transparentIndex,
|
|
145
|
+
})
|
|
146
|
+
pos = end
|
|
147
|
+
gce = { delayCs: 0, disposal: 0, transparentIndex: -1 }
|
|
148
|
+
} else {
|
|
149
|
+
// 未知块:结构不可信,按解析失败处理,让调用方回退到普通单帧识别
|
|
150
|
+
return null
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (frames.length === 0) return null
|
|
154
|
+
let totalMs = 0
|
|
155
|
+
for (const f of frames) {
|
|
156
|
+
f.startMs = totalMs
|
|
157
|
+
totalMs += f.delayMs
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
format: 'gif', width, height, bgIndex, gct,
|
|
161
|
+
frames, frameCount: frames.length, totalMs,
|
|
162
|
+
loop: hasLoop ? loop : 1,
|
|
163
|
+
infiniteLoop: hasLoop && loop === 0,
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** LZW 解码:GIF 的变长码(LSB-first),码表最大 4096 项。 */
|
|
168
|
+
function lzwDecode(data, minCodeSize, pixelCount) {
|
|
169
|
+
const out = new Uint8Array(pixelCount)
|
|
170
|
+
let outPos = 0
|
|
171
|
+
const clearCode = 1 << minCodeSize
|
|
172
|
+
const endCode = clearCode + 1
|
|
173
|
+
let codeSize = minCodeSize + 1
|
|
174
|
+
let nextCode = endCode + 1
|
|
175
|
+
const prefix = new Int32Array(4096)
|
|
176
|
+
const suffix = new Uint8Array(4096)
|
|
177
|
+
const firstChar = new Uint8Array(4096)
|
|
178
|
+
for (let i = 0; i < clearCode; i++) {
|
|
179
|
+
prefix[i] = -1
|
|
180
|
+
suffix[i] = i
|
|
181
|
+
firstChar[i] = i
|
|
182
|
+
}
|
|
183
|
+
const stack = new Uint8Array(4097)
|
|
184
|
+
let bitBuf = 0
|
|
185
|
+
let bitCnt = 0
|
|
186
|
+
let pos = 0
|
|
187
|
+
let prev = -1
|
|
188
|
+
while (outPos < pixelCount) {
|
|
189
|
+
while (bitCnt < codeSize) {
|
|
190
|
+
if (pos >= data.length) return out
|
|
191
|
+
bitBuf |= data[pos++] << bitCnt
|
|
192
|
+
bitCnt += 8
|
|
193
|
+
}
|
|
194
|
+
const code = bitBuf & ((1 << codeSize) - 1)
|
|
195
|
+
bitBuf >>>= codeSize
|
|
196
|
+
bitCnt -= codeSize
|
|
197
|
+
if (code === clearCode) {
|
|
198
|
+
codeSize = minCodeSize + 1
|
|
199
|
+
nextCode = endCode + 1
|
|
200
|
+
prev = -1
|
|
201
|
+
continue
|
|
202
|
+
}
|
|
203
|
+
if (code === endCode) break
|
|
204
|
+
let sp = 0
|
|
205
|
+
let c = code
|
|
206
|
+
if (c >= nextCode) {
|
|
207
|
+
// 特殊情形:编码器刚加入的码,解码器还没建好它
|
|
208
|
+
if (prev < 0) break
|
|
209
|
+
stack[sp++] = firstChar[prev]
|
|
210
|
+
c = prev
|
|
211
|
+
}
|
|
212
|
+
while (c >= 0 && sp < stack.length) {
|
|
213
|
+
stack[sp++] = suffix[c]
|
|
214
|
+
c = prefix[c]
|
|
215
|
+
}
|
|
216
|
+
while (sp > 0 && outPos < pixelCount) out[outPos++] = stack[--sp]
|
|
217
|
+
if (prev >= 0 && nextCode < 4096) {
|
|
218
|
+
prefix[nextCode] = prev
|
|
219
|
+
suffix[nextCode] = firstChar[code >= nextCode ? prev : code]
|
|
220
|
+
firstChar[nextCode] = firstChar[prev]
|
|
221
|
+
nextCode++
|
|
222
|
+
if (nextCode === (1 << codeSize) && codeSize < 12) codeSize++
|
|
223
|
+
}
|
|
224
|
+
prev = code
|
|
225
|
+
}
|
|
226
|
+
return out
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** 交错 GIF 的 4 个 pass:解码顺序 → 实际行号 */
|
|
230
|
+
const INTERLACE_PASSES = [[0, 8], [4, 8], [2, 4], [1, 2]]
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* 解码指定帧(必须按顺序解码到目标帧,只保留目标的 RGBA)。
|
|
234
|
+
* 处置方式:
|
|
235
|
+
* - 0/1:保留当前画布;
|
|
236
|
+
* - 2:把该帧矩形恢复成背景色(透明 GIF 恢复透明);
|
|
237
|
+
* - 3:恢复成画该帧之前的画布。
|
|
238
|
+
*/
|
|
239
|
+
export function decodeGifFrames(buf, indices) {
|
|
240
|
+
const meta = scanGif(buf)
|
|
241
|
+
if (!meta) return null
|
|
242
|
+
const { width, height, frames } = meta
|
|
243
|
+
if (width <= 0 || height <= 0 || width * height > ANIM_MAX_PIXELS || frames.length > ANIM_MAX_TOTAL_FRAMES) {
|
|
244
|
+
return { meta, frames: [], tooLarge: true }
|
|
245
|
+
}
|
|
246
|
+
const want = new Set((indices || []).map((n) => Number(n)).filter((n) => n >= 0 && n < frames.length))
|
|
247
|
+
const maxWant = want.size ? Math.max(...want) : -1
|
|
248
|
+
const canvas = new Uint8Array(width * height * 4)
|
|
249
|
+
const out = []
|
|
250
|
+
for (let i = 0; i < frames.length; i++) {
|
|
251
|
+
const f = frames[i]
|
|
252
|
+
const before = f.disposal === 3 ? canvas.slice() : null
|
|
253
|
+
const idx = lzwDecode(f.data, f.minCodeSize, f.width * f.height)
|
|
254
|
+
const palette = f.palette
|
|
255
|
+
const palSize = palette ? (palette.length / 3) | 0 : 0
|
|
256
|
+
const transparent = f.transparentIndex >= 0 ? f.transparentIndex : -1
|
|
257
|
+
const draw = (srcRow, dstY) => {
|
|
258
|
+
const canvasRow = (f.top + dstY) * width + f.left
|
|
259
|
+
if (dstY >= f.height) return
|
|
260
|
+
for (let x = 0; x < f.width; x++) {
|
|
261
|
+
const v = idx[srcRow * f.width + x]
|
|
262
|
+
if (v === transparent) continue
|
|
263
|
+
if (v >= palSize) continue // 调色板外的索引按透明处理,不让未初始化字节污染图片
|
|
264
|
+
const o = (canvasRow + x) * 4
|
|
265
|
+
canvas[o] = palette[v * 3]
|
|
266
|
+
canvas[o + 1] = palette[v * 3 + 1]
|
|
267
|
+
canvas[o + 2] = palette[v * 3 + 2]
|
|
268
|
+
canvas[o + 3] = 255
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (f.interlaced) {
|
|
272
|
+
let row = 0
|
|
273
|
+
for (const [start, step] of INTERLACE_PASSES) {
|
|
274
|
+
for (let y = start; y < f.height; y += step) draw(row++, y)
|
|
275
|
+
}
|
|
276
|
+
} else {
|
|
277
|
+
for (let y = 0; y < f.height; y++) draw(y, y)
|
|
278
|
+
}
|
|
279
|
+
if (want.has(i)) {
|
|
280
|
+
out.push({ index: i, rgba: canvas.slice(), width, height, startMs: f.startMs, delayMs: f.delayMs })
|
|
281
|
+
}
|
|
282
|
+
if (f.disposal === 2) {
|
|
283
|
+
const bg = f.transparentIndex >= 0 ? null : meta.gct && meta.bgIndex * 3 + 2 < meta.gct.length
|
|
284
|
+
? [meta.gct[meta.bgIndex * 3], meta.gct[meta.bgIndex * 3 + 1], meta.gct[meta.bgIndex * 3 + 2]]
|
|
285
|
+
: [0, 0, 0]
|
|
286
|
+
for (let y = 0; y < f.height; y++) {
|
|
287
|
+
const base = (f.top + y) * width + f.left
|
|
288
|
+
if (f.top + y >= height) break
|
|
289
|
+
for (let x = 0; x < f.width; x++) {
|
|
290
|
+
if (f.left + x >= width) break
|
|
291
|
+
const o = (base + x) * 4
|
|
292
|
+
if (bg) {
|
|
293
|
+
canvas[o] = bg[0]
|
|
294
|
+
canvas[o + 1] = bg[1]
|
|
295
|
+
canvas[o + 2] = bg[2]
|
|
296
|
+
canvas[o + 3] = 255
|
|
297
|
+
} else {
|
|
298
|
+
canvas[o] = 0
|
|
299
|
+
canvas[o + 1] = 0
|
|
300
|
+
canvas[o + 2] = 0
|
|
301
|
+
canvas[o + 3] = 0
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
} else if (f.disposal === 3 && before) {
|
|
306
|
+
canvas.set(before)
|
|
307
|
+
}
|
|
308
|
+
// 只解码到最后一个需要的帧:长动图末尾的帧不必白解码一遍
|
|
309
|
+
if (maxWant >= 0 && i >= maxWant) break
|
|
310
|
+
}
|
|
311
|
+
// 按目标顺序返回
|
|
312
|
+
const byIndex = new Map(out.map((f) => [f.index, f]))
|
|
313
|
+
return { meta, frames: [...want].sort((a, b) => a - b).map((i) => byIndex.get(i)).filter(Boolean) }
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/** 按时间均匀采样:让采样点覆盖整段时间轴,而不是只覆盖前几帧。 */
|
|
317
|
+
function sampleIndicesByTime(meta, maxFrames) {
|
|
318
|
+
const n = meta.frames.length
|
|
319
|
+
const k = Math.min(maxFrames, n)
|
|
320
|
+
if (k <= 1) return [0]
|
|
321
|
+
const picked = []
|
|
322
|
+
for (let i = 0; i < k; i++) {
|
|
323
|
+
const t = (meta.totalMs * i) / (k - 1)
|
|
324
|
+
let idx = 0
|
|
325
|
+
while (idx + 1 < n && meta.frames[idx + 1].startMs <= t) idx++
|
|
326
|
+
if (!picked.includes(idx)) picked.push(idx)
|
|
327
|
+
}
|
|
328
|
+
// 极端情况下(时间集中在少数帧)不足 k 帧,按索引补齐
|
|
329
|
+
for (let i = 0; i < n && picked.length < k; i++) {
|
|
330
|
+
if (!picked.includes(i)) picked.push(i)
|
|
331
|
+
}
|
|
332
|
+
return picked.sort((a, b) => a - b)
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/** 最近邻缩放 RGBA 到长边 ≤ limit */
|
|
336
|
+
function scaleRgba(rgba, w, h, limit) {
|
|
337
|
+
const long = Math.max(w, h)
|
|
338
|
+
if (long <= limit) return { rgba, width: w, height: h }
|
|
339
|
+
const ratio = limit / long
|
|
340
|
+
const tw = Math.max(1, Math.round(w * ratio))
|
|
341
|
+
const th = Math.max(1, Math.round(h * ratio))
|
|
342
|
+
const out = new Uint8Array(tw * th * 4)
|
|
343
|
+
for (let y = 0; y < th; y++) {
|
|
344
|
+
const sy = Math.min(h - 1, Math.floor((y * h) / th))
|
|
345
|
+
for (let x = 0; x < tw; x++) {
|
|
346
|
+
const sx = Math.min(w - 1, Math.floor((x * w) / tw))
|
|
347
|
+
const s = (sy * w + sx) * 4
|
|
348
|
+
const o = (y * tw + x) * 4
|
|
349
|
+
out[o] = rgba[s]
|
|
350
|
+
out[o + 1] = rgba[s + 1]
|
|
351
|
+
out[o + 2] = rgba[s + 2]
|
|
352
|
+
out[o + 3] = rgba[s + 3]
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return { rgba: out, width: tw, height: th }
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// ---- 最小 PNG 编码器(8 位 RGBA,filter 0) ----
|
|
359
|
+
|
|
360
|
+
const CRC_TABLE = (() => {
|
|
361
|
+
const table = new Int32Array(256)
|
|
362
|
+
for (let n = 0; n < 256; n++) {
|
|
363
|
+
let c = n
|
|
364
|
+
for (let k = 0; k < 8; k++) c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1
|
|
365
|
+
table[n] = c
|
|
366
|
+
}
|
|
367
|
+
return table
|
|
368
|
+
})()
|
|
369
|
+
|
|
370
|
+
function crc32(buf) {
|
|
371
|
+
let c = 0xffffffff
|
|
372
|
+
for (let i = 0; i < buf.length; i++) c = CRC_TABLE[(c ^ buf[i]) & 0xff] ^ (c >>> 8)
|
|
373
|
+
return (c ^ 0xffffffff) >>> 0
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
function pngChunk(type, data) {
|
|
377
|
+
const head = Buffer.alloc(8)
|
|
378
|
+
head.writeUInt32BE(data.length, 0)
|
|
379
|
+
head.write(type, 4, 4, 'latin1')
|
|
380
|
+
const crc = Buffer.alloc(4)
|
|
381
|
+
crc.writeUInt32BE(crc32(Buffer.concat([Buffer.from(type, 'latin1'), data])), 0)
|
|
382
|
+
return Buffer.concat([head, data, crc])
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/** RGBA 像素 → PNG(Buffer)。窄高 / 宽扁都不做滤波,贴纸色块压缩率足够。 */
|
|
386
|
+
export function encodePng(width, height, rgba) {
|
|
387
|
+
const stride = width * 4
|
|
388
|
+
const raw = Buffer.alloc((stride + 1) * height)
|
|
389
|
+
for (let y = 0; y < height; y++) {
|
|
390
|
+
raw[y * (stride + 1)] = 0 // filter: None
|
|
391
|
+
Buffer.from(rgba.buffer, rgba.byteOffset + y * stride, stride).copy(raw, y * (stride + 1) + 1)
|
|
392
|
+
}
|
|
393
|
+
const ihdr = Buffer.alloc(13)
|
|
394
|
+
ihdr.writeUInt32BE(width, 0)
|
|
395
|
+
ihdr.writeUInt32BE(height, 4)
|
|
396
|
+
ihdr[8] = 8 // bit depth
|
|
397
|
+
ihdr[9] = 6 // color type: RGBA
|
|
398
|
+
ihdr[10] = 0
|
|
399
|
+
ihdr[11] = 0
|
|
400
|
+
ihdr[12] = 0
|
|
401
|
+
return Buffer.concat([
|
|
402
|
+
Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]),
|
|
403
|
+
pngChunk('IHDR', ihdr),
|
|
404
|
+
pngChunk('IDAT', deflateSync(raw, { level: 9 })),
|
|
405
|
+
pngChunk('IEND', Buffer.alloc(0)),
|
|
406
|
+
])
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// ---- 动图格式识别(WebP / APNG 只做元数据) ----
|
|
410
|
+
|
|
411
|
+
function scanWebp(buf) {
|
|
412
|
+
if (buf.length < 12) return null
|
|
413
|
+
if (ascii(buf, 0, 4) !== 'RIFF' || ascii(buf, 8, 12) !== 'WEBP') return null
|
|
414
|
+
let pos = 12
|
|
415
|
+
let animated = false
|
|
416
|
+
let width = 0
|
|
417
|
+
let height = 0
|
|
418
|
+
let frames = 0
|
|
419
|
+
let totalMs = 0
|
|
420
|
+
let loop = 1
|
|
421
|
+
while (pos + 8 <= buf.length) {
|
|
422
|
+
const type = ascii(buf, pos, pos + 4)
|
|
423
|
+
const size = buf.readUInt32LE(pos + 4)
|
|
424
|
+
const dataPos = pos + 8
|
|
425
|
+
const dataEnd = Math.min(buf.length, dataPos + size)
|
|
426
|
+
if (type === 'VP8X' && size >= 10) {
|
|
427
|
+
const flags = buf[dataPos]
|
|
428
|
+
animated = (flags & 0x02) !== 0
|
|
429
|
+
width = 1 + u24le(buf, dataPos + 4)
|
|
430
|
+
height = 1 + u24le(buf, dataPos + 7)
|
|
431
|
+
} else if (type === 'ANIM' && size >= 6) {
|
|
432
|
+
loop = u16le(buf, dataPos + 4)
|
|
433
|
+
} else if (type === 'ANMF' && size >= 16) {
|
|
434
|
+
frames++
|
|
435
|
+
// ANMF 第 12 字节起是 24 位帧时长(毫秒)
|
|
436
|
+
totalMs += u24le(buf, dataPos + 12)
|
|
437
|
+
}
|
|
438
|
+
pos = dataEnd + (size & 1)
|
|
439
|
+
}
|
|
440
|
+
if (!animated || frames < 2) return null
|
|
441
|
+
return { format: 'webp', width, height, frameCount: frames, totalMs, loop, infiniteLoop: loop === 0, decodable: false }
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
function scanApng(buf) {
|
|
445
|
+
if (buf.length < 8) return null
|
|
446
|
+
if (buf[0] !== 0x89 || ascii(buf, 1, 4) !== 'PNG') return null
|
|
447
|
+
let pos = 8
|
|
448
|
+
let width = 0
|
|
449
|
+
let height = 0
|
|
450
|
+
let declaredFrames = 0
|
|
451
|
+
let loop = 1
|
|
452
|
+
let totalMs = 0
|
|
453
|
+
let fcTLCount = 0
|
|
454
|
+
while (pos + 12 <= buf.length) {
|
|
455
|
+
const len = buf.readUInt32BE(pos)
|
|
456
|
+
const type = ascii(buf, pos + 4, pos + 8)
|
|
457
|
+
const dataPos = pos + 8
|
|
458
|
+
if (type === 'IHDR' && len >= 8) {
|
|
459
|
+
width = buf.readUInt32BE(dataPos)
|
|
460
|
+
height = buf.readUInt32BE(dataPos + 4)
|
|
461
|
+
} else if (type === 'acTL' && len >= 8) {
|
|
462
|
+
declaredFrames = buf.readUInt32BE(dataPos)
|
|
463
|
+
loop = buf.readUInt32BE(dataPos + 4)
|
|
464
|
+
} else if (type === 'fcTL' && len >= 26) {
|
|
465
|
+
// fcTL: seq(4) w(4) h(4) x(4) y(4) delay_num(2) delay_den(2) ...
|
|
466
|
+
fcTLCount++
|
|
467
|
+
const num = buf.readUInt16BE(dataPos + 20)
|
|
468
|
+
const den = buf.readUInt16BE(dataPos + 22)
|
|
469
|
+
totalMs += den === 0 ? num * 10 : Math.round((num * 1000) / den)
|
|
470
|
+
} else if (type === 'IEND') {
|
|
471
|
+
break
|
|
472
|
+
}
|
|
473
|
+
pos = dataPos + len + 4
|
|
474
|
+
if (pos <= dataPos) break
|
|
475
|
+
}
|
|
476
|
+
const frameCount = declaredFrames || fcTLCount
|
|
477
|
+
if (frameCount < 2) return null
|
|
478
|
+
return { format: 'png', width, height, frameCount, totalMs, loop, infiniteLoop: loop === 0, decodable: false }
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* 识别动图。返回 null 表示不是动图(或不是 GIF/WebP/APNG)。
|
|
483
|
+
* GIF 的 meta 里带完整帧表(帧数/每帧起始时间/总时长/是否循环)。
|
|
484
|
+
*/
|
|
485
|
+
export function detectAnimation(buf) {
|
|
486
|
+
if (!Buffer.isBuffer(buf) || buf.length < 13) return null
|
|
487
|
+
if (ascii(buf, 0, 6) === 'GIF87a' || ascii(buf, 0, 6) === 'GIF89a') {
|
|
488
|
+
const gif = scanGif(buf)
|
|
489
|
+
if (!gif || gif.frameCount < 2) return null
|
|
490
|
+
return { ...gif, decodable: true }
|
|
491
|
+
}
|
|
492
|
+
if (ascii(buf, 0, 4) === 'RIFF' && ascii(buf, 8, 12) === 'WEBP') return scanWebp(buf)
|
|
493
|
+
if (buf[0] === 0x89 && ascii(buf, 1, 4) === 'PNG') return scanApng(buf)
|
|
494
|
+
return null
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* 构建胶片条:均匀采样最多 maxFrames 帧 → 缩放 → 拼成网格 PNG。
|
|
499
|
+
* 返回 { png, meta, sampled:[{index,startMs,delayMs}], cols, rows, cellWidth, cellHeight }。
|
|
500
|
+
* 非 GIF 动图 / 超出安全上限时返回 null(调用方回退到单帧识别 + 元数据说明)。
|
|
501
|
+
*/
|
|
502
|
+
export function buildAnimationFilmstrip(buf, options = {}) {
|
|
503
|
+
const meta = detectAnimation(buf)
|
|
504
|
+
if (!meta || meta.format !== 'gif' || meta.decodable !== true) return null
|
|
505
|
+
if (meta.width * meta.height > ANIM_MAX_PIXELS || meta.frames.length > ANIM_MAX_TOTAL_FRAMES) return null
|
|
506
|
+
const maxFrames = Math.max(1, Math.min(16, Number(options.maxFrames) || ANIM_DEFAULT_FRAMES))
|
|
507
|
+
const indices = sampleIndicesByTime(meta, maxFrames)
|
|
508
|
+
const decoded = decodeGifFrames(buf, indices)
|
|
509
|
+
if (!decoded || !decoded.frames || decoded.frames.length === 0) return null
|
|
510
|
+
const k = decoded.frames.length
|
|
511
|
+
const cols = k <= 1 ? 1 : k <= 4 ? 2 : k <= 6 ? 3 : 4
|
|
512
|
+
const rows = Math.ceil(k / cols)
|
|
513
|
+
const pad = 6
|
|
514
|
+
const maxEdge = Math.max(640, Math.min(4096, Number(options.maxEdge) || STRIP_MAX_EDGE))
|
|
515
|
+
const cellLimit = Math.max(160, Math.min(768, Math.floor(maxEdge / cols) - pad * 2))
|
|
516
|
+
const scaled = decoded.frames.map((f) => scaleRgba(f.rgba, f.width, f.height, cellLimit))
|
|
517
|
+
const cellWidth = Math.max(...scaled.map((s) => s.width))
|
|
518
|
+
const cellHeight = Math.max(...scaled.map((s) => s.height))
|
|
519
|
+
const stripWidth = cols * cellWidth + (cols + 1) * pad
|
|
520
|
+
const stripHeight = rows * cellHeight + (rows + 1) * pad
|
|
521
|
+
const strip = new Uint8Array(stripWidth * stripHeight * 4)
|
|
522
|
+
// 浅灰底:GIF 的透明区域在 PNG 里是透明的,铺浅灰让模型看清轮廓
|
|
523
|
+
for (let i = 0; i < stripWidth * stripHeight; i++) {
|
|
524
|
+
strip[i * 4] = 240
|
|
525
|
+
strip[i * 4 + 1] = 240
|
|
526
|
+
strip[i * 4 + 2] = 240
|
|
527
|
+
strip[i * 4 + 3] = 255
|
|
528
|
+
}
|
|
529
|
+
scaled.forEach((cell, i) => {
|
|
530
|
+
const col = i % cols
|
|
531
|
+
const row = Math.floor(i / cols)
|
|
532
|
+
const x0 = pad + col * (cellWidth + pad) + Math.floor((cellWidth - cell.width) / 2)
|
|
533
|
+
const y0 = pad + row * (cellHeight + pad) + Math.floor((cellHeight - cell.height) / 2)
|
|
534
|
+
for (let y = 0; y < cell.height; y++) {
|
|
535
|
+
for (let x = 0; x < cell.width; x++) {
|
|
536
|
+
const s = (y * cell.width + x) * 4
|
|
537
|
+
const o = ((y0 + y) * stripWidth + (x0 + x)) * 4
|
|
538
|
+
const a = cell.rgba[s + 3]
|
|
539
|
+
if (a === 0) continue
|
|
540
|
+
if (a === 255) {
|
|
541
|
+
strip[o] = cell.rgba[s]
|
|
542
|
+
strip[o + 1] = cell.rgba[s + 1]
|
|
543
|
+
strip[o + 2] = cell.rgba[s + 2]
|
|
544
|
+
} else {
|
|
545
|
+
// 半透明像素按 alpha 合成到浅灰底
|
|
546
|
+
const alpha = a / 255
|
|
547
|
+
strip[o] = Math.round(cell.rgba[s] * alpha + 240 * (1 - alpha))
|
|
548
|
+
strip[o + 1] = Math.round(cell.rgba[s + 1] * alpha + 240 * (1 - alpha))
|
|
549
|
+
strip[o + 2] = Math.round(cell.rgba[s + 2] * alpha + 240 * (1 - alpha))
|
|
550
|
+
}
|
|
551
|
+
strip[o + 3] = 255
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
})
|
|
555
|
+
return {
|
|
556
|
+
png: encodePng(stripWidth, stripHeight, strip),
|
|
557
|
+
meta,
|
|
558
|
+
sampled: decoded.frames.map((f) => ({ index: f.index, startMs: f.startMs, delayMs: f.delayMs })),
|
|
559
|
+
cols, rows, cellWidth, cellHeight,
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* 给模型看的动图说明。strip 存在时描述胶片条布局+帧时序并要求描述动作;
|
|
565
|
+
* strip 为 null 时(动图 WebP / APNG)说明只看到第一帧。
|
|
566
|
+
*/
|
|
567
|
+
export function animationModelNote(meta, strip) {
|
|
568
|
+
if (!meta || !meta.format) return ''
|
|
569
|
+
const label = meta.format === 'gif' ? 'GIF' : meta.format === 'webp' ? 'WebP' : 'APNG'
|
|
570
|
+
const loopText = meta.loop === 0 ? '无限循环播放' : (meta.loop || 1) === 1 ? '只播放一次' : '循环播放 ' + meta.loop + ' 次'
|
|
571
|
+
const duration = meta.totalMs > 0 ? '总时长 ' + Math.round(meta.totalMs) + ' ms,' : ''
|
|
572
|
+
const lines = ['这是一张 ' + label + ' 动图:共 ' + meta.frameCount + ' 帧,' + duration + loopText + '。']
|
|
573
|
+
if (strip) {
|
|
574
|
+
const sampled = strip.sampled
|
|
575
|
+
.map((f) => '第 ' + f.index + ' 帧(开始于 ' + Math.round(f.startMs) + ' ms,持续 ' + f.delayMs + ' ms)')
|
|
576
|
+
.join('、')
|
|
577
|
+
lines.push('你接下来看到的这张大图是同一段动画的胶片条:' +
|
|
578
|
+
strip.cols + ' 列 × ' + strip.rows + ' 行,从左到右、从上到下按时间顺序排列,' +
|
|
579
|
+
'依次是 ' + sampled + '。')
|
|
580
|
+
lines.push('相邻格子之间不是连续帧,中间还有没采样的帧——看不到的动作不等于没发生。' +
|
|
581
|
+
'请按这段时序描述整段动画的动作/动效(例如「猫疯狂摇头」「鱼弹跳着靠近」),' +
|
|
582
|
+
'tag 仍按情绪分类,caption 写清动作并注明「动图」,keywords 带上动作词。')
|
|
583
|
+
} else {
|
|
584
|
+
lines.push('当前只能逐帧读取 GIF 动图,这张 ' + label + ' 动图无法展开,' +
|
|
585
|
+
'你看到的是第一帧;请按第一帧描述,但可以注明它是动图。')
|
|
586
|
+
}
|
|
587
|
+
return lines.join('\n')
|
|
588
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# dsh-meme bundle patch: host plugin (send_meme + learn_meme + /dsh-memes)
|
|
2
|
+
# and client settings section. Activate with
|
|
3
|
+
# `dsh plugin --profile web add dsh-meme`.
|
|
4
|
+
# 插件 id 仍为 dsh-expression,避免已装用户崩掉。
|
|
5
|
+
# name 必须是实际包名(dsh-meme)——cordis 按 name import 包,
|
|
6
|
+
# 写错会导致新装用户 Cannot find package 'dsh-expression'。
|
|
7
|
+
# 纯 insert(id/name)可热挂载免重启。图库目录不在这里写死——
|
|
8
|
+
# 用户在设置页下拉切换图库,保存到 ~/.dsh/dsh-expression.json;
|
|
9
|
+
# 默认用包内置图库(memes/dafeiyu-001)。历史教训:patch 硬编码某台机器的
|
|
10
|
+
# memeRoot,其他用户安装后指向不存在的目录,插件直接起不来。
|
|
11
|
+
- insert:
|
|
12
|
+
- id: dsh-expression
|
|
13
|
+
name: dsh-meme
|
|
Binary file
|