From 914f8eaf459bcdc736c48c6f483726d30f7d4953 Mon Sep 17 00:00:00 2001 From: xiaozhou26 Date: Tue, 6 Aug 2024 17:17:25 +0800 Subject: [PATCH] remove 3.5 --- .github/workflows/build.yml | 2 +- conversion/requests/duckgo/convert.go | 3 +-- initialize/handlers.go | 1 + typings/official/response.go | 6 +++--- util/util.go | 5 +++-- web/index.html | 3 +-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6066d72..3dc8b36 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,7 +44,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GHCR_PAT }} with: - tag_name: v2.1.1 + tag_name: v2.1.2 files: | duck2api-linux-amd64.tar.gz duck2api-windows-amd64.tar.gz diff --git a/conversion/requests/duckgo/convert.go b/conversion/requests/duckgo/convert.go index 985f200..007baba 100644 --- a/conversion/requests/duckgo/convert.go +++ b/conversion/requests/duckgo/convert.go @@ -11,12 +11,11 @@ func ConvertAPIRequest(api_request officialtypes.APIRequest) duckgotypes.ApiRequ duckgo_request := duckgotypes.NewApiRequest(inputModel) realModel := inputModel - // 模型映射,简化用户输入模型,例如 gpt-3.5 --> gpt-3.5-turbo-0125 // 如果模型未进行映射,则直接使用输入模型,方便后续用户使用 duckduckgo 添加的新模型。 modelLower := strings.ToLower(inputModel) switch { case strings.HasPrefix(modelLower, "gpt-3.5"): - realModel = "gpt-3.5-turbo-0125" + realModel = "gpt-4o-mini" case strings.HasPrefix(modelLower, "claude-3-haiku"): realModel = "claude-3-haiku-20240307" case strings.HasPrefix(modelLower, "llama-3-70b"): diff --git a/initialize/handlers.go b/initialize/handlers.go index 06afcac..4f3d7a1 100644 --- a/initialize/handlers.go +++ b/initialize/handlers.go @@ -95,6 +95,7 @@ func (h *Handler) engines(c *gin.Context) { // Supported models modelIDs := []string{ + "gpt-4o-mini", "gpt-3.5-turbo-0125", "claude-3-haiku-20240307", "meta-llama/Llama-3-70b-chat-hf", diff --git a/typings/official/response.go b/typings/official/response.go index 67624c2..6dcaaa2 100644 --- a/typings/official/response.go +++ b/typings/official/response.go @@ -31,7 +31,7 @@ func NewChatCompletionChunk(text string) ChatCompletionChunk { ID: "chatcmpl-QXlha2FBbmROaXhpZUFyZUF3ZXNvbWUK", Object: "chat.completion.chunk", Created: 0, - Model: "gpt-3.5-turbo-0301", + Model: "gpt-4o-mini", Choices: []Choices{ { Index: 0, @@ -82,7 +82,7 @@ func StopChunk(reason string) ChatCompletionChunk { ID: "chatcmpl-QXlha2FBbmROaXhpZUFyZUF3ZXNvbWUK", Object: "chat.completion.chunk", Created: 0, - Model: "gpt-3.5-turbo-0125", + Model: "gpt-4o-mini", Choices: []Choices{ { Index: 0, @@ -143,7 +143,7 @@ func NewChatCompletion(full_test string, input_tokens, output_tokens int) ChatCo ID: "chatcmpl-QXlha2FBbmROaXhpZUFyZUF3ZXNvbWUK", Object: "chat.completion", Created: int64(0), - Model: "gpt-3.5-turbo-0125", + Model: "gpt-4o-mini", Usage: usage{ PromptTokens: input_tokens, CompletionTokens: output_tokens, diff --git a/util/util.go b/util/util.go index 367b563..a507c62 100644 --- a/util/util.go +++ b/util/util.go @@ -1,10 +1,11 @@ package util import ( - "github.com/pkoukk/tiktoken-go" "log/slog" "math/rand" "time" + + "github.com/pkoukk/tiktoken-go" ) func RandomLanguage() string { @@ -28,7 +29,7 @@ func RandomHexadecimalString() string { return string(b) } func CountToken(input string) int { - encoding := "gpt-3.5-turbo" + encoding := "gpt-4o-mini" tkm, err := tiktoken.EncodingForModel(encoding) if err != nil { slog.Warn("tiktoken.EncodingForModel error:", err) diff --git a/web/index.html b/web/index.html index 552eaf2..e37178c 100644 --- a/web/index.html +++ b/web/index.html @@ -2476,7 +2476,6 @@