TomLBZ / koishi-plugin-openai

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

api无法调用 #15

Closed spqdem closed 1 year ago

spqdem commented 1 year ago

从3.2号下午起,openai官网大概墙了api调用

TomLBZ commented 1 year ago

兴许大概需要全局代理(?)

spqdem commented 1 year ago

问题已经解决,在clash里面新建规则,添加openai.com,然后选DOMAIN-SUFFIX,然后在koishi的根目录下找到并更改node_modules\openai\dist\common.js,在第146行替换成 const axiosRequestArgs = Object.assign(Object.assign({}, axiosArgs.options), { url: ((configuration === null || configuration === void 0 ? void 0 : configuration.basePath) || basePath) + axiosArgs.url , proxy: { protocol: 'socks5', host: '127.0.0.1', port: 7890 }}); 重新登录koishi并使用clash规则代理即可。

TomLBZ commented 1 year ago

问题已经解决,在clash里面新建规则,添加openai.com,然后选DOMAIN-SUFFIX,然后在koishi的根目录下找到并更改node_modules\openai\dist\common.js,在第146行替换成 const axiosRequestArgs = Object.assign(Object.assign({}, axiosArgs.options), { url: ((configuration === null || configuration === void 0 ? void 0 : configuration.basePath) || basePath) + axiosArgs.url , proxy: { protocol: 'socks5', host: '127.0.0.1', port: 7890 }}); 重新登录koishi并使用clash规则代理即可。

根据此回答,问题已解决