koishijs / novelai-bot

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

Bug: 发生未知错误,沙盒测试无法通过 #181

Closed DyeLA closed 1 year ago

DyeLA commented 1 year ago

Describe the bug

沙盒测试输入nai指令有正确回应help列表,但是加上tag会出现未知错误。

Steps to reproduce

已更新koishi到最新的4.11.9,novelAI插件版本为1.17.3,沙盒测试输入nai或其他对应指令有回应help列表。 但是加上tag后沙盒测试显示发生未知错误,中间也没有显示正在作画。

Expected behavior

已经重装novel插件,依然无法解决问题。

Screenshots

image

Relevant log output

2023-03-05 15:06:31 [E] novelai TypeError: hash_length cannot be null or undefined
at f (C:\Users\Administrator\AppData\Roaming\Koishi\(Desktop(data\instances (default\node_modules\libsodium-
wrappersldist\modules\libsodium-wrappers.js:1:17851)
at m (Cc:\Users Administrator\AppData \Roaming\Koishi\Desktop\data\instances\default\(node_modules \libsodium-
wrappers \dist\modules\libsodium-wrappers.js:1:17895)
at Xe (C:\Users \Administrator \AppData \Roaming\Koishi\Desktop\data\instances\default\node_modules libsodium-
wrappers \dist\modules\libsodium-wrappers.js :1:49004)
at calcAccessKey
(c:\Users \Administrator \AppData\Roaming\Koishi\Desktop\data\instances\default\node_modules
\koishi-plugin-novelai\lib\utils.js:61: 139)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async login
(C: \Users \Administrator\AppData\Roaming(Koishi\Desktop\data\instances\default\node_modules
koishi-plugin-novelai\lib\utils.js :98:18)
at async _Command.<anonymous>
(C: \Users \Administrator\AppData\Roaming\Koishi\Desktop\data\instances\default\node_modules
\koishi-plugin-novelai\lib\index.js:172:21)
at async Array.<anonymous>
(C: \Users\Administrator'ApData Roaming Koishi\Desktop\dataNinstances 'default(node modules(koishijs core\lib\index.cjs:1653:14)

Launcher

Koishi Desktop

Backend

NovelAI (帐号密码)

Versions

Additional context

No response

MaikoTan commented 1 year ago

这很奇怪。

我没有一个有效的novelai账户,所以我不能说这里有什么问题。但如果你能为我们提供更多的信息,将会很有帮助。

  1. 检索 envinfo 并发布在这里

    这很简单,只要打开你的 小石控制台,然后点击右下方的状态栏,envinfo信息就会自动复制到你的剪贴板上。

  2. 打开终端,然后获得更多信息

    首先,你应该打开小石的终端。然后输入yarn why libsodium-wrappers(或者yarn list --pattern 'libsodium-wrappers'如果yarn why不起作用),然后把输出复制到这里。

  3. 登录NovelAI,然后检查你的订阅是否已过期

    进入novelai.net,登录后检查你的订阅。

通过www.DeepL.com/Translator(免费版)翻译

The original text This is weird. I don't have a valid novelai account, so I cannot tell what is wrong here. But it would be helpful if you could provide more information for us. 1. Retrieve the `envinfo` and post here This is simple, just open your "Koishi Console" and then click the status bar at the bottom right, the `envinfo` information would be automatically copied into your clipboard. 2. Open terminal and then get more information First, you should [open the terminal to Koishi](https://forum.koishi.xyz/t/topic/303/3). then type `yarn why libsodium-wrappers` (or `yarn list --pattern 'libsodium-wrappers'` if `yarn why` not work), then copy the output here. 3. Login to NovelAI and then check if your subscription was expired Go to [novelai.net](https://novelai.net/), login and then check your subscription.
acgnmoe commented 1 year ago

我也这个问题

acgnmoe commented 1 year ago

2023-03-20 12:00:16 [E] novelai TypeError: hash_length cannot be null or undefined at f (/koishi/node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js:1:17851) at m (/koishi/node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js:1:17895) at Xe (/koishi/node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js:1:49004) at calcAccessKey (/koishi/node_modules/koishi-plugin-novelai/lib/utils.js:61:139) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async login (/koishi/node_modules/koishi-plugin-novelai/lib/utils.js:98:18) at async _Command. (/koishi/node_modules/koishi-plugin-novelai/lib/index.js:172:21) at async Array. (/koishi/node_modules/@koishijs/core/lib/index.cjs:1660:14)

acgnmoe commented 1 year ago

[运行完毕] yarn why libsodium-wrappers [1/4] Why do we have the module "libsodium-wrappers"...? [2/4] Initialising dependency graph... [3/4] Finding dependency... [4/4] Calculating file sizes... info => Found "libsodium-wrappers@0.7.11" info Reasons this module exists

shigma commented 1 year ago

这个得看下你们的配置项了,type 用的哪个?

DyeLA commented 1 year ago

这个得看下你们的配置项了,type 用的哪个?

使用账号密码登录和授权令牌登录,均为此错误信息。

MaikoTan commented 1 year ago

看起来像是来自libsodium-wrapper的错误,我们的常量crypto_pwhash_SALTBYTES在这里使用

https://github.com/koishijs/novelai-bot/blob/d9e345df9f9b1e2ccc88d1af359a9c51ea6cb2ca/src/utils.ts#L69

是在0.7.9版本后未被定义。

我用下面的代码进行了测试,它在0.7.8版本时输出16,但在0.7.9、0.7.10和0.7.11版本时未定义

const libsodium = require('libsodium-wrappers')

;(async () => {
  await libsodium.ready
  console.log(libsodium.crypto_pwhash_SALTBYTES)
})()

另一方面,sumo版本(libsodium-wrappers-sumo)在每个版本都运行良好,也许我们可以改用sumo版本,它是用Emscripten编译的WASM。

通过www.DeepL.com/Translator(免费版)翻译

Click to expand original text It looks like the bug from `libsodium-wrapper`, the constant `crypto_pwhash_SALTBYTES` we are using here https://github.com/koishijs/novelai-bot/blob/d9e345df9f9b1e2ccc88d1af359a9c51ea6cb2ca/src/utils.ts#L69 is undefined after version 0.7.9. I tested with the code below, it outputs `16` at version 0.7.8, but `undefined` at version 0.7.9, 0.7.10 and 0.7.11. ```js const libsodium = require('libsodium-wrappers') ;(async () => { await libsodium.ready console.log(libsodium.crypto_pwhash_SALTBYTES) })() ``` On the other hand, the `sumo` version (`libsodium-wrappers-sumo`) works well at every version, maybe we could switch to the `sumo` version instead, which is WASM compiled with [Emscripten](https://github.com/kripken/emscripten).
TeoZler commented 1 year ago

出现同样的错误。请问目前这个bug是否有临时的解决方案?