koishijs / novelai-bot

Generate images by NovelAI | 基于 NovelAI 的画图机器人
https://bot.novelai.dev
MIT License
2.49k stars 205 forks source link

在1.7.2及之后的版本中,违禁词功能不生效 #77

Closed AkiraShe closed 2 years ago

AkiraShe commented 2 years ago

Summary

复现到的平台 koishi:在windows桌面版0.7.1、windwos下git拉取后新建模板项目、koishi-android v0.0.3 (windows桌面版0.7.1的情况下)NovelAI bot版本:

版本 违禁词功能
1.6 OK
1.7.0 OK
1.7.1 OK
1.7.2 NG
1.7.3 NG
1.7.5 NG
1.11.5 NG

复现步骤:

forbidden设置中添加 1234,然后在沙盒中执行:约稿 1234 实际结果:1.7.2及之后的版本,带违禁词的约稿会被执行。 期望结果:提示有违禁词。不执行约搞。 概率:必现

在不切换新旧版本的情况下执行“约稿 1234”时,log中没有看到报错。

Logs

2022-10-24 14:22:42[I] appKoishi/4.9.6
2022-10-24 14:22:42[I] app apply plugin group:basic
2022-10-24 14:22:42[I] app apply plugin suggest
2022-10-24 14:22:42[I] app apply plugin rate-limit
2022-10-24 14:22:42[I] app apply plugin group:console
2022-10-24 14:22:42[I] app apply plugin locales
2022-10-24 14:22:42[I] app apply plugin console
2022-10-24 14:22:42[I] app apply plugin dataview
2022-10-24 14:22:42[I] app apply plugin logger
2022-10-24 14:22:42[I] app apply plugin insight
2022-10-24 14:22:42[I] app apply plugin commands
2022-10-24 14:22:42[I] app apply plugin market
2022-10-24 14:22:42[I] app apply plugin sandbox
2022-10-24 14:22:42[I] app apply plugin group:database
2022-10-24 14:22:42[I] app apply plugin status
2022-10-24 14:22:42[I] app apply plugin group:adapter
2022-10-24 14:22:42[I] app apply plugin database-sqlite
2022-10-24 14:22:42[I] app server listening at http://localhost:5140/
2022-10-24 14:22:42[I] app apply plugin gocqhttp
2022-10-24 14:22:42[I] app apply plugin novelai:9gdzhk
2022-10-24 14:22:42[I] sqlite auto updating table user
2022-10-24 14:22:42[I] sqlite auto updating table channel
2022-10-24 14:22:42[I] sqlite auto updating table stats_daily
2022-10-24 14:22:42[I] sqlite auto updating table stats_hourly
2022-10-24 14:22:42[I] sqlite auto updating table stats_longterm
2022-10-24 14:23:44[I] sqlite auto updating table stats_longterm
2022-10-24 14:24:25[I] app unload plugin novelai:9gdzhk
2022-10-24 14:24:29[I] app apply plugin novelai:9gdzhk

Configuration

koishi.yml的内容(邮箱和密码为示例):

host: localhost
port: 5140
maxPort: 5149
plugins:
  group:basic:
    help: null
    rate-limit: null
    suggest: null
    locales: null
    commands: null
    ~admin: null
    ~bind: null
  group:console:
    console:
      open: true
    dataview: null
    logger: null
    insight: null
    market:
      registry:
        endpoint: https://registry.npmmirror.com
      search:
        endpoint: https://registry.koishi.chat/index.json
    sandbox: null
    status: null
    ~auth: null
  group:database:
    database-sqlite: null
    ~database-mysql: null
    ~database-mongo: null
  group:adapter:
    ~adapter-onebot: null
    ~adapter-discord: null
    ~adapter-telegram: null
    ~adapter-kook: null
    gocqhttp: null
  ~novelai:9gdzhk:
    type: login
    email: 123@123.com
    password: 123
    forbidden: '1234'
    allowAnlas: false

Edited by @MaikoTan for better readability

shigma commented 2 years ago

@AkiraShe 感谢您详尽的 bug report。

新版本中的 forbidden 行为修改为了:仍然执行约稿但是将违禁词静默删除。你可以检查这是否符合现在的行为。

如果希望对含有违禁词的情况不执行约稿,我可以考虑增加一个配置项。

AkiraShe commented 2 years ago

@shigma 您好。“静默删除违禁词”这样的设定我觉得是可以的。 但我在1.11.5的测试情况是,实际出图并未屏蔽违禁词: 设置nsfw为违禁词,然后执行:约稿 {{{nsfw}}},1girl 出的是露点图。查看图片tag,也是包含了{{{nsfw}}} image

shigma commented 2 years ago

我晚上研究一下,会尽快修复。


Generated by koishi-plugin-github.

shigma commented 2 years ago
image

我没有复现成功。你能再确认一下是否保存了插件配置吗?

AkiraShe commented 2 years ago

插件配置保存了,koishi.yml中的相应字段也已被更新。为避免社死我把tag换成了1111,结果是一样的,虽然bot反馈的信息里、tag没有1111,但图片是包含tag 1111的(查询是用的https://spell.novelai.dev/) image image image image

AkiraShe commented 2 years ago

log中有以下信息,但并不是执行“约稿 1111”的同时出现的。请参考。

2022-10-24 17:02:58 [W] sqlite SQL > INSERT INTO `stats_daily` (`command`,`dialogue`,`botSend`,`botReceive`,`group`,`time`) VALUES ('{"novelai":4}', '{}', '{"onebot:3060876048":2}', '{"sandbox:koishi":3,"onebot:3060876048":21}', '{"onebot:52084184":2}', 1666540800000)
2022-10-24 17:02:58 [W] sqlite SQL > INSERT INTO `stats_longterm` (`message`,`time`) VALUES (2, 1666540800000)
2022-10-24 17:02:58 [W] app SqliteError: UNIQUE constraint failed: stats_daily.time
                            at SQLiteDriver.#exec (V:\bot\koishi\data\instances\default\node_modules\@minatojs\driver-sqlite\lib\index.js:269:48)
                            at SQLiteDriver.#create (V:\bot\koishi\data\instances\default\node_modules\@minatojs\driver-sqlite\lib\index.js:291:48)
                            at SQLiteDriver.upsert (V:\bot\koishi\data\instances\default\node_modules\@minatojs\driver-sqlite\lib\index.js:256:51)
                            at runMicrotasks (<anonymous>)
                            at processTicksAndRejections (node:internal/process/task_queues:96:5)
                            at async DatabaseService.upsert (V:\bot\koishi\data\instances\default\node_modules\@minatojs\core\lib\index.cjs:529:5)
                            at async _StatisticsProvider._uploadDaily (V:\bot\koishi\data\instances\default\node_modules\@koishijs\plugin-status\lib\index.js:378:5)
                            at async Promise.all (index 0)
                            at async _StatisticsProvider.upload (V:\bot\koishi\data\instances\default\node_modules\@koishijs\plugin-status\lib\index.js:427:7)
AkiraShe commented 2 years ago

我刚发觉我这的basePrompt设置也未生效(这个设置我没改动过),bot生成的图片里没有masterpiece, best quality 而直接用官网生成,Prompt 1111。开关Add Quality Tags是能看出效果的(开了就带masterpiece, best quality)

MaikoTan commented 2 years ago

https://github.com/koishijs/novelai-bot/commit/05e53682cac89f1be993eb2032703f274d66a9c5

Looks like the plugin DO post the "original" prompt to server, rather than the parsed one, until this commit.

Does it work if you update your side to the latest 1.11.6 version?

看起来,在这次提交之前,该插件会向服务器发布 "原始 "提示,而不是解析后的提示。

如果你把你那边更新到最新的1.11.6版本,它能工作吗?

AkiraShe commented 2 years ago

@MaikoTan 我用桌面版V0.7.1,重新启动和全新安装,都未能检测到novel bot 1.11.6的更新,能教我一下其他手动更新的方法吗?谢谢。 image

MaikoTan commented 2 years ago

Sorry I didn't use the koishi desktop. If you could use the terminal, you can just type yarn add koishi-plugin-novelai@^0.11.6 to update it.

对不起,我没有使用恋石桌面。 如果你能够使用终端,你可以输入 yarn add koishi-plugin-novelai@^0.11.6 来更新它。

shigma commented 2 years ago

@AkiraShe 我刚刚手动强制同步了,你再刷新一下看看(刷新按钮在右上角)。

不过 1.11.5 和 1.11.6 似乎没有改变这个行为……

AkiraShe commented 2 years ago

用1.11.6版确认,forbidden和basePrompt中的设置能正常生效了,谢谢!

shigma commented 2 years ago

那我先关闭这个 issue。如果还有问题可以另开。感谢您的反馈。