MCPcopy Create free account
hub / github.com/Bistutu/FluentRead / setGPTUrl

Function setGPTUrl

userscripts.js:385–400  ·  view source on GitHub ↗
(model, url)

Source from the content-addressed store, hash-verified

383const customGPT = {
384 openai: "https://api.openai.com/v1/chat/completions",
385 setGPTUrl(model, url) {
386 url = url.trim(); // 去除首尾空格
387 // 解析 url,确保为 cloudflare 代理或 openai 官方地址
388 let cloudflareReg = /https:\/\/gateway.ai.cloudflare.com\/v1\/\w+\/\w+\/openai\/chat\/completions/;
389 if (url === this.openai
390 || url === "https://api.chatanywhere.com.cn/v1/chat/completions"
391 || cloudflareReg.test(url)
392 // 是 127.0.0.1 或 localhost
393 || url.indexOf("127.0.0.1") !== -1
394 || url.indexOf("localhost") !== -1
395 ) {
396 GM_setValue(model + '_url', url)
397 return true
398 }
399 return false
400 },
401 getGPTUrl(model) {
402 if (!model) model = util.getValue('model');
403 return GM_getValue(model + '_url', this.openai)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected