mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-04 20:22:12 +00:00
Compare commits
3 Commits
v0.9.13
...
v0.9.14-pa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52d9b8cc78 | ||
|
|
f1ac5606ee | ||
|
|
b2d9771a57 |
@@ -29,11 +29,11 @@ func GetUserGroups(c *gin.Context) {
|
||||
userId := c.GetInt("id")
|
||||
userGroup, _ = model.GetUserGroup(userId, false)
|
||||
userUsableGroups := service.GetUserUsableGroups(userGroup)
|
||||
for groupName, ratio := range ratio_setting.GetGroupRatioCopy() {
|
||||
for groupName, _ := range ratio_setting.GetGroupRatioCopy() {
|
||||
// UserUsableGroups contains the groups that the user can use
|
||||
if desc, ok := userUsableGroups[groupName]; ok {
|
||||
usableGroups[groupName] = map[string]interface{}{
|
||||
"ratio": ratio,
|
||||
"ratio": service.GetUserGroupRatio(userGroup, groupName),
|
||||
"desc": desc,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ func Playground(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
group := c.GetString("group")
|
||||
group := common.GetContextKeyString(c, constant.ContextKeyUsingGroup)
|
||||
modelName := c.GetString("original_model")
|
||||
|
||||
userId := c.GetInt("id")
|
||||
|
||||
@@ -94,6 +94,7 @@ func Distribute() func(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
usingGroup = playgroundRequest.Group
|
||||
common.SetContextKey(c, constant.ContextKeyUsingGroup, usingGroup)
|
||||
}
|
||||
}
|
||||
channel, selectGroup, err = service.CacheGetRandomSatisfiedChannel(c, usingGroup, modelRequest.Model, 0)
|
||||
|
||||
@@ -52,3 +52,14 @@ func GetUserAutoGroup(userGroup string) []string {
|
||||
}
|
||||
return autoGroups
|
||||
}
|
||||
|
||||
// GetUserGroupRatio 获取用户使用某个分组的倍率
|
||||
// userGroup 用户分组
|
||||
// group 需要获取倍率的分组
|
||||
func GetUserGroupRatio(userGroup, group string) float64 {
|
||||
ratio, ok := ratio_setting.GetGroupGroupRatio(userGroup, group)
|
||||
if ok {
|
||||
return ratio
|
||||
}
|
||||
return ratio_setting.GetGroupRatio(group)
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
import React from 'react';
|
||||
import { Button, Dropdown } from '@douyinfe/semi-ui';
|
||||
import { Languages } from 'lucide-react';
|
||||
import { CN, GB, FR, RU } from 'country-flag-icons/react/3x2';
|
||||
import { CN, GB, FR, RU, JP } from 'country-flag-icons/react/3x2';
|
||||
|
||||
const LanguageSelector = ({ currentLang, onLanguageChange, t }) => {
|
||||
return (
|
||||
@@ -28,6 +28,7 @@ const LanguageSelector = ({ currentLang, onLanguageChange, t }) => {
|
||||
position='bottomRight'
|
||||
render={
|
||||
<Dropdown.Menu className='!bg-semi-color-bg-overlay !border-semi-color-border !shadow-lg !rounded-lg dark:!bg-gray-700 dark:!border-gray-600'>
|
||||
{/* Language sorting: Order by English name (Chinese, English, French, Japanese, Russian) */}
|
||||
<Dropdown.Item
|
||||
onClick={() => onLanguageChange('zh')}
|
||||
className={`!flex !items-center !gap-2 !px-3 !py-1.5 !text-sm !text-semi-color-text-0 dark:!text-gray-200 ${currentLang === 'zh' ? '!bg-semi-color-primary-light-default dark:!bg-blue-600 !font-semibold' : 'hover:!bg-semi-color-fill-1 dark:hover:!bg-gray-600'}`}
|
||||
@@ -49,6 +50,14 @@ const LanguageSelector = ({ currentLang, onLanguageChange, t }) => {
|
||||
<FR title='Français' className='!w-5 !h-auto' />
|
||||
<span>Français</span>
|
||||
</Dropdown.Item>
|
||||
<Dropdown.Item
|
||||
onClick={() => onLanguageChange('ja')}
|
||||
className={`!flex !items-center !gap-2 !px-3 !py-1.5 !text-sm !text-semi-color-text-0 dark:!text-gray-200 ${currentLang === 'ja' ? '!bg-semi-color-primary-light-default dark:!bg-blue-600 !font-semibold' : 'hover:!bg-semi-color-fill-1 dark:hover:!bg-gray-600'}`}
|
||||
>
|
||||
{/* Japanese flag using emoji as country-flag-icons/react/3x2 does not export JP */}
|
||||
<JP title='日本語' className='!w-5 !h-auto' />
|
||||
<span>日本語</span>
|
||||
</Dropdown.Item>
|
||||
<Dropdown.Item
|
||||
onClick={() => onLanguageChange('ru')}
|
||||
className={`!flex !items-center !gap-2 !px-3 !py-1.5 !text-sm !text-semi-color-text-0 dark:!text-gray-200 ${currentLang === 'ru' ? '!bg-semi-color-primary-light-default dark:!bg-blue-600 !font-semibold' : 'hover:!bg-semi-color-fill-1 dark:hover:!bg-gray-600'}`}
|
||||
|
||||
@@ -25,6 +25,7 @@ import enTranslation from './locales/en.json';
|
||||
import frTranslation from './locales/fr.json';
|
||||
import zhTranslation from './locales/zh.json';
|
||||
import ruTranslation from './locales/ru.json';
|
||||
import jaTranslation from './locales/ja.json';
|
||||
|
||||
i18n
|
||||
.use(LanguageDetector)
|
||||
@@ -36,6 +37,7 @@ i18n
|
||||
zh: zhTranslation,
|
||||
fr: frTranslation,
|
||||
ru: ruTranslation,
|
||||
ja: jaTranslation,
|
||||
},
|
||||
fallbackLng: 'zh',
|
||||
interpolation: {
|
||||
|
||||
@@ -2100,6 +2100,8 @@
|
||||
"例如:4.99": "e.g.: 4.99",
|
||||
"例如:100000": "e.g.: 100000",
|
||||
"请填写完整的产品信息": "Please fill in complete product information",
|
||||
"产品ID已存在": "Product ID already exists"
|
||||
"产品ID已存在": "Product ID already exists",
|
||||
"统一的": "The Unified",
|
||||
"大模型接口网关": "LLM API Gateway"
|
||||
}
|
||||
}
|
||||
@@ -2080,6 +2080,8 @@
|
||||
"默认区域,如: us-central1": "Région par défaut, ex: us-central1",
|
||||
"默认折叠侧边栏": "Réduire la barre latérale par défaut",
|
||||
"默认测试模型": "Modèle de test par défaut",
|
||||
"默认补全倍率": "Taux de complétion par défaut"
|
||||
"默认补全倍率": "Taux de complétion par défaut",
|
||||
"统一的": "La Passerelle",
|
||||
"大模型接口网关": "API LLM Unifiée"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2071,6 +2071,8 @@
|
||||
"默认区域,如: us-central1": "デフォルトリージョン(例:us-central1)",
|
||||
"默认折叠侧边栏": "サイドバーをデフォルトで折りたたむ",
|
||||
"默认测试模型": "デフォルトテストモデル",
|
||||
"默认补全倍率": "デフォルト補完倍率"
|
||||
"默认补全倍率": "デフォルト補完倍率",
|
||||
"统一的": "統合型",
|
||||
"大模型接口网关": "LLM APIゲートウェイ"
|
||||
}
|
||||
}
|
||||
@@ -2089,6 +2089,8 @@
|
||||
"默认区域,如: us-central1": "Регион по умолчанию, например: us-central1",
|
||||
"默认折叠侧边栏": "Сворачивать боковую панель по умолчанию",
|
||||
"默认测试模型": "Модель для тестирования по умолчанию",
|
||||
"默认补全倍率": "Коэффициент вывода по умолчанию"
|
||||
"默认补全倍率": "Коэффициент вывода по умолчанию",
|
||||
"统一的": "Единый",
|
||||
"大模型接口网关": "Шлюз API LLM"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,19 +169,11 @@ const Home = () => {
|
||||
<h1
|
||||
className={`text-4xl md:text-5xl lg:text-6xl xl:text-7xl font-bold text-semi-color-text-0 leading-tight ${isChinese ? 'tracking-wide md:tracking-wider' : ''}`}
|
||||
>
|
||||
{i18n.language === 'en' ? (
|
||||
<>
|
||||
The Unified
|
||||
<br />
|
||||
<span className='shine-text'>LLMs API Gateway</span>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
统一的
|
||||
<br />
|
||||
<span className='shine-text'>大模型接口网关</span>
|
||||
</>
|
||||
)}
|
||||
<>
|
||||
{t('统一的')}
|
||||
<br />
|
||||
<span className='shine-text'>{t('大模型接口网关')}</span>
|
||||
</>
|
||||
</h1>
|
||||
<p className='text-base md:text-lg lg:text-xl text-semi-color-text-1 mt-4 md:mt-6 max-w-xl'>
|
||||
{t('更好的价格,更好的稳定性,只需要将模型基址替换为:')}
|
||||
|
||||
Reference in New Issue
Block a user