Compare commits

...

27 Commits

Author SHA1 Message Date
JustSong
5c81e40612 fix: update Dockerfile and workflow for improved multi-architecture support 2025-02-07 01:35:53 +08:00
JustSong
0d5318b1b7 revert: fix: revert sqlite build related changes
This reverts commit db65db2807.
2025-02-07 01:15:33 +08:00
JustSong
db65db2807 fix: revert sqlite build related changes 2025-02-07 00:48:23 +08:00
JustSong
e0b7e6a9e2 fix: unify version retrieval in Dockerfile build commands 2025-02-07 00:39:55 +08:00
JustSong
27c2abe80f fix: update Docker setup actions to latest versions 2025-02-07 00:33:15 +08:00
JustSong
2c867251b5 fix: improve code formatting and readability in Dashboard component 2025-02-07 00:23:13 +08:00
JustSong
108111ebd3 fix: exclude preview tags from release workflows 2025-02-07 00:19:23 +08:00
JustSong
293ba93ad6 fix: remove outdated model from ModelList and add new deepseek models 2025-02-07 00:13:57 +08:00
JustSong
faced40d5b fix: update Docker image workflow to conditionally include arm64 platform 2025-02-07 00:06:32 +08:00
JustSong
2ae9997f29 fix: enhance error handling for Gemini API key validation 2025-02-07 00:03:00 +08:00
JustSong
e146b14d46 fix: add default API version handling and enhance error message checks for Gemini 2025-02-07 00:01:38 +08:00
JustSong
e19045f925 chore: add deepseek-reasoner 2025-02-06 23:38:29 +08:00
JustSong
d2903b673d fix: update SiliconCloud link in README
Some checks failed
CI / Unit tests (push) Has been cancelled
CI / commit_lint (push) Has been cancelled
2025-02-04 20:07:05 +08:00
JustSong
33edcf604c feat: add balance_not_supported translation to English and Chinese locales
Some checks are pending
CI / Unit tests (push) Waiting to run
CI / commit_lint (push) Waiting to run
2025-02-03 18:22:59 +08:00
JustSong
78fd6ef161 fix: update README for clarity on stable and alpha image addresses 2025-02-03 18:15:44 +08:00
JustSong
9b6d5f76e0 fix: enhance douban_notice_2 for clarity on model name conversion
Some checks are pending
CI / Unit tests (push) Waiting to run
CI / commit_lint (push) Waiting to run
2025-02-03 00:11:43 +08:00
JustSong
2250f311e1 feat: add latest version of Claude model to constants 2025-02-02 22:25:52 +08:00
lyj
e43f758623 Update model.go (#1963) 2025-02-02 22:24:31 +08:00
江南一根葱
6ded638f70 fix: audio transcription 400 error (#1882) (#2003) 2025-02-02 22:22:42 +08:00
jiz4oh
ea3331b79a fix: remove duplicated model (#2012)
the model `llama-3.2-11b-vision-preview` was declared at 3915ce9814/relay/adaptor/groq/constants.go (L11)
2025-02-02 22:21:30 +08:00
Jeremy JIANG
7a97ddc03c fix: fix hunyuan paramete & update price (#2019)
* fix: omit null TopP and Temperature fields in request body

* feat: update Hunyuan model ratios
2025-02-02 22:20:38 +08:00
JustSong
d7028b55fd feat: update model list in Zhipu constants for expanded options 2025-02-02 22:15:42 +08:00
Jeremy JIANG
36a03f465b feat: update Zhipu model prices (#2020) 2025-02-02 22:06:07 +08:00
JustSong
ae16647047 fix: change settings tab item color for improved visibility 2025-02-02 21:32:49 +08:00
JustSong
4dbc2ad86d fix: update tooltip keys in Dashboard for consistency in statistics display 2025-02-02 20:25:14 +08:00
JustSong
94479c2800 fix: add success message for completed operations in translation files 2025-02-02 20:07:08 +08:00
JustSong
614903b524 feat: comment out stat value displays in Dashboard for cleaner UI 2025-02-02 19:58:51 +08:00
18 changed files with 122 additions and 71 deletions

View File

@@ -32,10 +32,10 @@ jobs:
git describe --tags > VERSION git describe --tags > VERSION
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub - name: Log in to Docker Hub
uses: docker/login-action@v2 uses: docker/login-action@v2
@@ -62,8 +62,9 @@ jobs:
uses: docker/build-push-action@v3 uses: docker/build-push-action@v3
with: with:
context: . context: .
# platforms: linux/amd64,linux/arm64 platforms: ${{ contains(github.ref, 'alpha') && 'linux/amd64' || 'linux/amd64,linux/arm64' }}
platforms: linux/amd64 # TODO disable arm64 for now, because it cause error
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
build-args: |
TARGETARCH=${{ startsWith(matrix.platform, 'linux/arm64') && 'arm64' || 'amd64' }}

View File

@@ -7,6 +7,7 @@ on:
tags: tags:
- 'v*.*.*' - 'v*.*.*'
- '!*-alpha*' - '!*-alpha*'
- '!*-preview*'
workflow_dispatch: workflow_dispatch:
inputs: inputs:
name: name:

View File

@@ -7,6 +7,7 @@ on:
tags: tags:
- 'v*.*.*' - 'v*.*.*'
- '!*-alpha*' - '!*-alpha*'
- '!*-preview*'
workflow_dispatch: workflow_dispatch:
inputs: inputs:
name: name:

View File

@@ -7,6 +7,7 @@ on:
tags: tags:
- 'v*.*.*' - 'v*.*.*'
- '!*-alpha*' - '!*-alpha*'
- '!*-preview*'
workflow_dispatch: workflow_dispatch:
inputs: inputs:
name: name:

View File

@@ -9,23 +9,23 @@ RUN npm install --prefix /web/default & \
npm install --prefix /web/air & \ npm install --prefix /web/air & \
wait wait
RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat /web/default/VERSION) npm run build --prefix /web/default & \ RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./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 ./VERSION) npm run build --prefix /web/berry & \
DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat /web/air/VERSION) npm run build --prefix /web/air & \ DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run build --prefix /web/air & \
wait wait
FROM golang AS builder2 FROM golang:alpine AS builder2
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apk add --no-cache \
build-essential \ gcc \
sqlite3 libsqlite3-dev \ musl-dev \
&& rm -rf /var/lib/apt/lists/* sqlite-dev \
build-base
ENV GO111MODULE=on \ ENV GO111MODULE=on \
CGO_ENABLED=1 \ CGO_ENABLED=1 \
GOOS=linux \ GOOS=linux \
CGO_CFLAGS="-I/usr/include" \ GOARCH=$TARGETARCH
CGO_LDFLAGS="-L/usr/lib"
WORKDIR /build WORKDIR /build
@@ -35,14 +35,11 @@ RUN go mod download
COPY . . COPY . .
COPY --from=builder /web/build ./web/build 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 alpine:latest
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apk add --no-cache ca-certificates tzdata
ca-certificates tzdata bash \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder2 /build/one-api / COPY --from=builder2 /build/one-api /

View File

@@ -57,10 +57,10 @@ _✨ 通过标准的 OpenAI API 格式访问所有的大模型,开箱即用
> 根据[《生成式人工智能服务管理暂行办法》](http://www.cac.gov.cn/2023-07/13/c_1690898327029107.htm)的要求,请勿对中国地区公众提供一切未经备案的生成式人工智能服务。 > 根据[《生成式人工智能服务管理暂行办法》](http://www.cac.gov.cn/2023-07/13/c_1690898327029107.htm)的要求,请勿对中国地区公众提供一切未经备案的生成式人工智能服务。
> [!NOTE] > [!NOTE]
> 稳定版镜像地址:[justsong/one-api](https://hub.docker.com/repository/docker/justsong/one-api) > 稳定版 / 预览版镜像地址:[justsong/one-api](https://hub.docker.com/repository/docker/justsong/one-api)
> 或者 [ghcr.io/songquanpeng/one-api](https://github.com/songquanpeng/one-api/pkgs/container/one-api) > 或者 [ghcr.io/songquanpeng/one-api](https://github.com/songquanpeng/one-api/pkgs/container/one-api)
> >
> 预览版镜像地址:[justsong/one-api-alpha](https://hub.docker.com/repository/docker/justsong/one-api-alpha) > alpha 版镜像地址:[justsong/one-api-alpha](https://hub.docker.com/repository/docker/justsong/one-api-alpha)
> 或者 [ghcr.io/songquanpeng/one-api-alpha](https://github.com/songquanpeng/one-api/pkgs/container/one-api-alpha) > 或者 [ghcr.io/songquanpeng/one-api-alpha](https://github.com/songquanpeng/one-api/pkgs/container/one-api-alpha)
> [!WARNING] > [!WARNING]
@@ -93,7 +93,7 @@ _✨ 通过标准的 OpenAI API 格式访问所有的大模型,开箱即用
+ [x] [DeepL](https://www.deepl.com/) + [x] [DeepL](https://www.deepl.com/)
+ [x] [together.ai](https://www.together.ai/) + [x] [together.ai](https://www.together.ai/)
+ [x] [novita.ai](https://www.novita.ai/) + [x] [novita.ai](https://www.novita.ai/)
+ [x] [硅基流动 SiliconCloud](https://siliconflow.cn/siliconcloud) + [x] [硅基流动 SiliconCloud](https://cloud.siliconflow.cn/i/rKXmRobW)
+ [x] [xAI](https://x.ai/) + [x] [xAI](https://x.ai/)
2. 支持配置镜像以及众多[第三方代理服务](https://iamazing.cn/page/openai-api-third-party-services)。 2. 支持配置镜像以及众多[第三方代理服务](https://iamazing.cn/page/openai-api-third-party-services)。
3. 支持通过**负载均衡**的方式访问多个渠道。 3. 支持通过**负载均衡**的方式访问多个渠道。

View File

@@ -3,10 +3,11 @@ package common
import ( import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"github.com/gin-gonic/gin"
"github.com/songquanpeng/one-api/common/ctxkey"
"io" "io"
"strings" "strings"
"github.com/gin-gonic/gin"
"github.com/songquanpeng/one-api/common/ctxkey"
) )
func GetRequestBody(c *gin.Context) ([]byte, error) { func GetRequestBody(c *gin.Context) ([]byte, error) {
@@ -31,7 +32,6 @@ func UnmarshalBodyReusable(c *gin.Context, v any) error {
contentType := c.Request.Header.Get("Content-Type") contentType := c.Request.Header.Get("Content-Type")
if strings.HasPrefix(contentType, "application/json") { if strings.HasPrefix(contentType, "application/json") {
err = json.Unmarshal(requestBody, &v) err = json.Unmarshal(requestBody, &v)
c.Request.Body = io.NopCloser(bytes.NewBuffer(requestBody))
} else { } else {
c.Request.Body = io.NopCloser(bytes.NewBuffer(requestBody)) c.Request.Body = io.NopCloser(bytes.NewBuffer(requestBody))
err = c.ShouldBind(&v) err = c.ShouldBind(&v)
@@ -40,6 +40,7 @@ func UnmarshalBodyReusable(c *gin.Context, v any) error {
return err return err
} }
// Reset request body // Reset request body
c.Request.Body = io.NopCloser(bytes.NewBuffer(requestBody))
return nil return nil
} }

View File

@@ -35,6 +35,8 @@ func ShouldDisableChannel(err *model.Error, statusCode int) bool {
strings.Contains(lowerMessage, "balance") || strings.Contains(lowerMessage, "balance") ||
strings.Contains(lowerMessage, "permission denied") || strings.Contains(lowerMessage, "permission denied") ||
strings.Contains(lowerMessage, "organization has been restricted") || // groq 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, "已欠费") { strings.Contains(lowerMessage, "已欠费") {
return true return true
} }

View File

@@ -4,6 +4,7 @@ var ModelList = []string{
"claude-instant-1.2", "claude-2.0", "claude-2.1", "claude-instant-1.2", "claude-2.0", "claude-2.1",
"claude-3-haiku-20240307", "claude-3-haiku-20240307",
"claude-3-5-haiku-20241022", "claude-3-5-haiku-20241022",
"claude-3-5-haiku-latest",
"claude-3-sonnet-20240229", "claude-3-sonnet-20240229",
"claude-3-opus-20240229", "claude-3-opus-20240229",
"claude-3-5-sonnet-20240620", "claude-3-5-sonnet-20240620",

View File

@@ -2,5 +2,5 @@ package deepseek
var ModelList = []string{ var ModelList = []string{
"deepseek-chat", "deepseek-chat",
"deepseek-coder", "deepseek-reasoner",
} }

View File

@@ -7,6 +7,7 @@ import (
"net/http" "net/http"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/songquanpeng/one-api/common/helper" "github.com/songquanpeng/one-api/common/helper"
channelhelper "github.com/songquanpeng/one-api/relay/adaptor" channelhelper "github.com/songquanpeng/one-api/relay/adaptor"
"github.com/songquanpeng/one-api/relay/adaptor/openai" "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",
"gemini-2.0-flash-thinking-exp-01-21": "gemini-2.0-flash-thinking-exp-01-21":
defaultVersion = "v1beta" defaultVersion = "v1beta"
default:
defaultVersion = "v1beta"
} }
version := helper.AssignOrDefault(meta.Config.APIVersion, defaultVersion) version := helper.AssignOrDefault(meta.Config.APIVersion, defaultVersion)

View File

@@ -3,7 +3,6 @@ package groq
// https://console.groq.com/docs/models // https://console.groq.com/docs/models
var ModelList = []string{ var ModelList = []string{
"gemma-7b-it",
"gemma2-9b-it", "gemma2-9b-it",
"llama-3.1-70b-versatile", "llama-3.1-70b-versatile",
"llama-3.1-8b-instant", "llama-3.1-8b-instant",
@@ -11,7 +10,6 @@ var ModelList = []string{
"llama-3.2-11b-vision-preview", "llama-3.2-11b-vision-preview",
"llama-3.2-1b-preview", "llama-3.2-1b-preview",
"llama-3.2-3b-preview", "llama-3.2-3b-preview",
"llama-3.2-11b-vision-preview",
"llama-3.2-90b-text-preview", "llama-3.2-90b-text-preview",
"llama-3.2-90b-vision-preview", "llama-3.2-90b-vision-preview",
"llama-guard-3-8b", "llama-guard-3-8b",
@@ -24,4 +22,6 @@ var ModelList = []string{
"distil-whisper-large-v3-en", "distil-whisper-large-v3-en",
"whisper-large-v3", "whisper-large-v3",
"whisper-large-v3-turbo", "whisper-large-v3-turbo",
"deepseek-r1-distill-llama-70b-specdec",
"deepseek-r1-distill-llama-70b",
} }

View File

@@ -1,7 +1,14 @@
package zhipu package zhipu
// https://open.bigmodel.cn/pricing
var ModelList = []string{ var ModelList = []string{
"chatglm_turbo", "chatglm_pro", "chatglm_std", "chatglm_lite", "glm-zero-preview", "glm-4-plus", "glm-4-0520", "glm-4-airx",
"glm-4", "glm-4v", "glm-3-turbo", "embedding-2", "glm-4-air", "glm-4-long", "glm-4-flashx", "glm-4-flash",
"cogview-3", "glm-4", "glm-3-turbo",
"glm-4v-plus", "glm-4v", "glm-4v-flash",
"cogview-3-plus", "cogview-3", "cogview-3-flash",
"cogviewx", "cogviewx-flash",
"charglm-4", "emohaa", "codegeex-4",
"embedding-2", "embedding-3",
} }

View File

@@ -82,15 +82,17 @@ var ModelRatio = map[string]float64{
"text-moderation-latest": 0.1, "text-moderation-latest": 0.1,
"dall-e-2": 0.02 * USD, // $0.016 - $0.020 / image "dall-e-2": 0.02 * USD, // $0.016 - $0.020 / image
"dall-e-3": 0.04 * USD, // $0.040 - $0.120 / image "dall-e-3": 0.04 * USD, // $0.040 - $0.120 / image
// https://www.anthropic.com/api#pricing // https://docs.anthropic.com/en/docs/about-claude/models
"claude-instant-1.2": 0.8 / 1000 * USD, "claude-instant-1.2": 0.8 / 1000 * USD,
"claude-2.0": 8.0 / 1000 * USD, "claude-2.0": 8.0 / 1000 * USD,
"claude-2.1": 8.0 / 1000 * USD, "claude-2.1": 8.0 / 1000 * USD,
"claude-3-haiku-20240307": 0.25 / 1000 * USD, "claude-3-haiku-20240307": 0.25 / 1000 * USD,
"claude-3-5-haiku-20241022": 1.0 / 1000 * USD, "claude-3-5-haiku-20241022": 1.0 / 1000 * USD,
"claude-3-5-haiku-latest": 1.0 / 1000 * USD,
"claude-3-sonnet-20240229": 3.0 / 1000 * USD, "claude-3-sonnet-20240229": 3.0 / 1000 * USD,
"claude-3-5-sonnet-20240620": 3.0 / 1000 * USD, "claude-3-5-sonnet-20240620": 3.0 / 1000 * USD,
"claude-3-5-sonnet-20241022": 3.0 / 1000 * USD, "claude-3-5-sonnet-20241022": 3.0 / 1000 * USD,
"claude-3-5-sonnet-latest" : 3.0 / 1000 * USD,
"claude-3-opus-20240229": 15.0 / 1000 * USD, "claude-3-opus-20240229": 15.0 / 1000 * USD,
// https://cloud.baidu.com/doc/WENXINWORKSHOP/s/hlrk4akp7 // https://cloud.baidu.com/doc/WENXINWORKSHOP/s/hlrk4akp7
"ERNIE-4.0-8K": 0.120 * RMB, "ERNIE-4.0-8K": 0.120 * RMB,
@@ -121,15 +123,29 @@ var ModelRatio = map[string]float64{
"gemini-2.0-flash-thinking-exp-01-21": 1, "gemini-2.0-flash-thinking-exp-01-21": 1,
"aqa": 1, "aqa": 1,
// https://open.bigmodel.cn/pricing // https://open.bigmodel.cn/pricing
"glm-4": 0.1 * RMB, "glm-zero-preview": 0.01 * RMB,
"glm-4v": 0.1 * RMB, "glm-4-plus": 0.05 * RMB,
"glm-3-turbo": 0.005 * RMB, "glm-4-0520": 0.1 * RMB,
"glm-4-airx": 0.01 * RMB,
"glm-4-air": 0.0005 * RMB,
"glm-4-long": 0.001 * RMB,
"glm-4-flashx": 0.0001 * RMB,
"glm-4-flash": 0,
"glm-4": 0.1 * RMB, // deprecated model, available until 2025/06
"glm-3-turbo": 0.001 * RMB, // deprecated model, available until 2025/06
"glm-4v-plus": 0.004 * RMB,
"glm-4v": 0.05 * RMB,
"glm-4v-flash": 0,
"cogview-3-plus": 0.06 * RMB,
"cogview-3": 0.1 * RMB,
"cogview-3-flash": 0,
"cogviewx": 0.5 * RMB,
"cogviewx-flash": 0,
"charglm-4": 0.001 * RMB,
"emohaa": 0.015 * RMB,
"codegeex-4": 0.0001 * RMB,
"embedding-2": 0.0005 * RMB, "embedding-2": 0.0005 * RMB,
"chatglm_turbo": 0.3572, // ¥0.005 / 1k tokens "embedding-3": 0.0005 * RMB,
"chatglm_pro": 0.7143, // ¥0.01 / 1k tokens
"chatglm_std": 0.3572, // ¥0.005 / 1k tokens
"chatglm_lite": 0.1429, // ¥0.002 / 1k tokens
"cogview-3": 0.25 * RMB,
// https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-thousand-questions-metering-and-billing // https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-thousand-questions-metering-and-billing
"qwen-turbo": 1.4286, // ¥0.02 / 1k tokens "qwen-turbo": 1.4286, // ¥0.02 / 1k tokens
"qwen-turbo-latest": 1.4286, "qwen-turbo-latest": 1.4286,
@@ -216,9 +232,19 @@ var ModelRatio = map[string]float64{
"embedding-bert-512-v1": 0.0715, // ¥0.001 / 1k tokens "embedding-bert-512-v1": 0.0715, // ¥0.001 / 1k tokens
"embedding_s1_v1": 0.0715, // ¥0.001 / 1k tokens "embedding_s1_v1": 0.0715, // ¥0.001 / 1k tokens
"semantic_similarity_s1_v1": 0.0715, // ¥0.001 / 1k tokens "semantic_similarity_s1_v1": 0.0715, // ¥0.001 / 1k tokens
"hunyuan": 7.143, // ¥0.1 / 1k tokens // https://cloud.tencent.com/document/product/1729/97731#e0e6be58-60c8-469f-bdeb-6c264ce3b4d0 // https://cloud.tencent.com/document/product/1729/97731#e0e6be58-60c8-469f-bdeb-6c264ce3b4d0
"ChatStd": 0.01 * RMB, "hunyuan-turbo": 0.015 * RMB,
"ChatPro": 0.1 * RMB, "hunyuan-large": 0.004 * RMB,
"hunyuan-large-longcontext": 0.006 * RMB,
"hunyuan-standard": 0.0008 * RMB,
"hunyuan-standard-256K": 0.0005 * RMB,
"hunyuan-translation-lite": 0.005 * RMB,
"hunyuan-role": 0.004 * RMB,
"hunyuan-functioncall": 0.004 * RMB,
"hunyuan-code": 0.004 * RMB,
"hunyuan-turbo-vision": 0.08 * RMB,
"hunyuan-vision": 0.018 * RMB,
"hunyuan-embedding": 0.0007 * RMB,
// https://platform.moonshot.cn/pricing // https://platform.moonshot.cn/pricing
"moonshot-v1-8k": 0.012 * RMB, "moonshot-v1-8k": 0.012 * RMB,
"moonshot-v1-32k": 0.024 * RMB, "moonshot-v1-32k": 0.024 * RMB,

View File

@@ -62,7 +62,8 @@
"not_tested": "Not Tested", "not_tested": "Not Tested",
"priority_tip": "Channel selection priority, higher is preferred", "priority_tip": "Channel selection priority, higher is preferred",
"select_test_model": "Please select test model", "select_test_model": "Please select test model",
"click_to_update": "Click to update" "click_to_update": "Click to update",
"balance_not_supported": "-"
}, },
"buttons": { "buttons": {
"test": "Test", "test": "Test",
@@ -85,7 +86,8 @@
"test_all_started": "Channel testing started successfully, please refresh page to see results.", "test_all_started": "Channel testing started successfully, please refresh page to see results.",
"delete_disabled_success": "Deleted all disabled channels, total: {{count}}", "delete_disabled_success": "Deleted all disabled channels, total: {{count}}",
"balance_update_success": "Channel {{name}} balance updated successfully!", "balance_update_success": "Channel {{name}} balance updated successfully!",
"all_balance_updated": "All enabled channel balances have been updated!" "all_balance_updated": "All enabled channel balances have been updated!",
"operation_success": "Operation completed successfully!"
}, },
"edit": { "edit": {
"title_edit": "Update Channel Information", "title_edit": "Update Channel Information",

View File

@@ -62,7 +62,8 @@
"not_tested": "未测试", "not_tested": "未测试",
"priority_tip": "渠道选择优先级,越高越优先", "priority_tip": "渠道选择优先级,越高越优先",
"select_test_model": "请选择测试模型", "select_test_model": "请选择测试模型",
"click_to_update": "点击更新" "click_to_update": "点击更新",
"balance_not_supported": "-"
}, },
"buttons": { "buttons": {
"test": "测试", "test": "测试",
@@ -85,7 +86,8 @@
"test_all_started": "已成功开始测试渠道,请刷新页面查看结果。", "test_all_started": "已成功开始测试渠道,请刷新页面查看结果。",
"delete_disabled_success": "已删除所有禁用渠道,共计 {{count}} 个", "delete_disabled_success": "已删除所有禁用渠道,共计 {{count}} 个",
"balance_update_success": "渠道 {{name}} 余额更新成功!", "balance_update_success": "渠道 {{name}} 余额更新成功!",
"all_balance_updated": "已更新完毕所有已启用渠道余额!" "all_balance_updated": "已更新完毕所有已启用渠道余额!",
"operation_success": "操作成功完成!"
}, },
"edit": { "edit": {
"title_edit": "更新渠道信息", "title_edit": "更新渠道信息",
@@ -133,7 +135,7 @@
"coze_notice": "对于 Coze 而言,模型名称即 Bot ID你可以添加一个前缀 `bot-`,例如:`bot-123456`。", "coze_notice": "对于 Coze 而言,模型名称即 Bot ID你可以添加一个前缀 `bot-`,例如:`bot-123456`。",
"douban_notice": "对于豆包而言,需要手动去", "douban_notice": "对于豆包而言,需要手动去",
"douban_notice_link": "模型推理页面", "douban_notice_link": "模型推理页面",
"douban_notice_2": "创建推理接入点,以接入点名称作为模型名称,例如:`ep-20240608051426-tkxvl`。", "douban_notice_2": "创建推理接入点,以接入点名称作为模型名称,例如:`ep-20240608051426-tkxvl`。你可以结合模型重定向功能将其转换为常规的模型名称例如doubao-lite-4k -> ep-20240608051426-tkxvl前者作为 JSON 的 key后者作为 value。注意doubao-lite-4k 和 ep-20240608051426-tkxvl 都需要通过自定义模型的方式填入到本渠道的模型列表中。",
"aws_region_placeholder": "region例如us-west-2", "aws_region_placeholder": "region例如us-west-2",
"aws_ak_placeholder": "AWS IAM Access Key", "aws_ak_placeholder": "AWS IAM Access Key",
"aws_sk_placeholder": "AWS IAM Secret Key", "aws_sk_placeholder": "AWS IAM Secret Key",

View File

@@ -91,7 +91,7 @@
} }
.settings-tab .item { .settings-tab .item {
color: #2B3674 !important; color: #000 !important;
font-weight: 500 !important; font-weight: 500 !important;
padding: 0.8rem 1.2rem !important; padding: 0.8rem 1.2rem !important;
} }

View File

@@ -1,19 +1,17 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Card, Grid, Header, Segment, Statistic } from 'semantic-ui-react'; import { Card, Grid } from 'semantic-ui-react';
import { API, showError } from '../../helpers';
import moment from 'moment';
import { import {
LineChart, Bar,
BarChart,
CartesianGrid,
Legend,
Line, Line,
LineChart,
ResponsiveContainer,
Tooltip,
XAxis, XAxis,
YAxis, YAxis,
CartesianGrid,
Tooltip,
ResponsiveContainer,
BarChart,
Bar,
Legend,
} from 'recharts'; } from 'recharts';
import axios from 'axios'; import axios from 'axios';
import './Dashboard.css'; import './Dashboard.css';
@@ -244,7 +242,7 @@ const Dashboard = () => {
<Card.Content> <Card.Content>
<Card.Header> <Card.Header>
{t('dashboard.charts.requests.title')} {t('dashboard.charts.requests.title')}
<span className='stat-value'>{summaryData.todayRequests}</span> {/* <span className='stat-value'>{summaryData.todayRequests}</span> */}
</Card.Header> </Card.Header>
<div className='chart-container'> <div className='chart-container'>
<ResponsiveContainer <ResponsiveContainer
@@ -273,7 +271,9 @@ const Dashboard = () => {
t('dashboard.charts.requests.tooltip'), t('dashboard.charts.requests.tooltip'),
]} ]}
labelFormatter={(label) => labelFormatter={(label) =>
`${t('dashboard.tooltip.date')}: ${formatDate(label)}` `${t(
'dashboard.statistics.tooltip.date'
)}: ${formatDate(label)}`
} }
/> />
<Line <Line
@@ -296,9 +296,9 @@ const Dashboard = () => {
<Card.Content> <Card.Content>
<Card.Header> <Card.Header>
{t('dashboard.charts.quota.title')} {t('dashboard.charts.quota.title')}
<span className='stat-value'> {/* <span className='stat-value'>
${summaryData.todayQuota.toFixed(3)} ${summaryData.todayQuota.toFixed(3)}
</span> </span> */}
</Card.Header> </Card.Header>
<div className='chart-container'> <div className='chart-container'>
<ResponsiveContainer <ResponsiveContainer
@@ -323,11 +323,13 @@ const Dashboard = () => {
boxShadow: '0 2px 8px rgba(0,0,0,0.1)', boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
}} }}
formatter={(value) => [ formatter={(value) => [
value, value.toFixed(6),
t('dashboard.charts.quota.tooltip'), t('dashboard.charts.quota.tooltip'),
]} ]}
labelFormatter={(label) => labelFormatter={(label) =>
`${t('dashboard.tooltip.date')}: ${formatDate(label)}` `${t(
'dashboard.statistics.tooltip.date'
)}: ${formatDate(label)}`
} }
/> />
<Line <Line
@@ -350,7 +352,7 @@ const Dashboard = () => {
<Card.Content> <Card.Content>
<Card.Header> <Card.Header>
{t('dashboard.charts.tokens.title')} {t('dashboard.charts.tokens.title')}
<span className='stat-value'>{summaryData.todayTokens}</span> {/* <span className='stat-value'>{summaryData.todayTokens}</span> */}
</Card.Header> </Card.Header>
<div className='chart-container'> <div className='chart-container'>
<ResponsiveContainer <ResponsiveContainer
@@ -379,7 +381,9 @@ const Dashboard = () => {
t('dashboard.charts.tokens.tooltip'), t('dashboard.charts.tokens.tooltip'),
]} ]}
labelFormatter={(label) => labelFormatter={(label) =>
`${t('dashboard.tooltip.date')}: ${formatDate(label)}` `${t(
'dashboard.statistics.tooltip.date'
)}: ${formatDate(label)}`
} }
/> />
<Line <Line
@@ -424,7 +428,9 @@ const Dashboard = () => {
boxShadow: '0 2px 8px rgba(0,0,0,0.1)', boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
}} }}
labelFormatter={(label) => labelFormatter={(label) =>
`${t('dashboard.tooltip.date')}: ${formatDate(label)}` `${t('dashboard.statistics.tooltip.date')}: ${formatDate(
label
)}`
} }
/> />
<Legend <Legend