mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 13:57:10 +00:00
fix: 实现Gemini客户端取代官方版本
This commit is contained in:
parent
6769e9d3f0
commit
bbe769f1aa
9 changed files with 431 additions and 2428 deletions
|
|
@ -1,5 +1,7 @@
|
|||
// workaround for ver 7.x and ver 5.x
|
||||
import HttpsProxyAgent from 'https-proxy-agent'
|
||||
import { Config } from './config.js'
|
||||
import fetch from 'node-fetch'
|
||||
|
||||
let proxy = HttpsProxyAgent
|
||||
if (typeof proxy !== 'function') {
|
||||
|
|
@ -15,3 +17,17 @@ if (typeof proxy !== 'function') {
|
|||
export function getProxy () {
|
||||
return proxy
|
||||
}
|
||||
|
||||
export const newFetch = (url, options = {}) => {
|
||||
const defaultOptions = Config.proxy
|
||||
? {
|
||||
agent: proxy(Config.proxy)
|
||||
}
|
||||
: {}
|
||||
const mergedOptions = {
|
||||
...defaultOptions,
|
||||
...options
|
||||
}
|
||||
|
||||
return fetch(url, mergedOptions)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue