1A2B、以图识番、以图识人、反馈

一觉起来…发现自己摸着摸着又写了几个插件。

koishi-plugin-smmcat-oneatwob 1A2B猜数字
koishi-plugin-smmcat-getanimename 动画截图识别番剧
koishi-plugin-smmcat-animecharacter 动漫图片识别动漫人物

效果还可以,就分享了。不过没搞明白指令和图片之间为什么只有留空才能被识别。这个问题挺大,有解答的吗?

1A2B

动漫识别番剧 (我是官方 api 不方便发送图片,用户可以在插件设置中设置是否加载预览图片)

动漫识别人物

  • 以图整番、以图识人 的接口均为公开并允许调用的,并非抓包。
  • 动漫识人的接口需上传 formData 图片文件,为了方便 koishi 能通过 腾讯的 imageurl 的网络图片地址直接去请求。我用了自己的服务器做了中转。服务器那边只负责将网络图片转成本地图片。(似乎有更好的方案)

还有一个插件是用于用户反馈的。

koishi-plugin-smmcat-feedback 用户反馈

本意是将用户的反馈的内容通过 koishi 的 http 模块发送到后端做合并记录。
作者可以直观看到所有用户的反馈信息,方便能直接和用户们打成一片 (尤其是官方api用户)
另有前端 html 页面负责后端页面的展示。

反馈

前端页面内容 ← 这是一个 html 界面

我的插件反馈区

如若您不小心下载了这个插件,也是能用。不过用的是公共地址,
也就是你们的用户反馈都跑到我的这个后端里去了 ( 似乎成了公共整活闲聊区域2333)

尝试做了图片解析,不过 腾讯 的 图源地址 似乎有防盗链的措施。但有时候能显示

如果自己想单独使用,可以私聊我。我将前后端的文件发给你;后端是 Node.js 前端是 HTML






太麻烦了,我就想直接能用

4 个赞

肝败吓疯
但貌似猜数字插件已经有了https://www.npmjs.com/package/koishi-plugin-guess-number

3 个赞

其实是为了熟悉框架,再写一遍 (

4 个赞

发生未知错误喵~

在一个正常运行的实例中,安装了 smmcat-animecharacter 插件

image
image
bdff4fcc5208e1d10f8ae922eda05970

我想要搜索一张如上图的 gif 图片,但是回复的是【发生未知错误。】

相关的日志信息是这样的:

{"id":7272,"type":"warn","level":2,"name":"command","meta":{},"content":"以图识人 <image url=\"http://127.0.0.1:5141/red_assets/eyJtc2dJZCI6IjczMDkwMzYyOTA4NDY4NzczMjQiLCJjaGF0VHlwZSI6MiwicGVlclVpZCI6IjcwNTUzOTA2NiIsImVsZW1lbnRJZCI6IjczMDkwMzYyOTA4NDY4NzczMjMiLCJtaW1lIjoiaW1hZ2UvZ2lmIiwibWQ1IjoiYmRmZjRmY2M1MjA4ZTFkMTBmOGFlOTIyZWRhMDU5NzAifQ==\"/>\n
AxiosError: Request failed with status code 500\n    
at request (C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\node_modules\\cordis-axios\\lib\\index.js:153:21)\n    
at http (C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\node_modules\\cordis-axios\\lib\\index.js:172:30)\n    
at _Quester.post (C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\node_modules\\cordis-axios\\lib\\index.js:220:16)\n    
at _Command.<anonymous> (C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\node_modules\\koishi-plugin-smmcat-animecharacter\\lib\\index.js:27:36)\n    
at Array.<anonymous> (C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\node_modules\\@koishijs\\core\\lib\\index.cjs:1330:27)\n    
at Object.argv.next (C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\node_modules\\@koishijs\\core\\lib\\index.cjs:1342:60)\n    
at _Command.execute (C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\node_modules\\@koishijs\\core\\lib\\index.cjs:1345:33)\n    
at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    
at async C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\node_modules\\@koishijs\\core\\lib\\index.cjs:2186:22\n    
at async Proxy.withScope (C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\node_modules\\@koishijs\\core\\lib\\index.cjs:2087:22)","timestamp":1701767626247}
{"id":7284,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"unload plugin \u001b[38;5;45msmmcat-animecharacter:2h9ihd\u001b[0m","timestamp":1701767652134}
{"id":7285,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45msmmcat-animecharacter:2h9ihd\u001b[0m","timestamp":1701767653031}

然后吧————这个插件就搜不了其他的了 :sob: :sob: :sob:
image
image

一直提示【请等待上一个搜索指令结束】

但是上一条 搜索结果是【发生未知错误。】啊 :face_holding_back_tears:

即使 移除、删掉插件 ,也还是【请等待上一个搜索指令结束】

怀疑是图片类型问题—— 就重启koishi了,重新使用这个插件搜索一张jpg格式的图片

报错依旧
image

重启koishi后的完整日志如下:

{"id":1,"type":"info","level":2,"name":"app","meta":{},"content":"\u001b[38;5;15;1mKoishi/4.15.6\u001b[0m","timestamp":1701768555280}
{"id":2,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mgroup:entry\u001b[0m","timestamp":1701768555604}
{"id":3,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mgroup:basic\u001b[0m","timestamp":1701768555606}
{"id":4,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mcommands\u001b[0m","timestamp":1701768555614}
{"id":5,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mhelp\u001b[0m","timestamp":1701768555665}
{"id":6,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mlocales\u001b[0m","timestamp":1701768555690}
{"id":7,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mrate-limit\u001b[0m","timestamp":1701768555770}
{"id":8,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mgroup:console\u001b[0m","timestamp":1701768555795}
{"id":9,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45manalytics\u001b[0m","timestamp":1701768555796}
{"id":10,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mconfig\u001b[0m","timestamp":1701768555883}
{"id":11,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mconsole\u001b[0m","timestamp":1701768556061}
{"id":12,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mdataview\u001b[0m","timestamp":1701768556089}
{"id":13,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mdesktop\u001b[0m","timestamp":1701768556103}
{"id":14,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mexplorer\u001b[0m","timestamp":1701768556109}
{"id":15,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mlogger\u001b[0m","timestamp":1701768556315}
{"id":16,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45minsight\u001b[0m","timestamp":1701768556334}
{"id":17,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mmarket\u001b[0m","timestamp":1701768556359}
{"id":18,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45msandbox\u001b[0m","timestamp":1701768556488}
{"id":19,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mstatus\u001b[0m","timestamp":1701768556522}
{"id":20,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mtheme-vanilla\u001b[0m","timestamp":1701768556590}
{"id":21,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mgroup:storage\u001b[0m","timestamp":1701768556595}
{"id":22,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mdatabase-sqlite\u001b[0m","timestamp":1701768556596}
{"id":23,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45massets-local\u001b[0m","timestamp":1701768556695}
{"id":24,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mgroup:adapter\u001b[0m","timestamp":1701768556737}
{"id":25,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45madapter-red:99b71p\u001b[0m","timestamp":1701768556737}
{"id":26,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mrr-su-chat-canary:bb26sn\u001b[0m","timestamp":1701768556889}
{"id":27,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mrr2:io8exg\u001b[0m","timestamp":1701768556925}
{"id":28,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mwaifu:27hp8z\u001b[0m","timestamp":1701768557020}
{"id":29,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mjryspro:0ja4hf\u001b[0m","timestamp":1701768557025}
{"id":30,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mjrrp:hvkgll\u001b[0m","timestamp":1701768557062}
{"id":31,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45m@ifrank/xibao:xxyz6f\u001b[0m","timestamp":1701768557087}
{"id":32,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mpuppeteer:v09mf4\u001b[0m","timestamp":1701768557112}
{"id":33,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45msimple-welcome:kmr1qe\u001b[0m","timestamp":1701768557916}
{"id":34,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mopen-vits:l2rq4g\u001b[0m","timestamp":1701768557932}
{"id":35,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mbeauty-huluxia:bw0apw\u001b[0m","timestamp":1701768557954}
{"id":36,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mschedule:2ogipu\u001b[0m","timestamp":1701768557962}
{"id":37,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45memojimix:fgfhxa\u001b[0m","timestamp":1701768557967}
{"id":38,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mtranslator-youdaoavailable:0z8oml\u001b[0m","timestamp":1701768557972}
{"id":39,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mdivine-oracle:8l46mu\u001b[0m","timestamp":1701768557989}
{"id":40,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mcyber-dream:fl0xzf\u001b[0m","timestamp":1701768557992}
{"id":41,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mqq-estimate:kuim1v\u001b[0m","timestamp":1701768557996}
{"id":42,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mbaidu-image-search:spgzya\u001b[0m","timestamp":1701768558001}
{"id":43,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45malipay-voice:xxdv07\u001b[0m","timestamp":1701768558008}
{"id":44,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mba-logo:6tvxws\u001b[0m","timestamp":1701768558012}
{"id":45,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mping-speed-check:nd8xep\u001b[0m","timestamp":1701768558021}
{"id":46,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mopen-pics:wb4nvj\u001b[0m","timestamp":1701768558025}
{"id":47,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mmemes-api:ldnyjp\u001b[0m","timestamp":1701768558040}
{"id":48,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45msmmcat-saima:4o2lph\u001b[0m","timestamp":1701768558107}
{"id":49,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mname-composition:1cp40r\u001b[0m","timestamp":1701768558121}
{"id":50,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mmonetary:abt4pw\u001b[0m","timestamp":1701768558132}
{"id":51,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mmusic-downloadlink-api:tkt6it\u001b[0m","timestamp":1701768558146}
{"id":52,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mba-plugin:hnzf4c\u001b[0m","timestamp":1701768558212}
{"id":53,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mcpuz:txta5s\u001b[0m","timestamp":1701768560690}
{"id":54,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45memojihub:w96qrz\u001b[0m","timestamp":1701768561269}
{"id":55,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45msmmcat-animecharacter:5hkgjl\u001b[0m","timestamp":1701768561286}
{"id":56,"type":"info","level":2,"name":"assets","meta":{"paths":["group:storage/assets-local"]},"content":"missing config \"selfUrl\", fallback to \"file:\" scheme","timestamp":1701768561381}
{"id":61,"type":"info","level":2,"name":"puppeteer","meta":{"paths":["puppeteer:v09mf4"]},"content":"chrome executable found at \u001b[38;5;201mC:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe\u001b[0m","timestamp":1701768561661}
{"id":63,"type":"info","level":2,"name":"router","meta":{"paths":[""]},"content":"server listening at \u001b[38;5;170mhttp://127.0.0.1:5141\u001b[0m","timestamp":1701768562824}
{"id":64,"type":"info","level":2,"name":"adapter","meta":{"paths":["group:adapter/adapter-red:99b71p"]},"content":"connect to server: \u001b[38;5;44mws://127.0.0.1:16530/\u001b[0m","timestamp":1701768562899}
{"id":65,"type":"info","level":2,"name":"assets","meta":{"paths":["group:storage/assets-local"]},"content":"migrating to data directory","timestamp":1701768562914}
{"id":313,"type":"warn","level":2,"name":"app","meta":{},"content":"SystemError [ERR_FS_EISDIR]: Path is a directory: cp returned EISDIR (\\\\?\\C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\public is a directory (not copied)) \\\\?\\C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\public\n    at new SystemError (node:internal/errors:238:5)\n    at new NodeError (node:internal/errors:349:7)\n    at getStatsForCopy (node:internal/fs/cp/cp:211:11)\n    at async LocalAssets._start (C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\node_modules\\koishi-plugin-assets-local\\lib\\index.js:46:13)","timestamp":1701768566987}
{"id":318,"type":"info","level":2,"name":"memes-api","meta":{},"content":"Plugin setup successfully, loaded 205 memes.","timestamp":1701768569114}
{"id":335,"type":"warn","level":2,"name":"command","meta":{},"content":"以图识人 <image url=\"http://127.0.0.1:5141/red_assets/eyJtc2dJZCI6IjczMDkwNDA0MDU5ODY1MjY1NzEiLCJjaGF0VHlwZSI6MiwicGVlclVpZCI6IjcwNTUzOTA2NiIsImVsZW1lbnRJZCI6IjczMDkwNDA0MDU5ODY1MjY1NzAiLCJtaW1lIjoiaW1hZ2UvanBlZyIsIm1kNSI6ImRlYmIxZTM4MTE2MjI1ODhhN2NhMzExODZiMWVlMGMzIn0=\"/>\nAxiosError: Request failed with status code 500\n    at request (C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\node_modules\\cordis-axios\\lib\\index.js:153:21)\n    at http (C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\node_modules\\cordis-axios\\lib\\index.js:172:30)\n    at _Quester.post (C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\node_modules\\cordis-axios\\lib\\index.js:220:16)\n    at _Command.<anonymous> (C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\node_modules\\koishi-plugin-smmcat-animecharacter\\lib\\index.js:27:36)\n    at Array.<anonymous> (C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\node_modules\\@koishijs\\core\\lib\\index.cjs:1330:27)\n    at Object.argv.next (C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\node_modules\\@koishijs\\core\\lib\\index.cjs:1342:60)\n    at _Command.execute (C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\node_modules\\@koishijs\\core\\lib\\index.cjs:1345:33)\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async C:\\Users\\Administrator\\AppData\\Roaming\\Koishi\\Desktop\\data\\instances\\default\\node_modules\\@koishijs\\core\\lib\\index.cjs:2186:22","timestamp":1701768584111}

唔~

所以是服务器怎么了嘛?

还是运行机器人的服务器要有公网IP吗—— :sob:

1 个赞

正确识别时,会返回文字内容

传入错误内容时不会做后续处理

传入 GIF 图时,接口实际得到的是 jpg 文件

1

  • 中转服务器仍然在运行
  • 插件无需安装别的内容

用户大可放心,因为 smm 已经把能想到的用户奇怪的行为都想过了。

而且我也没把用户的最后行为存入数据库,它仅是一个临时状态。

大概率是你那的网络问题,你手动打开传给 koishi 的那张图片检查一下。目前我复原不了这个 BUG

3 个赞

也可能我没打包最新版本,请更新 0.0.3

3 个赞

}D_YKCQ(X4SY81GI_F)WPV

你画我猜 每次答对后 还会报一次没人答对

image

还有想问下这串数字是什么意思 :wink:

2 个赞

它画我猜这个插件我还没在论坛发布,你就给偷偷下载了。 :smiling_face_with_tear:

这个问题,我还有点纳闷。理论上已经清除了定时器了。

我这个是在 qq适配器 上测试的,这串数字我也不清楚;似乎是时间戳,但是为什么会出现在聊天里呢?

QQ截图20231207195552

问问 @shigma 一下

3 个赞

解决了,请将 koishi-plugin-smmcat-tahuawocai 插件更新到 0.0.2

4 个赞

我觉得跟你截图的代码没有关系,是其他地方的代码发的

4 个赞