feat: support configuring ratio when estimating token number in stream mode

This commit is contained in:
JustSong
2023-04-28 17:25:05 +08:00
parent 23ec541ba6
commit 480e789cd8
4 changed files with 21 additions and 1 deletions

View File

@@ -25,6 +25,7 @@ const SystemSetting = () => {
TurnstileSecretKey: '',
RegisterEnabled: '',
QuotaForNewUser: 0,
BytesNumber2Quota: 0.8,
TopUpLink: ''
});
let originInputs = {};
@@ -90,6 +91,7 @@ const SystemSetting = () => {
name === 'TurnstileSiteKey' ||
name === 'TurnstileSecretKey' ||
name === 'QuotaForNewUser' ||
name === 'BytesNumber2Quota' ||
name === 'TopUpLink'
) {
setInputs((inputs) => ({ ...inputs, [name]: value }));
@@ -107,6 +109,9 @@ const SystemSetting = () => {
if (originInputs['QuotaForNewUser'] !== inputs.QuotaForNewUser) {
await updateOption('QuotaForNewUser', inputs.QuotaForNewUser);
}
if (originInputs['BytesNumber2Quota'] !== inputs.BytesNumber2Quota) {
await updateOption('BytesNumber2Quota', inputs.BytesNumber2Quota);
}
if (originInputs['TopUpLink'] !== inputs.TopUpLink) {
await updateOption('TopUpLink', inputs.TopUpLink);
}
@@ -255,6 +260,17 @@ const SystemSetting = () => {
min='0'
placeholder='例如100'
/>
<Form.Input
label='Stream 模式下估算 token 时所使用的倍率'
name='BytesNumber2Quota'
onChange={handleInputChange}
autoComplete='off'
value={inputs.BytesNumber2Quota}
type='number'
step='0.01'
min='0'
placeholder='例如0.8'
/>
<Form.Input
label='充值链接'
name='TopUpLink'