Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3ef8b740
authored
Sep 19, 2024
by
CalciumIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 无可选分组时关闭令牌分组功能 #485
parent
27909c95
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
27 deletions
+34
-27
web/src/pages/Token/EditToken.js
+34
-27
No files found.
web/src/pages/Token/EditToken.js
View file @
3ef8b740
...
@@ -273,7 +273,7 @@ const EditToken = (props) => {
...
@@ -273,7 +273,7 @@ const EditToken = (props) => {
>
>
<
Spin
spinning
=
{
loading
}
>
<
Spin
spinning
=
{
loading
}
>
<
Input
<
Input
style
=
{{
marginTop
:
20
}}
style
=
{{
marginTop
:
20
}}
label
=
'名称'
label
=
'名称'
name
=
'name'
name
=
'name'
placeholder
=
{
'请输入名称'
}
placeholder
=
{
'请输入名称'
}
...
@@ -282,7 +282,7 @@ const EditToken = (props) => {
...
@@ -282,7 +282,7 @@ const EditToken = (props) => {
autoComplete
=
'new-password'
autoComplete
=
'new-password'
required
=
{
!
isEdit
}
required
=
{
!
isEdit
}
/
>
/
>
<
Divider
/>
<
Divider
/>
<
DatePicker
<
DatePicker
label
=
'过期时间'
label
=
'过期时间'
name
=
'expired_time'
name
=
'expired_time'
...
@@ -292,7 +292,7 @@ const EditToken = (props) => {
...
@@ -292,7 +292,7 @@ const EditToken = (props) => {
autoComplete
=
'new-password'
autoComplete
=
'new-password'
type
=
'dateTime'
type
=
'dateTime'
/>
/>
<
div
style
=
{{
marginTop
:
20
}}
>
<
div
style
=
{{
marginTop
:
20
}}
>
<
Space
>
<
Space
>
<
Button
<
Button
type
=
{
'tertiary'
}
type
=
{
'tertiary'
}
...
@@ -329,18 +329,18 @@ const EditToken = (props) => {
...
@@ -329,18 +329,18 @@ const EditToken = (props) => {
<
/Space
>
<
/Space
>
<
/div
>
<
/div
>
<
Divider
/>
<
Divider
/>
<
Banner
<
Banner
type
=
{
'warning'
}
type
=
{
'warning'
}
description
=
{
description
=
{
'注意,令牌的额度仅用于限制令牌本身的最大额度使用量,实际的使用受到账户的剩余额度限制。'
'注意,令牌的额度仅用于限制令牌本身的最大额度使用量,实际的使用受到账户的剩余额度限制。'
}
}
><
/Banner
>
><
/Banner
>
<
div
style
=
{{
marginTop
:
20
}}
>
<
div
style
=
{{
marginTop
:
20
}}
>
<
Typography
.
Text
>
{
`额度
${
renderQuotaWithPrompt
(
remain_quota
)}
`
}
<
/Typography.Text
>
<
Typography
.
Text
>
{
`额度
${
renderQuotaWithPrompt
(
remain_quota
)}
`
}
<
/Typography.Text
>
<
/div
>
<
/div
>
<
AutoComplete
<
AutoComplete
style
=
{{
marginTop
:
8
}}
style
=
{{
marginTop
:
8
}}
name
=
'remain_quota'
name
=
'remain_quota'
placeholder
=
{
'请输入额度'
}
placeholder
=
{
'请输入额度'
}
onChange
=
{(
value
)
=>
handleInputChange
(
'remain_quota'
,
value
)}
onChange
=
{(
value
)
=>
handleInputChange
(
'remain_quota'
,
value
)}
...
@@ -349,23 +349,23 @@ const EditToken = (props) => {
...
@@ -349,23 +349,23 @@ const EditToken = (props) => {
type
=
'number'
type
=
'number'
// position={'top'}
// position={'top'}
data
=
{[
data
=
{[
{
value
:
500000
,
label
:
'1$'
},
{
value
:
500000
,
label
:
'1$'
},
{
value
:
5000000
,
label
:
'10$'
},
{
value
:
5000000
,
label
:
'10$'
},
{
value
:
25000000
,
label
:
'50$'
},
{
value
:
25000000
,
label
:
'50$'
},
{
value
:
50000000
,
label
:
'100$'
},
{
value
:
50000000
,
label
:
'100$'
},
{
value
:
250000000
,
label
:
'500$'
},
{
value
:
250000000
,
label
:
'500$'
},
{
value
:
500000000
,
label
:
'1000$'
},
{
value
:
500000000
,
label
:
'1000$'
},
]}
]}
disabled
=
{
unlimited_quota
}
disabled
=
{
unlimited_quota
}
/
>
/
>
{
!
isEdit
&&
(
{
!
isEdit
&&
(
<>
<>
<
div
style
=
{{
marginTop
:
20
}}
>
<
div
style
=
{{
marginTop
:
20
}}
>
<
Typography
.
Text
>
新建数量
<
/Typography.Text
>
<
Typography
.
Text
>
新建数量
<
/Typography.Text
>
<
/div
>
<
/div
>
<
AutoComplete
<
AutoComplete
style
=
{{
marginTop
:
8
}}
style
=
{{
marginTop
:
8
}}
label
=
'数量'
label
=
'数量'
placeholder
=
{
'请选择或输入创建令牌的数量'
}
placeholder
=
{
'请选择或输入创建令牌的数量'
}
onChange
=
{(
value
)
=>
handleTokenCountChange
(
value
)}
onChange
=
{(
value
)
=>
handleTokenCountChange
(
value
)}
...
@@ -374,10 +374,10 @@ const EditToken = (props) => {
...
@@ -374,10 +374,10 @@ const EditToken = (props) => {
autoComplete
=
'off'
autoComplete
=
'off'
type
=
'number'
type
=
'number'
data
=
{[
data
=
{[
{
value
:
10
,
label
:
'10个'
},
{
value
:
10
,
label
:
'10个'
},
{
value
:
20
,
label
:
'20个'
},
{
value
:
20
,
label
:
'20个'
},
{
value
:
30
,
label
:
'30个'
},
{
value
:
30
,
label
:
'30个'
},
{
value
:
100
,
label
:
'100个'
},
{
value
:
100
,
label
:
'100个'
},
]}
]}
disabled
=
{
unlimited_quota
}
disabled
=
{
unlimited_quota
}
/
>
/
>
...
@@ -386,7 +386,7 @@ const EditToken = (props) => {
...
@@ -386,7 +386,7 @@ const EditToken = (props) => {
<
div
>
<
div
>
<
Button
<
Button
style
=
{{
marginTop
:
8
}}
style
=
{{
marginTop
:
8
}}
type
=
{
'warning'
}
type
=
{
'warning'
}
onClick
=
{()
=>
{
onClick
=
{()
=>
{
setUnlimitedQuota
();
setUnlimitedQuota
();
...
@@ -395,8 +395,8 @@ const EditToken = (props) => {
...
@@ -395,8 +395,8 @@ const EditToken = (props) => {
{
unlimited_quota
?
'取消无限额度'
:
'设为无限额度'
}
{
unlimited_quota
?
'取消无限额度'
:
'设为无限额度'
}
<
/Button
>
<
/Button
>
<
/div
>
<
/div
>
<
Divider
/>
<
Divider
/>
<
div
style
=
{{
marginTop
:
10
}}
>
<
div
style
=
{{
marginTop
:
10
}}
>
<
Typography
.
Text
>
IP
白名单(请勿过度信任此功能)
<
/Typography.Text
>
<
Typography
.
Text
>
IP
白名单(请勿过度信任此功能)
<
/Typography.Text
>
<
/div
>
<
/div
>
<
TextArea
<
TextArea
...
@@ -407,9 +407,9 @@ const EditToken = (props) => {
...
@@ -407,9 +407,9 @@ const EditToken = (props) => {
handleInputChange
(
'allow_ips'
,
value
);
handleInputChange
(
'allow_ips'
,
value
);
}}
}}
value
=
{
inputs
.
allow_ips
}
value
=
{
inputs
.
allow_ips
}
style
=
{{
fontFamily
:
'JetBrains Mono, Consolas'
}}
style
=
{{
fontFamily
:
'JetBrains Mono, Consolas'
}}
/
>
/
>
<
div
style
=
{{
marginTop
:
10
,
display
:
'flex'
}}
>
<
div
style
=
{{
marginTop
:
10
,
display
:
'flex'
}}
>
<
Space
>
<
Space
>
<
Checkbox
<
Checkbox
name
=
'model_limits_enabled'
name
=
'model_limits_enabled'
...
@@ -425,7 +425,7 @@ const EditToken = (props) => {
...
@@ -425,7 +425,7 @@ const EditToken = (props) => {
<
/div
>
<
/div
>
<
Select
<
Select
style
=
{{
marginTop
:
8
}}
style
=
{{
marginTop
:
8
}}
placeholder
=
{
'请选择该渠道所支持的模型'
}
placeholder
=
{
'请选择该渠道所支持的模型'
}
name
=
'models'
name
=
'models'
required
required
...
@@ -439,12 +439,12 @@ const EditToken = (props) => {
...
@@ -439,12 +439,12 @@ const EditToken = (props) => {
optionList
=
{
models
}
optionList
=
{
models
}
disabled
=
{
!
model_limits_enabled
}
disabled
=
{
!
model_limits_enabled
}
/
>
/
>
<
div
style
=
{{
marginTop
:
10
}}
>
<
div
style
=
{{
marginTop
:
10
}}
>
<
Typography
.
Text
>
令牌分组,默认为用户的分组
<
/Typography.Text
>
<
Typography
.
Text
>
令牌分组,默认为用户的分组
<
/Typography.Text
>
<
/div
>
<
/div
>
{
groups
.
length
>
0
?
<
Select
<
Select
style
=
{{
marginTop
:
8
}}
style
=
{{
marginTop
:
8
}}
placeholder
=
{
'令牌分组,默认为用户的分组'
}
placeholder
=
{
'令牌分组,默认为用户的分组'
}
name
=
'gruop'
name
=
'gruop'
required
required
...
@@ -455,7 +455,14 @@ const EditToken = (props) => {
...
@@ -455,7 +455,14 @@ const EditToken = (props) => {
value
=
{
inputs
.
group
}
value
=
{
inputs
.
group
}
autoComplete
=
'new-password'
autoComplete
=
'new-password'
optionList
=
{
groups
}
optionList
=
{
groups
}
/>
:
<
Select
style
=
{{
marginTop
:
8
}}
placeholder
=
{
'管理员未设置用户可选分组'
}
name
=
'gruop'
disabled
=
{
true
}
/
>
/
>
}
<
/Spin
>
<
/Spin
>
<
/SideSheet
>
<
/SideSheet
>
<
/
>
<
/
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment