Skip to content

Commit

Permalink
feat: 增加新UI适配,增加ARKOSE_PROXY_URL的适配
Browse files Browse the repository at this point in the history
  • Loading branch information
liuhuapiaoyuan committed May 24, 2024
1 parent 41b3f2b commit 541ed35
Show file tree
Hide file tree
Showing 13 changed files with 195 additions and 58 deletions.
1 change: 1 addition & 0 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func init() {
group.GET("/auth/logout", Logout)
group.GET("/api/auth/session", Session)
group.GET("/public-api/conversation_limit", backendapi.ProxyAll)
group.GET("/public-api/gizmos/discovery/recent", backendapi.ProxyAll)
group.POST("/api/accounts/data_export", NotFound) // 禁用导出
group.POST("/api/payments/checkout", NotFound) // 禁用支付

Expand Down
3 changes: 2 additions & 1 deletion arkose/proxyarkose.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

var (
UpStream = config.CHATPROXY
UpStream = config.ARKOSE_PROXY_URL
proxy *httputil.ReverseProxy
Remote *url.URL
)
Expand All @@ -19,6 +19,7 @@ func init() {
remote, _ := url.Parse(UpStream)
Remote = remote
proxy = httputil.NewSingleHostReverseProxy(remote)

}

func ProxyArkose(r *ghttp.Request) {
Expand Down
78 changes: 39 additions & 39 deletions backend-api/prompt_library.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,44 @@ import (

func Prompt_library(r *ghttp.Request) {

resJson := gjson.New(`
{
"items": [
{
"id": "195cfe2a3",
"title": "开题报告:",
"description": "一个软件工程的毕业开题报告",
"prompt": "请生成一份软件工程的开题报告,主题聚焦于‘基于云计算的敏捷软件开发流程优化’。报告应包含以下关键部分:\r\n\r\n引言:\r\n\r\n简述软件工程的当前挑战,特别是在敏捷开发领域。\r\n解释云计算在现代软件开发中的作用和潜力。\r\n研究目的和动机:\r\n\r\n明确研究的目的,即如何利用云计算优化敏捷软件开发流程。\r\n讨论此研究对软件工程领域的重要性和潜在贡献。\r\n文献综述:\r\n\r\n回顾相关领域的文献,包括敏捷开发方法、云计算技术及其在软件工程中的应用。\r\n识别并讨论现有研究的空白和限制。\r\n研究问题和假设:\r\n\r\n明确要解决的具体研究问题或要验证的假设。\r\n方法论:\r\n\r\n描述将采用的研究方法,包括数据收集和分析技术。\r\n如有可能,提出初步的研究设计和实施计划。\r\n预期结果:\r\n\r\n预测研究可能得出的结果和发现。\r\n讨论这些结果如何帮助解决敏捷软件开发中的实际问题。\r\n研究的局限性和挑战:\r\n\r\n识别可能影响研究结果的潜在局限性和挑战。\r\n时间表和里程碑:\r\n\r\n提供一个详细的研究时间表,列出重要的里程碑和预期完成日期。\r\n报告的语言应清晰、专业,确保内容全面且逻辑连贯。"
},
{
"id": "195cfe2a",
"title": "构思概念",
"description": "一个复古风格的街机游戏",
"prompt": "为一个复古风格的街机游戏构思5个概念。"
},
{
"id": "c25a3687",
"title": "展示一个网站粘性导航的代码片段",
"description": "使用CSS和JavaScript展示一个网站的粘性导航的代码片段",
"prompt": "展示一个网站的粘性导航的CSS和JavaScript代码片段。"
},
{
"id": "9fa376de",
"title": "推荐一道菜",
"description": "以迎合挑食的约会对象",
"prompt": "我要为一个自称挑食的约会对象烹饪。你能推荐一道易于做的菜吗?"
},
{
"id": "b1935e1a",
"title": "解释这段代码:",
"description": "\"cat config.yaml | awk NF\"",
"prompt": "解释这个bash命令的作用:\"cat config.yaml | awk NF\""
}
],
"total": 4,
"limit": 4,
"offset": 0
}
`)
resJson := gjson.New(`{
"items": [
{
"id": "e3c32040",
"title": "为我创建个人网页",
"description": "先问我 3 个问题",
"oneliner": "为我创建个人网页",
"prompt": "为我创建个人网页,需要全部包含在一个文件中。先就你想知道的内容问我 3 个问题。",
"category": "code"
},
{
"id": "38034ee7",
"title": "解释超导体",
"description": "就好比我是一个五岁小孩",
"oneliner": "解释超导体",
"prompt": "把我当做五岁小朋友一样,向我解释超导体。",
"category": "teach-or-explain"
},
{
"id": "f2251c8d",
"title": "给我提供一些主意",
"description": "关于如何处理孩子们的艺术作品",
"oneliner": "如何处理孩子们的艺术作品",
"prompt": "我可以用孩子们的艺术作品做哪五种富有创意的事?我不想把它们扔掉,但也太乱了。",
"category": "idea"
},
{
"id": "a477416b",
"title": "告诉我一个趣事",
"description": "关于罗马帝国",
"oneliner": "关于罗马帝国的趣事",
"prompt": "随便告诉我一个关于罗马帝国的趣事",
"category": "misc"
}
],
"total": 4,
"limit": 4,
"offset": 0
}`)
r.Response.WriteJson(resJson)
}
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ CHATPROXY: "https://chat.openai.com"
JA3_PROXY: "http://a:[email protected]:9988"
#CHATPROXY: "http://host.docker.internal:7999"
#CHATPROXY: "https://chatgpt.ggss.club/gateway"
#ARKOSE_URL: "https://chatgpt.ggss.club/arkose/v2/"
ARKOSE_PROXY_URL: "https://chatgpt1.ggss.club"
# 接入网关的authkey
AUTHKEY: "maidou"
ONLYTOKEN: false
Expand Down
35 changes: 18 additions & 17 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,20 @@ func USERTOKENLOCK(ctx g.Ctx) bool {
}

var (
CHATPROXY = "https://chatproxy-dev.closeai.biz"
DefaultModel = "text-davinci-002-render-sha"
FreeModels = garray.NewStrArray()
Ja3Proxy *url.URL // ja3代理
PlusModels = garray.NewStrArray()
ArkoseUrl = "/v2/"
BuildId = "MCkVH1jJi3yNLkMToVDdU"
CacheBuildId = "MCkVH1jJi3yNLkMToVDdU"
AssetPrefix = "https://oaistatic-cdn.closeai.biz"
PK40 = "35536E1E-65B4-4D96-9D97-6ADB7EFF8147"
ProxyClient *gclient.Client
PK35 = "3D86FBBA-9D22-402A-B512-3420086BA6CC"
envScriptTpl = `
CHATPROXY = "https://chatproxy-dev.closeai.biz"
DefaultModel = "text-davinci-002-render-sha"
FreeModels = garray.NewStrArray()
Ja3Proxy *url.URL // ja3代理
PlusModels = garray.NewStrArray()
ArkoseUrl = "/v2/"
ARKOSE_PROXY_URL = "https://chatproxy-dev.closeai.biz"
BuildId = "MCkVH1jJi3yNLkMToVDdU"
CacheBuildId = "MCkVH1jJi3yNLkMToVDdU"
AssetPrefix = "https://oaistatic-cdn.closeai.biz"
PK40 = "35536E1E-65B4-4D96-9D97-6ADB7EFF8147"
ProxyClient *gclient.Client
PK35 = "3D86FBBA-9D22-402A-B512-3420086BA6CC"
envScriptTpl = `
<script>
window.__arkoseUrl="{{.ArkoseUrl}}";
window.__assetPrefix="{{.AssetPrefix}}";
Expand Down Expand Up @@ -88,10 +89,10 @@ func init() {
PlusModels.Append("gpt-4-plugins")
PlusModels.Append("gpt-4-mobile")
PlusModels.Append("gpt-4-gizmo")
// arkoseUrl := g.Cfg().MustGetWithEnv(ctx, "ARKOSE_URL")
// if !arkoseUrl.IsEmpty() {
// ArkoseUrl = arkoseUrl.String()
// }
arkoseProxyUrl := g.Cfg().MustGetWithEnv(ctx, "ARKOSE_PROXY_URL")
if !arkoseProxyUrl.IsEmpty() {
ARKOSE_PROXY_URL = arkoseProxyUrl.String()
}
chatproxy := g.Cfg().MustGetWithEnv(ctx, "CHATPROXY").String()
if chatproxy != "" {
CHATPROXY = chatproxy
Expand Down
1 change: 1 addition & 0 deletions resource/template/-wRE4Obkm_QOW7PLn1x21/chat.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html data-build="prod-1440a687921de39ff5ee56b92807faaadce73f13"><head>{{.envScript}}<meta charSet="utf-8" /><link rel="apple-touch-icon" sizes="180x180" href="{{.assetPrefix}}/_next/static/media/apple-touch-icon.82af6fe1.png" /><link rel="icon" type="image/png" sizes="32x32" href="{{.assetPrefix}}/_next/static/media/favicon-32x32.630a2b99.png" /><link rel="icon" type="image/png" sizes="16x16" href="{{.assetPrefix}}/_next/static/media/favicon-16x16.a052137e.png" /><link rel="preconnect" href="{{.assetPrefix}}" /><title>ChatGPT</title><meta name="title" content="ChatGPT: Get instant answers, find inspiration, learn something new" /><meta name="description" content="ChatGPT is a free-to-use AI system. Use it for engaging conversations, gain insights, automate tasks, and witness the future of AI, all in one place." /><meta name="keywords" content="ai chat,ai,chap gpt,chat gbt,chat gpt 3,chat gpt login,chat gpt website,chat gpt,chat gtp,chat openai,chat,chatai,chatbot gpt,chatg,chatgpt login,chatgpt,gpt chat,open ai,openai chat,openai chatgpt,openai" /><meta property="og:description" content="A conversational AI system that listens, learns, and challenges" /><meta name="robots" content="index, follow" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta property="og:title" content="ChatGPT" /><meta property="og:image" content="{{.assetPrefix}}/_next/static/media/chatgpt-share-og.49cbbffe.png" /><meta property="og:url" content="https://chatgpt.com" /><meta name="apple-itunes-app" content="app-id=6448311069" /><meta name="viewport" content="width=device-width, initial-scale=1" /><meta name="next-head-count" content="17" /><link rel="preload" href="{{.assetPrefix}}/_next/static/media/soehne-buch.13189857.woff2" as="font" crossorigin /><link rel="preload" href="{{.assetPrefix}}/_next/static/media/soehne-halbfett.977f1845.woff2" as="font" crossorigin /><link rel="preload" href="{{.assetPrefix}}/_next/static/media/soehne-kraftig.204b461c.woff2" as="font" crossorigin /><link data-next-font rel="preconnect" href="/" crossorigin="anonymous" /><link rel="preload" href="{{.assetPrefix}}/_next/static/css/fcb2ec91ddff14ae.css?dpl=1440a687921de39ff5ee56b92807faaadce73f13" as="style" crossorigin="anonymous" /><link rel="stylesheet" href="{{.assetPrefix}}/_next/static/css/fcb2ec91ddff14ae.css?dpl=1440a687921de39ff5ee56b92807faaadce73f13" crossorigin="anonymous" data-n-g /><link rel="preload" href="{{.assetPrefix}}/_next/static/css/8eba3749e745ba24.css?dpl=1440a687921de39ff5ee56b92807faaadce73f13" as="style" crossorigin="anonymous" /><link rel="stylesheet" href="{{.assetPrefix}}/_next/static/css/8eba3749e745ba24.css?dpl=1440a687921de39ff5ee56b92807faaadce73f13" crossorigin="anonymous" data-n-p /><noscript data-n-css></noscript><script defer crossorigin="anonymous" nomodule src="{{.assetPrefix}}/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13"></script><script src="{{.assetPrefix}}/_next/static/chunks/webpack-bd181a68b00e029c.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/framework-fee4e2f3f1e6de63.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/vendor-d3f4073f1ebcdd65.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/main-c5c262a33e3f13d2.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/pages/_app-aecccac8fd61c4d3.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/1f110208-d32e1997faa6ce53.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/6199c948-06eadd6fd753c12d.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/3395-8420aba7793ee719.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/5251-b9e79240c9fef2fa.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/9598-82d584f8303c8c21.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/4601-289d795d7ebd9ae7.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/4814-c851160cc41b1e3f.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/6469-789ec39f6e01c576.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/2707-9cf35e700f9ef0c9.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/9427-ac05e8770a1dc70d.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/3445-87bae5871158bb7f.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/pages/%5B%5B...default%5D%5D-f7aa72dbb09caf74.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/-wRE4Obkm_QOW7PLn1x21/_buildManifest.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/-wRE4Obkm_QOW7PLn1x21/_ssgManifest.js?dpl=1440a687921de39ff5ee56b92807faaadce73f13" defer crossorigin="anonymous"></script></head><body class="antialiased"><div id="__next"><script>!function(){try{var d=document.documentElement,c=d.classList;c.remove('light','dark');var e=localStorage.getItem('theme');if('system'===e||(!e&&true)){var t='(prefers-color-scheme: dark)',m=window.matchMedia(t);if(m.media!==t||m.matches){d.style.colorScheme = 'dark';c.add('dark')}else{d.style.colorScheme = 'light';c.add('light')}}else if(e){c.add(e|| '')}if(e==='light'||e==='dark')d.style.colorScheme=e}catch(e){}}()</script><div class="relative z-0 flex h-full w-full overflow-hidden"><div class="relative flex h-full max-w-full flex-1 flex-col overflow-hidden"><main class="relative h-full w-full flex-1 overflow-auto transition-width"></main></div></div><div class="absolute left-0 right-0 top-0 z-[2]"></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{{.props}}</script><script></script></body></html>
Loading

0 comments on commit 541ed35

Please sign in to comment.