ikechan8370 / chatgpt-plugin

云崽系机器人的智能聊天插件
https://www.yunzai.chat/
GNU General Public License v3.0
998 stars 104 forks source link

设置代理后出错 #549

Closed CC-3301 closed 1 year ago

CC-3301 commented 1 year ago

[MiaoYz][15:35:07.938][ERRO] TypeError: proxy is not a function at newFetch (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/apps/chat.js:102:14) at file:///root/Miao-Yunzai/plugins/chatgpt-plugin/utils/openai/fetch-sse.js:68:42 at step (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/utils/openai/fetch-sse.js:32:23) at Object.next (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/utils/openai/fetch-sse.js:13:53) at file:///root/Miao-Yunzai/plugins/chatgpt-plugin/utils/openai/fetch-sse.js:7:71 at new Promise () at __awaiter (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/utils/openai/fetch-sse.js:3:12) at fetchSSE (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/utils/openai/fetch-sse.js:62:12) at ChatGPTAPI. (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/utils/openai/chatgpt-api.js:202:41) at step (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/utils/openai/chatgpt-api.js:43:23) [MiaoYz][15:35:07.939][ERRO] Error: TypeError: proxy is not a function at chatgpt.sendMessage (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/apps/chat.js:2162:21) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async chatgpt.abstractChat (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/apps/chat.js:1035:25) at async chatgpt (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/apps/chat.js:815:5) at async PluginsLoader.deal (file:///root/Miao-Yunzai/lib/plugins/loader.js:269:54)

HalcyonAlcedo commented 1 year ago

请查看日志,是否有提示未安装https-proxy-agent,请在插件目录下执行pnpm add https-proxy-agent

CC-3301 commented 1 year ago

这次开了debug日志,已在插件目录执行过pnpm add https-proxy-agent [MiaoYz][15:50:27.564][INFO] { previousConversation: { sender: { user_id: 脱敏, nickname: 'CC', card: 'CC' }, ctime: '2023-08-15T07:05:15.590Z', utime: '2023-08-15T07:05:15.590Z', num: 3, conversation: {}, parentMessageId: 'chatcmpl-7niuCLtvIoEObsJRlf0ya5k8lvfBn' } } [MiaoYz][15:50:27.565][MARK] { conversation: { conversationId: undefined, parentMessageId: 'chatcmpl-7niuCLtvIoEObsJRlf0ya5k8lvfBn', clientId: undefined, invocationId: undefined, conversationSignature: undefined, bingToken: undefined } } [MiaoYz][15:50:27.568][MARK] using api mode maxTokens: 1000, numTokens: 438 [MiaoYz][15:50:27.663][ERRO] TypeError: proxy is not a function at newFetch (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/apps/chat.js:102:14) at file:///root/Miao-Yunzai/plugins/chatgpt-plugin/utils/openai/fetch-sse.js:68:42 at step (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/utils/openai/fetch-sse.js:32:23) at Object.next (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/utils/openai/fetch-sse.js:13:53) at file:///root/Miao-Yunzai/plugins/chatgpt-plugin/utils/openai/fetch-sse.js:7:71 at new Promise () at __awaiter (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/utils/openai/fetch-sse.js:3:12) at fetchSSE (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/utils/openai/fetch-sse.js:62:12) at ChatGPTAPI. (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/utils/openai/chatgpt-api.js:202:41) at step (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/utils/openai/chatgpt-api.js:43:23) [MiaoYz][15:50:27.666][ERRO] Error: TypeError: proxy is not a function at chatgpt.sendMessage (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/apps/chat.js:2162:21) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async chatgpt.abstractChat (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/apps/chat.js:1035:25) at async chatgpt (file:///root/Miao-Yunzai/plugins/chatgpt-plugin/apps/chat.js:815:5) at async PluginsLoader.deal (file:///root/Miao-Yunzai/lib/plugins/loader.js:269:54)

ikechan8370 commented 1 year ago

应该是要删除那个依赖才能用吧?我记得前一阵子的pr已经移除了这个依赖 用Yunzai自带的依赖版本可用 你手动add的默认肯定是新版本 不兼容的

CC-3301 commented 1 year ago

新环境,刚pull的Miao-Yunzai和chatgpt-plugin,在插件目录pnpm i后运行,配置代理 测试就是这个报错,再执行pnpm add https-proxy-agent实际没有download任何东西

ikechan8370 commented 1 year ago

执行pnpm ls看看依赖版本

CC-3301 commented 1 year ago
Legend: production dependency, optional only, dev only

chatgpt-plugin /root/Miao-Yunzai/plugins/chatgpt-plugin

dependencies:
@fastify/cookie 8.3.0                          emoji-strip 1.0.1                              node-fetch 3.3.1
@fastify/cors 8.2.0                            eventsource 2.0.2                              openai 3.2.1
@fastify/static 6.9.0                          eventsource-parser 1.0.0                       p-timeout 6.1.2
@fastify/websocket 8.2.0                       fastify 4.18.0                                 quick-lru 6.1.1
@slack/bolt 3.13.2                             form-data 4.0.0                                random 4.1.0
@waylaidwanderer/chatgpt-api 1.37.1            https-proxy-agent 7.0.1                        undici 5.21.0
asn1.js 5.0.0                                  js-tiktoken 1.0.5                              uuid 9.0.0
chatgpt 5.2.4                                  keyv 4.5.3                                     ws 8.13.0
delay 6.0.0                                    keyv-file 0.2.0
diff 5.1.0                                     microsoft-cognitiveservices-speech-sdk 1.30.1

devDependencies:
ts-node 10.9.1
ts-node-register 1.0.0

optionalDependencies:
@node-rs/jieba 1.6.2
jimp 0.22.7
node-silk 0.1.0
puppeteer-extra 3.3.6
puppeteer-extra-plugin-recaptcha 3.6.8
puppeteer-extra-plugin-stealth 2.11.2
sharp 0.32.3
ikechan8370 commented 1 year ago

https-proxy-agent版本为7+了 这个不兼容的 Yunzai用的是5.+ 现在插件依赖已经移除该依赖与Yunzai保持一致 你可以试试在该插件目录下手动移除该依赖

CC-3301 commented 1 year ago
dependencies:
- https-proxy-agent 7.0.1

Done in 9.5s

移除后代理已正常工作