From c2cf4d1624dd4ff0a8497c6f798195167935557e Mon Sep 17 00:00:00 2001 From: liuhuapiaoyuan <278780765@qq.com> Date: Sun, 18 Feb 2024 21:50:22 +0800 Subject: [PATCH] fix: update ui version --- .devcontainer/devcontainer.json | 8 +++-- backend-api/backend-api.go | 29 ++++++++++++++----- .../template/LxJWDayKNMzRjO_Ay4ljN/chat.html | 1 + .../LxJWDayKNMzRjO_Ay4ljN/discovery.html | 1 + .../LxJWDayKNMzRjO_Ay4ljN/editor.html | 1 + .../template/LxJWDayKNMzRjO_Ay4ljN/g.html | 1 + .../template/LxJWDayKNMzRjO_Ay4ljN/gc.html | 1 + .../template/LxJWDayKNMzRjO_Ay4ljN/gpts.html | 1 + .../template/LxJWDayKNMzRjO_Ay4ljN/mine.html | 1 + .../template/LxJWDayKNMzRjO_Ay4ljN/slug.html | 1 + 10 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 resource/template/LxJWDayKNMzRjO_Ay4ljN/chat.html create mode 100644 resource/template/LxJWDayKNMzRjO_Ay4ljN/discovery.html create mode 100644 resource/template/LxJWDayKNMzRjO_Ay4ljN/editor.html create mode 100644 resource/template/LxJWDayKNMzRjO_Ay4ljN/g.html create mode 100644 resource/template/LxJWDayKNMzRjO_Ay4ljN/gc.html create mode 100644 resource/template/LxJWDayKNMzRjO_Ay4ljN/gpts.html create mode 100644 resource/template/LxJWDayKNMzRjO_Ay4ljN/mine.html create mode 100644 resource/template/LxJWDayKNMzRjO_Ay4ljN/slug.html diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index de0cad4..1cfadeb 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -23,7 +23,10 @@ "ms-ceintl.vscode-language-pack-zh-hans", "esbenp.prettier-vscode", "vue.volar", - "sourcegraph.cody-ai" + "chunsen.bracket-select", + "golang.go", + "FittenTech.Fitten-Code", + "vscode-icons-team.vscode-icons" ] } }, @@ -32,6 +35,5 @@ "HTTP_PROXY":"", "HTTPS_PROXY":"" }, - "postCreateCommand": "make init", - "remoteUser": "root" + "postCreateCommand": "make init" } diff --git a/backend-api/backend-api.go b/backend-api/backend-api.go index a2b1df5..16406d7 100644 --- a/backend-api/backend-api.go +++ b/backend-api/backend-api.go @@ -148,14 +148,27 @@ func AttachGPT4Mobile(ctx g.Ctx, response *http.Response) error { return returnValue } modifiedBody := string(originalBody) - if strings.Contains(modifiedBody, "gpt-4") { - resJson := gjson.New(modifiedBody) - models := resJson.Get("models").Array() - newObject := gjson.New(`{"capabilities":{},"description":"Browsing, Advanced Data Analysis, and DALL·E are now built into GPT-4","enabled_tools":["tools","tools2"],"max_tokens":32767,"product_features":{"attachments":{"accepted_mime_types":["text/x-csharp","application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/x-tex","text/x-typescript","text/plain","text/x-ruby","application/msword","text/x-php","text/x-c++","text/markdown","application/x-latext","text/x-c","text/javascript","text/html","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/json","text/x-java","application/pdf","text/x-script.python","text/x-sh"],"can_accept_all_mime_types":true,"image_mime_types":["image/jpeg","image/webp","image/gif","image/png"],"type":"retrieval"}},"slug":"gpt-4-mobile","tags":["confidential","gpt4","plus"],"title":"GPT4 (Mobile)"}`) - models = append(models, newObject) - resJson.Set("models", models) - modifiedBody = resJson.String() - } + // if strings.Contains(modifiedBody, "gpt-4") { + // } + resJson := gjson.New(modifiedBody) + models := resJson.Get("models").Array() + newObject := gjson.New(`{"capabilities":{},"description":"Browsing, Advanced Data Analysis, and DALL·E are now built into GPT-4","enabled_tools":["tools","tools2"],"max_tokens":32767,"product_features":{"attachments":{"accepted_mime_types":["text/x-csharp","application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/x-tex","text/x-typescript","text/plain","text/x-ruby","application/msword","text/x-php","text/x-c++","text/markdown","application/x-latext","text/x-c","text/javascript","text/html","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/json","text/x-java","application/pdf","text/x-script.python","text/x-sh"],"can_accept_all_mime_types":true,"image_mime_types":["image/jpeg","image/webp","image/gif","image/png"],"type":"retrieval"}},"slug":"gpt-4-mobile","tags":["confidential","gpt4","plus"],"title":"GPT4 (Mobile)"}`) + models = append(models, newObject) + resJson.Set("models", models) + + categories := resJson.Get("categories").Array() + + categories = append(categories, gjson.New(`{ + "category": "gpt_4", + "human_category_name": "GPT-4", + "subscription_level": "plus", + "default_model": "gpt-4", + "browsing_model": "gpt-4-browsing", + "code_interpreter_model": "gpt-4-code-interpreter", + "plugins_model": "gpt-4-plugins" + }`)) + resJson.Set("categories", categories) + modifiedBody = resJson.String() // 将修改后的内容写回响应体 response.Body = io.NopCloser(bytes.NewBufferString(modifiedBody)) // 更新Content-Length diff --git a/resource/template/LxJWDayKNMzRjO_Ay4ljN/chat.html b/resource/template/LxJWDayKNMzRjO_Ay4ljN/chat.html new file mode 100644 index 0000000..8c042d4 --- /dev/null +++ b/resource/template/LxJWDayKNMzRjO_Ay4ljN/chat.html @@ -0,0 +1 @@ +
{{.envScript}}