Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
liuhuapiaoyuan committed May 14, 2024
2 parents c7ea156 + c2ee037 commit 48605c3
Show file tree
Hide file tree
Showing 27 changed files with 2,395 additions and 117 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.8'
services:
mysql:
image: mysql:8
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
command: --mysql-native-password=ON --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
restart: always
# network_mode: host
volumes:
Expand Down
10 changes: 9 additions & 1 deletion README.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# ChatGPT-Mirror-Server

本服务为商业服务,自2024年4月16日0:00不再提供免费接入点需付费使用
1.流量大使用付费接入点或者小流量拼车付费接入点的可打开以下链接选择适合自己的方案
https://xyhelper.cn/access

2.流量小或者小团队自用的可使用蟑螂v1目前蟑螂v1可正常使用,了解详情请访问:
CockroachAi又名蟑螂
https://github.com/cockroachai/cockroachai

## 快速部署脚本

[ChatGPT-Mirror-Server-Deploy](https://github.com/xyhelper/chatgpt-mirror-server-deploy)
Expand All @@ -20,4 +28,4 @@

### TODO
- [] 增加GPTS的隔离
- [] 增加聊天对话过滤规则,每个账号可以配置一个过滤策略,过滤策略采用可视化编排,选择
- [] 增加聊天对话过滤规则,每个账号可以配置一个过滤策略,过滤策略采用可视化编排,选择
2 changes: 1 addition & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func Api2backend(r *ghttp.Request) {
}
officialAccessToken := utility.AccessTokenFormSession(officialSession)

UpStream := config.CHATPROXY(ctx)
UpStream := config.CHATPROXY
u, _ := url.Parse(UpStream)
proxy := httputil.NewSingleHostReverseProxy(u)
proxy.ErrorHandler = func(writer http.ResponseWriter, request *http.Request, e error) {
Expand Down
76 changes: 3 additions & 73 deletions api/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,8 @@ func Index(r *ghttp.Request) {
return
}
model := r.Get("model").String()
props := `
{
"props": {
"pageProps": {
"user": {
"id": "user-xyhelper",
"name": "[email protected]",
"email": "[email protected]",
"image": "/avatars.png",
"picture": "/avatars.png",
"idp": "auth0",
"iat": 2699699364,
"mfa": false,
"groups": [],
"intercom_hash": "30fd0a0ada1c07ce526be7c3d54c22904b80fa7e2713d978630e979e4315cf67"
},
"serviceStatus": {},
"userCountry": "US",
"serviceAnnouncement": {
"paid": {},
"public": {}
},
"serverPrimedAllowBrowserStorageValue": true,
"canManageBrowserStorage": false,
"ageVerificationDeadline": null,
"showCookieConsentBanner": false
},
"__N_SSP": true
},
"page": "/[[...default]]",
"query": {},
"buildId": "wtXFegAXt6bfbujLr1e7S",
"assetPrefix": "",
"isFallback": false,
"gssp": true,
"scriptLoader": []
}`

propsJson := gjson.New(props)
propsJson := gjson.New(Props)
if model != "" {
propsJson.Set("query.model", model)
}
Expand All @@ -80,42 +43,9 @@ func C(r *ghttp.Request) {
convId := r.GetRouter("convId").String()

g.Log().Debug(r.GetCtx(), "convId", convId)
props := `
{
"props": {
"pageProps": {
"user": {
"id": "user-xyhelper",
"name": "[email protected]",
"email": "[email protected]",
"image": "/avatars.png",
"picture": "/avatars.png",
"idp": "auth0",
"iat": 2699699364,
"mfa": false,
"groups": []
},
"serviceStatus": {},
"userCountry": "US",
"serviceAnnouncement": { "paid": {}, "public": {} },
"serverPrimedAllowBrowserStorageValue": true,
"canManageBrowserStorage": false,
"ageVerificationDeadline": null,
"showCookieConsentBanner": false
},
"__N_SSP": true
},
"page": "/[[...default]]",
"query": { "default": ["c", "98d86ec9-fa8b-42ba-98e8-ffd6c1d6cae4"] },
"buildId": "wtXFegAXt6bfbujLr1e7S",
"assetPrefix": "",
"isFallback": false,
"gssp": true,
"scriptLoader": []
}
`

propsJson := gjson.New(props)
propsJson := gjson.New(Props)
propsJson.Set("query.default.0", "c")
propsJson.Set("query.default.1", convId)
propsJson.Set("buildId", config.BuildId)
propsJson.Set("assetPrefix", config.AssetPrefix)
Expand Down
Loading

0 comments on commit 48605c3

Please sign in to comment.