TomLBZ / koishi-plugin-openai

Calls OpenAI API for Koishi.js
49 stars 10 forks source link

突然报错 Cannot read properties of undefined (reading '0') #35

Closed zhiwang69 closed 1 year ago

zhiwang69 commented 1 year ago

之前正常,今天重启了一下Koishi,报错

TypeError: Cannot read properties of undefined (reading '0')
                            at AI._updateModels (XXX\Koishi\Desktop\data\instances\default\node_modules\@tomlbz\koishi-plugin-openai\lib\ai.js:80:42)
                            at AI.init (XXX\Koishi\Desktop\data\instances\default\node_modules\@tomlbz\koishi-plugin-openai\lib\ai.js:19:21)
                            at runMicrotasks (<anonymous>)
                            at processTicksAndRejections (node:internal/process/task_queues:96:5)
                            at async XXX\Koishi\Desktop\data\instances\default\node_modules\@tomlbz\koishi-plugin-openai\lib\index.js:35:21

但是我什么都没改过

是不是GET https://api.openai.com/v1/models的返回数据格式变了

Koishi版本:4.12.1(最新) koishi-plugin-openai版本:2.0.6(最新) 下载和更新都是在插件市场里进行的,也没改过源码

zhiwang69 commented 1 year ago

重启后完整的koishi日志如下

2023-03-25 11:15:36 [I] app Koishi/4.12.1
2023-03-25 11:15:36 [I] app apply plugin group:entry
2023-03-25 11:15:36 [I] app apply plugin help
2023-03-25 11:15:36 [I] app apply plugin locales
2023-03-25 11:15:36 [I] app apply plugin group:basic
2023-03-25 11:15:36 [I] app apply plugin group:console
2023-03-25 11:15:36 [I] app apply plugin commands
2023-03-25 11:15:36 [I] app apply plugin rate-limit
2023-03-25 11:15:36 [I] app apply plugin analytics
2023-03-25 11:15:36 [I] app apply plugin console
2023-03-25 11:15:36 [I] app apply plugin desktop
2023-03-25 11:15:36 [I] app apply plugin dataview
2023-03-25 11:15:36 [I] app apply plugin logger
2023-03-25 11:15:36 [I] app apply plugin insight
2023-03-25 11:15:36 [I] app apply plugin market
2023-03-25 11:15:36 [I] app apply plugin sandbox
2023-03-25 11:15:36 [I] app apply plugin group:database
2023-03-25 11:15:36 [I] app apply plugin status
2023-03-25 11:15:36 [I] app apply plugin database-sqlite
2023-03-25 11:15:36 [I] app apply plugin assets-local
2023-03-25 11:15:36 [I] app apply plugin group:adapter
2023-03-25 11:15:36 [I] app apply plugin group:AI
2023-03-25 11:15:36 [I] app apply plugin adapter-onebot:htwkro
2023-03-25 11:15:36 [I] app apply plugin gocqhttp:om2319
2023-03-25 11:15:36 [I] app apply plugin novelai:ry2uvf
2023-03-25 11:15:36 [I] app apply plugin @tomlbz/openai:f5k0dl
2023-03-25 11:15:37 [I] app apply plugin @miemiemie/gpt-girlfriend:i4p52g
2023-03-25 11:15:37 [I] app apply plugin group:0rs1e2
2023-03-25 11:15:37 [I] app apply plugin @miemiemie/gpt-api:pg2ps8
2023-03-25 11:15:37 [I] app apply plugin image-search:kup9yq
2023-03-25 11:15:37 [I] app apply plugin @rinkuto/pixiv:lowrm4
2023-03-25 11:15:37 [I] app apply plugin send-as-image:b2ym8o
2023-03-25 11:15:37 [I] app apply plugin puppeteer:rr9284
2023-03-25 11:15:37 [I] assets missing config "selfUrl", fallback to "file:" scheme
2023-03-25 11:15:37 [I] app apply plugin translator-bing:9blqf3
2023-03-25 11:15:37 [I] app server listening at http://localhost:5140
2023-03-25 11:15:37 [I] puppeteer chrome executable found at C:\Program Files\Google\Chrome\Application\chrome.exe
2023-03-25 11:15:38 [I] locales loading locale zh.yml
2023-03-25 11:15:39 [W] app TypeError: Cannot read properties of undefined (reading '0')
                            at AI._updateModels (XXX\Koishi\Desktop\data\instances\default\node_modules\@tomlbz\koishi-plugin-openai\lib\ai.js:80:42)
                            at AI.init (XXX\Koishi\Desktop\data\instances\default\node_modules\@tomlbz\koishi-plugin-openai\lib\ai.js:19:21)
                            at processTicksAndRejections (node:internal/process/task_queues:96:5)
                            at async XXX\Koishi\Desktop\data\instances\default\node_modules\@tomlbz\koishi-plugin-openai\lib\index.js:35:21
                            at async Promise.all (index 21)
                            at async Lifecycle.flush (XXX\Koishi\Desktop\data\instances\default\node_modules\cordis\lib\index.cjs:77:7)
                            at async Lifecycle.start (XXX\Koishi\Desktop\data\instances\default\node_modules\cordis\lib\index.cjs:164:5)
                            at async start (XXX\Koishi\Desktop\data\instances\default\node_modules\koishi\lib\worker\index.js:171:3)
2023-03-25 11:15:39 [W] gocqhttp Protocol -> device lock is disable. http api may fail.
chu3 commented 1 year ago

+1 💔

ChangqingQ11 commented 1 year ago

+1

TomLBZ commented 1 year ago

2.0.8已修复