Skip to content

Commit

Permalink
fix #663
Browse files Browse the repository at this point in the history
  • Loading branch information
Calcium-Ion committed Dec 27, 2024
1 parent 1cef91a commit 52c023a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 34 deletions.
5 changes: 3 additions & 2 deletions setting/user_usable_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
47 changes: 15 additions & 32 deletions web/src/components/ModelPricing.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,41 +81,24 @@ const ModelPricing = () => {
}

function renderAvailable(available) {
return available ? (
return (
<Popover
content={
<div style={{ padding: 8 }}>{t('您的分组可以使用该模型')}</div>
}
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',
}}
>
<IconVerify style={{ color: 'green' }} size="large" />
</Popover>
) : (
<Popover
content={
<div style={{ padding: 8 }}>{t('您的分组无权使用该模型')}</div>
}
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={
<div style={{ padding: 8 }}>{t('您的分组可以使用该模型')}</div>
}
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',
}}
>
<IconUploadError style={{ color: '#FFA54F' }} size="large" />
<IconVerify style={{ color: 'green' }} size="large" />
</Popover>
);
)
}

const columns = [
Expand Down

0 comments on commit 52c023a

Please sign in to comment.