Merge branch 'upstream/main' into feature/gemini-2.0-flash

This commit is contained in:
Laisky.Cai 2025-02-07 02:33:43 +00:00
commit 8bb3ac276b
12 changed files with 49 additions and 37 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

@ -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

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

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",
@ -23,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

@ -7,7 +7,7 @@ export const CHANNEL_OPTIONS = [
{ key: 24, text: 'Google Gemini', value: 24, color: 'orange' }, { key: 24, text: 'Google Gemini', value: 24, color: 'orange' },
{ key: 28, text: 'Mistral AI', value: 28, color: 'orange' }, { key: 28, text: 'Mistral AI', value: 28, color: 'orange' },
{ key: 41, text: 'Novita', value: 41, color: 'purple' }, { 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: 15, text: '百度文心千帆', value: 15, color: 'blue' },
{ key: 17, text: '阿里通义千问', value: 17, color: 'orange' }, { key: 17, text: '阿里通义千问', value: 17, color: 'orange' },
{ key: 18, text: '讯飞星火认知', value: 18, color: 'blue' }, { key: 18, text: '讯飞星火认知', value: 18, color: 'blue' },

View File

@ -49,7 +49,7 @@ export const CHANNEL_OPTIONS = {
}, },
40: { 40: {
key: 40, key: 40,
text: '字节跳动豆包', text: '火山引擎',
value: 40, value: 40,
color: 'primary' color: 'primary'
}, },

View File

@ -7,7 +7,7 @@ export const CHANNEL_OPTIONS = [
{ key: 24, text: 'Google Gemini', value: 24, color: 'orange' }, { key: 24, text: 'Google Gemini', value: 24, color: 'orange' },
{ key: 28, text: 'Mistral AI', value: 28, color: 'orange' }, { key: 28, text: 'Mistral AI', value: 28, color: 'orange' },
{ key: 41, text: 'Novita', value: 41, color: 'purple' }, { 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: 15, text: '百度文心千帆', value: 15, color: 'blue' },
{ key: 17, text: '阿里通义千问', value: 17, color: 'orange' }, { key: 17, text: '阿里通义千问', value: 17, color: 'orange' },
{ key: 18, text: '讯飞星火认知', value: 18, color: 'blue' }, { key: 18, text: '讯飞星火认知', value: 18, color: 'blue' },

View File

@ -1,6 +1,6 @@
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} from 'semantic-ui-react'; import { Card, Grid } from 'semantic-ui-react';
import { import {
Bar, Bar,
BarChart, BarChart,
@ -242,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
@ -271,7 +271,9 @@ const Dashboard = () => {
t('dashboard.charts.requests.tooltip'), t('dashboard.charts.requests.tooltip'),
]} ]}
labelFormatter={(label) => labelFormatter={(label) =>
`${t('dashboard.statistics.tooltip.date')}: ${formatDate(label)}` `${t(
'dashboard.statistics.tooltip.date'
)}: ${formatDate(label)}`
} }
/> />
<Line <Line
@ -294,7 +296,7 @@ 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>
@ -321,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.statistics.tooltip.date')}: ${formatDate(label)}` `${t(
'dashboard.statistics.tooltip.date'
)}: ${formatDate(label)}`
} }
/> />
<Line <Line
@ -348,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
@ -377,7 +381,9 @@ const Dashboard = () => {
t('dashboard.charts.tokens.tooltip'), t('dashboard.charts.tokens.tooltip'),
]} ]}
labelFormatter={(label) => labelFormatter={(label) =>
`${t('dashboard.statistics.tooltip.date')}: ${formatDate(label)}` `${t(
'dashboard.statistics.tooltip.date'
)}: ${formatDate(label)}`
} }
/> />
<Line <Line
@ -422,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.statistics.tooltip.date')}: ${formatDate(label)}` `${t('dashboard.statistics.tooltip.date')}: ${formatDate(
label
)}`
} }
/> />
<Legend <Legend