From e19045f925bccdc0e097b1ad457f490bd32621c3 Mon Sep 17 00:00:00 2001 From: JustSong Date: Thu, 6 Feb 2025 23:38:29 +0800 Subject: [PATCH 01/13] chore: add deepseek-reasoner --- relay/adaptor/deepseek/constants.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/relay/adaptor/deepseek/constants.go b/relay/adaptor/deepseek/constants.go index ad840bc2..dc1a512a 100644 --- a/relay/adaptor/deepseek/constants.go +++ b/relay/adaptor/deepseek/constants.go @@ -2,5 +2,5 @@ package deepseek var ModelList = []string{ "deepseek-chat", - "deepseek-coder", + "deepseek-reasoner", } From e146b14d462c0f02bdd274537232658e1a30bc15 Mon Sep 17 00:00:00 2001 From: JustSong Date: Fri, 7 Feb 2025 00:01:38 +0800 Subject: [PATCH 02/13] fix: add default API version handling and enhance error message checks for Gemini --- relay/adaptor/gemini/adaptor.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/relay/adaptor/gemini/adaptor.go b/relay/adaptor/gemini/adaptor.go index edae1791..e6e4d051 100644 --- a/relay/adaptor/gemini/adaptor.go +++ b/relay/adaptor/gemini/adaptor.go @@ -7,6 +7,7 @@ import ( "net/http" "github.com/gin-gonic/gin" + "github.com/songquanpeng/one-api/common/helper" channelhelper "github.com/songquanpeng/one-api/relay/adaptor" "github.com/songquanpeng/one-api/relay/adaptor/openai" @@ -29,6 +30,8 @@ func (a *Adaptor) GetRequestURL(meta *meta.Meta) (string, error) { "gemini-2.0-flash-thinking-exp", "gemini-2.0-flash-thinking-exp-01-21": defaultVersion = "v1beta" + default: + defaultVersion = "v1beta" } version := helper.AssignOrDefault(meta.Config.APIVersion, defaultVersion) From 2ae9997f29d80199de2fe9cdfbbed971d60939d1 Mon Sep 17 00:00:00 2001 From: JustSong Date: Fri, 7 Feb 2025 00:03:00 +0800 Subject: [PATCH 03/13] fix: enhance error handling for Gemini API key validation --- monitor/manage.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/monitor/manage.go b/monitor/manage.go index 268d3924..338cd7c5 100644 --- a/monitor/manage.go +++ b/monitor/manage.go @@ -35,6 +35,8 @@ func ShouldDisableChannel(err *model.Error, statusCode int) bool { strings.Contains(lowerMessage, "balance") || strings.Contains(lowerMessage, "permission denied") || strings.Contains(lowerMessage, "organization has been restricted") || // groq + strings.Contains(lowerMessage, "api key not valid") || // gemini + strings.Contains(lowerMessage, "api key expired") || // gemini strings.Contains(lowerMessage, "已欠费") { return true } From faced40d5ba46c7b0491fc5ee370b2b3543d5a31 Mon Sep 17 00:00:00 2001 From: JustSong Date: Fri, 7 Feb 2025 00:06:32 +0800 Subject: [PATCH 04/13] fix: update Docker image workflow to conditionally include arm64 platform --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index f377a3a0..cc3aafff 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -63,7 +63,7 @@ jobs: with: context: . # platforms: linux/amd64,linux/arm64 - platforms: linux/amd64 # TODO disable arm64 for now, because it cause error + platforms: ${{ contains(github.ref, 'alpha') && 'linux/amd64' || 'linux/amd64,linux/arm64' }} push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file From 293ba93ad688b6a51ca2834be7752ebdd723d02b Mon Sep 17 00:00:00 2001 From: JustSong Date: Fri, 7 Feb 2025 00:13:57 +0800 Subject: [PATCH 05/13] fix: remove outdated model from ModelList and add new deepseek models --- relay/adaptor/groq/constants.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/relay/adaptor/groq/constants.go b/relay/adaptor/groq/constants.go index 4d178c8e..2a26b28b 100644 --- a/relay/adaptor/groq/constants.go +++ b/relay/adaptor/groq/constants.go @@ -3,7 +3,6 @@ package groq // https://console.groq.com/docs/models var ModelList = []string{ - "gemma-7b-it", "gemma2-9b-it", "llama-3.1-70b-versatile", "llama-3.1-8b-instant", @@ -23,4 +22,6 @@ var ModelList = []string{ "distil-whisper-large-v3-en", "whisper-large-v3", "whisper-large-v3-turbo", + "deepseek-r1-distill-llama-70b-specdec", + "deepseek-r1-distill-llama-70b", } From 108111ebd32172f24ce136495077ad0469300bc4 Mon Sep 17 00:00:00 2001 From: JustSong Date: Fri, 7 Feb 2025 00:19:23 +0800 Subject: [PATCH 06/13] fix: exclude preview tags from release workflows --- .github/workflows/linux-release.yml | 1 + .github/workflows/macos-release.yml | 1 + .github/workflows/windows-release.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/linux-release.yml b/.github/workflows/linux-release.yml index 161c41e3..08639b15 100644 --- a/.github/workflows/linux-release.yml +++ b/.github/workflows/linux-release.yml @@ -7,6 +7,7 @@ on: tags: - 'v*.*.*' - '!*-alpha*' + - '!*-preview*' workflow_dispatch: inputs: name: diff --git a/.github/workflows/macos-release.yml b/.github/workflows/macos-release.yml index 94b3e47b..74d2aa0a 100644 --- a/.github/workflows/macos-release.yml +++ b/.github/workflows/macos-release.yml @@ -7,6 +7,7 @@ on: tags: - 'v*.*.*' - '!*-alpha*' + - '!*-preview*' workflow_dispatch: inputs: name: diff --git a/.github/workflows/windows-release.yml b/.github/workflows/windows-release.yml index 18641ae8..aed7bb10 100644 --- a/.github/workflows/windows-release.yml +++ b/.github/workflows/windows-release.yml @@ -7,6 +7,7 @@ on: tags: - 'v*.*.*' - '!*-alpha*' + - '!*-preview*' workflow_dispatch: inputs: name: From 2c867251b5a0675726ed6fcc3f54a442259a78e2 Mon Sep 17 00:00:00 2001 From: JustSong Date: Fri, 7 Feb 2025 00:23:13 +0800 Subject: [PATCH 07/13] fix: improve code formatting and readability in Dashboard component --- web/default/src/pages/Dashboard/index.js | 30 +++++++++++++++--------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/web/default/src/pages/Dashboard/index.js b/web/default/src/pages/Dashboard/index.js index fd6a235b..21151519 100644 --- a/web/default/src/pages/Dashboard/index.js +++ b/web/default/src/pages/Dashboard/index.js @@ -1,6 +1,6 @@ -import React, {useEffect, useState} from 'react'; -import {useTranslation} from 'react-i18next'; -import {Card, Grid} from 'semantic-ui-react'; +import React, { useEffect, useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { Card, Grid } from 'semantic-ui-react'; import { Bar, BarChart, @@ -242,7 +242,7 @@ const Dashboard = () => { {t('dashboard.charts.requests.title')} - {/* {summaryData.todayRequests} */} + {/* {summaryData.todayRequests} */}
{ t('dashboard.charts.requests.tooltip'), ]} labelFormatter={(label) => - `${t('dashboard.statistics.tooltip.date')}: ${formatDate(label)}` + `${t( + 'dashboard.statistics.tooltip.date' + )}: ${formatDate(label)}` } /> { {t('dashboard.charts.quota.title')} - {/* + {/* ${summaryData.todayQuota.toFixed(3)} */} @@ -321,11 +323,13 @@ const Dashboard = () => { boxShadow: '0 2px 8px rgba(0,0,0,0.1)', }} formatter={(value) => [ - value, + value.toFixed(6), t('dashboard.charts.quota.tooltip'), ]} labelFormatter={(label) => - `${t('dashboard.statistics.tooltip.date')}: ${formatDate(label)}` + `${t( + 'dashboard.statistics.tooltip.date' + )}: ${formatDate(label)}` } /> { {t('dashboard.charts.tokens.title')} - {/* {summaryData.todayTokens} */} + {/* {summaryData.todayTokens} */}
{ t('dashboard.charts.tokens.tooltip'), ]} labelFormatter={(label) => - `${t('dashboard.statistics.tooltip.date')}: ${formatDate(label)}` + `${t( + 'dashboard.statistics.tooltip.date' + )}: ${formatDate(label)}` } /> { boxShadow: '0 2px 8px rgba(0,0,0,0.1)', }} labelFormatter={(label) => - `${t('dashboard.statistics.tooltip.date')}: ${formatDate(label)}` + `${t('dashboard.statistics.tooltip.date')}: ${formatDate( + label + )}` } /> Date: Fri, 7 Feb 2025 00:33:15 +0800 Subject: [PATCH 08/13] fix: update Docker setup actions to latest versions --- .github/workflows/docker-image.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index cc3aafff..d1e18361 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -32,10 +32,10 @@ jobs: git describe --tags > VERSION - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Log in to Docker Hub uses: docker/login-action@v2 From e0b7e6a9e286b533ed76bd178f637c27497e0056 Mon Sep 17 00:00:00 2001 From: JustSong Date: Fri, 7 Feb 2025 00:39:55 +0800 Subject: [PATCH 09/13] fix: unify version retrieval in Dockerfile build commands --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 10768435..d6e7ee3c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,9 +9,9 @@ RUN npm install --prefix /web/default & \ npm install --prefix /web/air & \ wait -RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat /web/default/VERSION) npm run build --prefix /web/default & \ - DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat /web/berry/VERSION) npm run build --prefix /web/berry & \ - DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat /web/air/VERSION) npm run build --prefix /web/air & \ +RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run build --prefix /web/default & \ + DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run build --prefix /web/berry & \ + DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run build --prefix /web/air & \ wait FROM golang AS builder2 From db65db28077ee66aa23ef4bb673bbde2f9ac832e Mon Sep 17 00:00:00 2001 From: JustSong Date: Fri, 7 Feb 2025 00:48:23 +0800 Subject: [PATCH 10/13] fix: revert sqlite build related changes --- Dockerfile | 45 +++++++++++++++++++-------------------------- go.mod | 4 ++-- go.sum | 8 ++++---- 3 files changed, 25 insertions(+), 32 deletions(-) diff --git a/Dockerfile b/Dockerfile index d6e7ee3c..ade561e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,48 +4,41 @@ WORKDIR /web COPY ./VERSION . COPY ./web . -RUN npm install --prefix /web/default & \ - npm install --prefix /web/berry & \ - npm install --prefix /web/air & \ - wait +WORKDIR /web/default +RUN npm install +RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build -RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run build --prefix /web/default & \ - DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run build --prefix /web/berry & \ - DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run build --prefix /web/air & \ - wait +WORKDIR /web/berry +RUN npm install +RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build -FROM golang AS builder2 +WORKDIR /web/air +RUN npm install +RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build -RUN apt-get update && apt-get install -y --no-install-recommends \ - build-essential \ - sqlite3 libsqlite3-dev \ - && rm -rf /var/lib/apt/lists/* +FROM golang:alpine AS builder2 + +RUN apk add --no-cache g++ ENV GO111MODULE=on \ CGO_ENABLED=1 \ - GOOS=linux \ - CGO_CFLAGS="-I/usr/include" \ - CGO_LDFLAGS="-L/usr/lib" + GOOS=linux WORKDIR /build - ADD go.mod go.sum ./ RUN go mod download - COPY . . COPY --from=builder /web/build ./web/build +RUN go build -trimpath -ldflags "-s -w -X 'github.com/songquanpeng/one-api/common.Version=$(cat VERSION)' -extldflags '-static'" -o one-api -RUN go build -trimpath -ldflags "-s -w -X 'github.com/songquanpeng/one-api/common.Version=$(cat VERSION)'" -o one-api +FROM alpine -# Final runtime image -FROM ubuntu:22.04 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - ca-certificates tzdata bash \ - && rm -rf /var/lib/apt/lists/* +RUN apk update \ + && apk upgrade \ + && apk add --no-cache ca-certificates tzdata \ + && update-ca-certificates 2>/dev/null || true COPY --from=builder2 /build/one-api / - EXPOSE 3000 WORKDIR /data ENTRYPOINT ["/one-api"] \ No newline at end of file diff --git a/go.mod b/go.mod index b726ed44..e558fdbf 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( google.golang.org/api v0.187.0 gorm.io/driver/mysql v1.5.6 gorm.io/driver/postgres v1.5.7 - gorm.io/driver/sqlite v1.5.1 + gorm.io/driver/sqlite v1.5.5 gorm.io/gorm v1.25.10 ) @@ -82,7 +82,7 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-sqlite3 v1.14.24 // indirect + github.com/mattn/go-sqlite3 v1.14.22 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect diff --git a/go.sum b/go.sum index 39541369..c98f1965 100644 --- a/go.sum +++ b/go.sum @@ -163,8 +163,8 @@ github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM= -github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= +github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -306,8 +306,8 @@ gorm.io/driver/mysql v1.5.6 h1:Ld4mkIickM+EliaQZQx3uOJDJHtrd70MxAUqWqlx3Y8= gorm.io/driver/mysql v1.5.6/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM= gorm.io/driver/postgres v1.5.7 h1:8ptbNJTDbEmhdr62uReG5BGkdQyeasu/FZHxI0IMGnM= gorm.io/driver/postgres v1.5.7/go.mod h1:3e019WlBaYI5o5LIdNV+LyxCMNtLOQETBXL2h4chKpA= -gorm.io/driver/sqlite v1.5.1 h1:hYyrLkAWE71bcarJDPdZNTLWtr8XrSjOWyjUYI6xdL4= -gorm.io/driver/sqlite v1.5.1/go.mod h1:7MZZ2Z8bqyfSQA1gYEV6MagQWj3cpUkJj9Z+d1HEMEQ= +gorm.io/driver/sqlite v1.5.5 h1:7MDMtUZhV065SilG62E0MquljeArQZNfJnjd9i9gx3E= +gorm.io/driver/sqlite v1.5.5/go.mod h1:6NgQ7sQWAIFsPrJJl1lSNSu2TABh0ZZ/zm5fosATavE= gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= gorm.io/gorm v1.25.10 h1:dQpO+33KalOA+aFYGlK+EfxcI5MbO7EP2yYygwh9h+s= gorm.io/gorm v1.25.10/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= From 0d5318b1b756ec00cee849ef13e37c577cdbab42 Mon Sep 17 00:00:00 2001 From: JustSong Date: Fri, 7 Feb 2025 01:15:33 +0800 Subject: [PATCH 11/13] revert: fix: revert sqlite build related changes This reverts commit db65db28077ee66aa23ef4bb673bbde2f9ac832e. --- Dockerfile | 45 ++++++++++++++++++++++++++------------------- go.mod | 4 ++-- go.sum | 8 ++++---- 3 files changed, 32 insertions(+), 25 deletions(-) diff --git a/Dockerfile b/Dockerfile index ade561e4..d6e7ee3c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,41 +4,48 @@ WORKDIR /web COPY ./VERSION . COPY ./web . -WORKDIR /web/default -RUN npm install -RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build +RUN npm install --prefix /web/default & \ + npm install --prefix /web/berry & \ + npm install --prefix /web/air & \ + wait -WORKDIR /web/berry -RUN npm install -RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build +RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run build --prefix /web/default & \ + DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run build --prefix /web/berry & \ + DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run build --prefix /web/air & \ + wait -WORKDIR /web/air -RUN npm install -RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build +FROM golang AS builder2 -FROM golang:alpine AS builder2 - -RUN apk add --no-cache g++ +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + sqlite3 libsqlite3-dev \ + && rm -rf /var/lib/apt/lists/* ENV GO111MODULE=on \ CGO_ENABLED=1 \ - GOOS=linux + GOOS=linux \ + CGO_CFLAGS="-I/usr/include" \ + CGO_LDFLAGS="-L/usr/lib" WORKDIR /build + ADD go.mod go.sum ./ RUN go mod download + COPY . . COPY --from=builder /web/build ./web/build -RUN go build -trimpath -ldflags "-s -w -X 'github.com/songquanpeng/one-api/common.Version=$(cat VERSION)' -extldflags '-static'" -o one-api -FROM alpine +RUN go build -trimpath -ldflags "-s -w -X 'github.com/songquanpeng/one-api/common.Version=$(cat VERSION)'" -o one-api -RUN apk update \ - && apk upgrade \ - && apk add --no-cache ca-certificates tzdata \ - && update-ca-certificates 2>/dev/null || true +# Final runtime image +FROM ubuntu:22.04 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates tzdata bash \ + && rm -rf /var/lib/apt/lists/* COPY --from=builder2 /build/one-api / + EXPOSE 3000 WORKDIR /data ENTRYPOINT ["/one-api"] \ No newline at end of file diff --git a/go.mod b/go.mod index e558fdbf..b726ed44 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( google.golang.org/api v0.187.0 gorm.io/driver/mysql v1.5.6 gorm.io/driver/postgres v1.5.7 - gorm.io/driver/sqlite v1.5.5 + gorm.io/driver/sqlite v1.5.1 gorm.io/gorm v1.25.10 ) @@ -82,7 +82,7 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-sqlite3 v1.14.22 // indirect + github.com/mattn/go-sqlite3 v1.14.24 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect diff --git a/go.sum b/go.sum index c98f1965..39541369 100644 --- a/go.sum +++ b/go.sum @@ -163,8 +163,8 @@ github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= -github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM= +github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -306,8 +306,8 @@ gorm.io/driver/mysql v1.5.6 h1:Ld4mkIickM+EliaQZQx3uOJDJHtrd70MxAUqWqlx3Y8= gorm.io/driver/mysql v1.5.6/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM= gorm.io/driver/postgres v1.5.7 h1:8ptbNJTDbEmhdr62uReG5BGkdQyeasu/FZHxI0IMGnM= gorm.io/driver/postgres v1.5.7/go.mod h1:3e019WlBaYI5o5LIdNV+LyxCMNtLOQETBXL2h4chKpA= -gorm.io/driver/sqlite v1.5.5 h1:7MDMtUZhV065SilG62E0MquljeArQZNfJnjd9i9gx3E= -gorm.io/driver/sqlite v1.5.5/go.mod h1:6NgQ7sQWAIFsPrJJl1lSNSu2TABh0ZZ/zm5fosATavE= +gorm.io/driver/sqlite v1.5.1 h1:hYyrLkAWE71bcarJDPdZNTLWtr8XrSjOWyjUYI6xdL4= +gorm.io/driver/sqlite v1.5.1/go.mod h1:7MZZ2Z8bqyfSQA1gYEV6MagQWj3cpUkJj9Z+d1HEMEQ= gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= gorm.io/gorm v1.25.10 h1:dQpO+33KalOA+aFYGlK+EfxcI5MbO7EP2yYygwh9h+s= gorm.io/gorm v1.25.10/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= From 5c81e40612fc5061bb392dba6c059e8dd63d49dc Mon Sep 17 00:00:00 2001 From: JustSong Date: Fri, 7 Feb 2025 01:35:53 +0800 Subject: [PATCH 12/13] fix: update Dockerfile and workflow for improved multi-architecture support --- .github/workflows/docker-image.yml | 5 +++-- Dockerfile | 23 ++++++++++------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index d1e18361..01c58947 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -62,8 +62,9 @@ jobs: uses: docker/build-push-action@v3 with: context: . - # platforms: linux/amd64,linux/arm64 platforms: ${{ contains(github.ref, 'alpha') && 'linux/amd64' || 'linux/amd64,linux/arm64' }} push: true tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + labels: ${{ steps.meta.outputs.labels }} + build-args: | + TARGETARCH=${{ startsWith(matrix.platform, 'linux/arm64') && 'arm64' || 'amd64' }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index d6e7ee3c..fc43cde2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,18 +14,18 @@ RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run buil DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run build --prefix /web/air & \ wait -FROM golang AS builder2 +FROM golang:alpine AS builder2 -RUN apt-get update && apt-get install -y --no-install-recommends \ - build-essential \ - sqlite3 libsqlite3-dev \ - && rm -rf /var/lib/apt/lists/* +RUN apk add --no-cache \ + gcc \ + musl-dev \ + sqlite-dev \ + build-base ENV GO111MODULE=on \ CGO_ENABLED=1 \ GOOS=linux \ - CGO_CFLAGS="-I/usr/include" \ - CGO_LDFLAGS="-L/usr/lib" + GOARCH=$TARGETARCH WORKDIR /build @@ -35,14 +35,11 @@ RUN go mod download COPY . . COPY --from=builder /web/build ./web/build -RUN go build -trimpath -ldflags "-s -w -X 'github.com/songquanpeng/one-api/common.Version=$(cat VERSION)'" -o one-api +RUN go build -trimpath -ldflags "-s -w -X 'github.com/songquanpeng/one-api/common.Version=$(cat VERSION)' -linkmode external -extldflags '-static'" -o one-api -# Final runtime image -FROM ubuntu:22.04 +FROM alpine:latest -RUN apt-get update && apt-get install -y --no-install-recommends \ - ca-certificates tzdata bash \ - && rm -rf /var/lib/apt/lists/* +RUN apk add --no-cache ca-certificates tzdata COPY --from=builder2 /build/one-api / From 2552c68249d180add4ccfdae7ae4c47380d2e9e1 Mon Sep 17 00:00:00 2001 From: JustSong Date: Fri, 7 Feb 2025 01:51:28 +0800 Subject: [PATCH 13/13] fix: update doubao channel name --- web/air/src/constants/channel.constants.js | 2 +- web/berry/src/constants/ChannelConstants.js | 2 +- web/default/src/constants/channel.constants.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web/air/src/constants/channel.constants.js b/web/air/src/constants/channel.constants.js index e7b25399..68ca987a 100644 --- a/web/air/src/constants/channel.constants.js +++ b/web/air/src/constants/channel.constants.js @@ -7,7 +7,7 @@ export const CHANNEL_OPTIONS = [ { key: 24, text: 'Google Gemini', value: 24, color: 'orange' }, { key: 28, text: 'Mistral AI', value: 28, color: 'orange' }, { key: 41, text: 'Novita', value: 41, color: 'purple' }, - { key: 40, text: '字节跳动豆包', value: 40, color: 'blue' }, + {key: 40, text: '火山引擎', value: 40, color: 'blue'}, { key: 15, text: '百度文心千帆', value: 15, color: 'blue' }, { key: 17, text: '阿里通义千问', value: 17, color: 'orange' }, { key: 18, text: '讯飞星火认知', value: 18, color: 'blue' }, diff --git a/web/berry/src/constants/ChannelConstants.js b/web/berry/src/constants/ChannelConstants.js index 375adcd9..4c188d87 100644 --- a/web/berry/src/constants/ChannelConstants.js +++ b/web/berry/src/constants/ChannelConstants.js @@ -49,7 +49,7 @@ export const CHANNEL_OPTIONS = { }, 40: { key: 40, - text: '字节跳动豆包', + text: '火山引擎', value: 40, color: 'primary' }, diff --git a/web/default/src/constants/channel.constants.js b/web/default/src/constants/channel.constants.js index 61425508..8a0c977b 100644 --- a/web/default/src/constants/channel.constants.js +++ b/web/default/src/constants/channel.constants.js @@ -7,7 +7,7 @@ export const CHANNEL_OPTIONS = [ { key: 24, text: 'Google Gemini', value: 24, color: 'orange' }, { key: 28, text: 'Mistral AI', value: 28, color: 'orange' }, { key: 41, text: 'Novita', value: 41, color: 'purple' }, - { key: 40, text: '字节跳动豆包', value: 40, color: 'blue' }, + {key: 40, text: '火山引擎', value: 40, color: 'blue'}, { key: 15, text: '百度文心千帆', value: 15, color: 'blue' }, { key: 17, text: '阿里通义千问', value: 17, color: 'orange' }, { key: 18, text: '讯飞星火认知', value: 18, color: 'blue' },