Skip to content

Commit

Permalink
feat: 增加 GPT 国内代理支持
Browse files Browse the repository at this point in the history
  • Loading branch information
Bistutu committed Feb 17, 2024
1 parent fc4c0d5 commit 92cd15c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions FluentRead.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
// @connect api.moonshot.cn
// @connect fanyi.baidu.com
// @connect gateway.ai.cloudflare.com
// @connect api.chatanywhere.com.cn
// @run-at document-end
// @downloadURL https://update.greasyfork.org/scripts/482986/%E6%B5%81%E7%95%85%E9%98%85%E8%AF%BB.user.js
// @updateURL https://update.greasyfork.org/scripts/482986/%E6%B5%81%E7%95%85%E9%98%85%E8%AF%BB.meta.js
Expand Down Expand Up @@ -322,8 +323,9 @@ const customGPT = {
url = url.trim(); // 去除首尾空格

// 解析 url,确保为 cloudflare 代理或 openai 官方地址
let reg = /https:\/\/gateway.ai.cloudflare.com\/v1\/\w+\/\w+\/openai\/chat\/completions/;
if ( url === this.openai || reg.test(url)) {
let cloudflareReg = /https:\/\/gateway.ai.cloudflare.com\/v1\/\w+\/\w+\/openai\/chat\/completions/;

if (url === this.openai || url === "https://api.chatanywhere.com.cn/v1/chat/completions" || cloudflareReg.test(url)) {
GM_setValue('openai_url', url)
return true
}
Expand Down

0 comments on commit 92cd15c

Please sign in to comment.