From 52c023a1ddc4ddf60f4cfbd17cfd5625be85bfde Mon Sep 17 00:00:00 2001
From: CalciumIon <1808837298@qq.com>
Date: Fri, 27 Dec 2024 21:59:05 +0800
Subject: [PATCH] fix #663
---
setting/user_usable_group.go | 5 ++--
web/src/components/ModelPricing.js | 47 ++++++++++--------------------
2 files changed, 18 insertions(+), 34 deletions(-)
diff --git a/setting/user_usable_group.go b/setting/user_usable_group.go
index 6fcfb263..7082b683 100644
--- a/setting/user_usable_group.go
+++ b/setting/user_usable_group.go
@@ -34,8 +34,9 @@ func UpdateUserUsableGroupsByJSONString(jsonStr string) error {
func GetUserUsableGroups(userGroup string) map[string]string {
groupsCopy := GetUserUsableGroupsCopy()
if userGroup == "" {
- // 如果userGroup为空,返回UserUsableGroups
- return groupsCopy
+ if _, ok := groupsCopy["default"]; !ok {
+ groupsCopy["default"] = "default"
+ }
}
// 如果userGroup不在UserUsableGroups中,返回UserUsableGroups + userGroup
if _, ok := groupsCopy[userGroup]; !ok {
diff --git a/web/src/components/ModelPricing.js b/web/src/components/ModelPricing.js
index 193db789..299d39cb 100644
--- a/web/src/components/ModelPricing.js
+++ b/web/src/components/ModelPricing.js
@@ -81,41 +81,24 @@ const ModelPricing = () => {
}
function renderAvailable(available) {
- return available ? (
+ return (
{t('您的分组可以使用该模型')}
- }
- position='top'
- key={available}
- style={{
- backgroundColor: 'rgba(var(--semi-blue-4),1)',
- borderColor: 'rgba(var(--semi-blue-4),1)',
- color: 'var(--semi-color-white)',
- borderWidth: 1,
- borderStyle: 'solid',
- }}
- >
-
-
- ) : (
- {t('您的分组无权使用该模型')}
- }
- position='top'
- key={available}
- style={{
- backgroundColor: 'rgba(var(--semi-blue-4),1)',
- borderColor: 'rgba(var(--semi-blue-4),1)',
- color: 'var(--semi-color-white)',
- borderWidth: 1,
- borderStyle: 'solid',
- }}
+ content={
+ {t('您的分组可以使用该模型')}
+ }
+ position='top'
+ key={available}
+ style={{
+ backgroundColor: 'rgba(var(--semi-blue-4),1)',
+ borderColor: 'rgba(var(--semi-blue-4),1)',
+ color: 'var(--semi-color-white)',
+ borderWidth: 1,
+ borderStyle: 'solid',
+ }}
>
-
+
- );
+ )
}
const columns = [