mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 05:47:11 +00:00
fix: 兼容5和7的proxy依赖
This commit is contained in:
parent
5e7d73908f
commit
f620e10abb
8 changed files with 727 additions and 334 deletions
|
|
@ -1,14 +1,8 @@
|
|||
import { Config } from './config.js'
|
||||
import { ChatGPTAPI } from 'chatgpt'
|
||||
import fetch from 'node-fetch'
|
||||
let proxy
|
||||
if (Config.proxy) {
|
||||
try {
|
||||
proxy = (await import('https-proxy-agent')).default
|
||||
} catch (e) {
|
||||
console.warn('未安装https-proxy-agent,请在插件目录下执行pnpm add https-proxy-agent')
|
||||
}
|
||||
}
|
||||
import { getProxy } from './proxy.js'
|
||||
let proxy = getProxy()
|
||||
const newFetch = (url, options = {}) => {
|
||||
const defaultOptions = Config.proxy
|
||||
? {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue