mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-17 16:06:38 +08:00
feat: 保留功能
This commit is contained in:
parent
64b9d3b58c
commit
2db4282666
@ -9,6 +9,9 @@ var CheckSensitiveOnCompletionEnabled = true
|
||||
// StopOnSensitiveEnabled 如果检测到敏感词,是否立刻停止生成,否则替换敏感词
|
||||
var StopOnSensitiveEnabled = true
|
||||
|
||||
// StreamCacheQueueLength 流模式缓存队列长度,0表示无缓存
|
||||
var StreamCacheQueueLength = 0
|
||||
|
||||
// SensitiveWords 敏感词
|
||||
// var SensitiveWords []string
|
||||
var SensitiveWords = []string{
|
||||
|
@ -95,6 +95,7 @@ func InitOptionMap() {
|
||||
common.OptionMap["CheckSensitiveOnCompletionEnabled"] = strconv.FormatBool(constant.CheckSensitiveOnCompletionEnabled)
|
||||
common.OptionMap["StopOnSensitiveEnabled"] = strconv.FormatBool(constant.StopOnSensitiveEnabled)
|
||||
common.OptionMap["SensitiveWords"] = constant.SensitiveWordsToString()
|
||||
common.OptionMap["StreamCacheQueueLength"] = strconv.Itoa(constant.StreamCacheQueueLength)
|
||||
|
||||
common.OptionMapRWMutex.Unlock()
|
||||
loadOptionsFromDatabase()
|
||||
@ -288,6 +289,8 @@ func updateOptionMap(key string, value string) (err error) {
|
||||
common.QuotaPerUnit, _ = strconv.ParseFloat(value, 64)
|
||||
case "SensitiveWords":
|
||||
constant.SensitiveWordsFromString(value)
|
||||
case "StreamCacheQueueLength":
|
||||
constant.StreamCacheQueueLength, _ = strconv.Atoi(value)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ const OperationSetting = () => {
|
||||
QuotaForInvitee: 0,
|
||||
QuotaRemindThreshold: 0,
|
||||
PreConsumedQuota: 0,
|
||||
StreamCacheQueueLength: 0,
|
||||
ModelRatio: '',
|
||||
ModelPrice: '',
|
||||
GroupRatio: '',
|
||||
@ -307,6 +308,8 @@ const OperationSetting = () => {
|
||||
name="CheckSensitiveOnCompletionEnabled"
|
||||
onChange={handleInputChange}
|
||||
/>
|
||||
</Form.Group>
|
||||
<Form.Group inline>
|
||||
<Form.Checkbox
|
||||
checked={inputs.StopOnSensitiveEnabled === 'true'}
|
||||
label="在检测到屏蔽词时,立刻停止生成,否则替换屏蔽词"
|
||||
@ -314,6 +317,17 @@ const OperationSetting = () => {
|
||||
onChange={handleInputChange}
|
||||
/>
|
||||
</Form.Group>
|
||||
{/*<Form.Group>*/}
|
||||
{/* <Form.Input*/}
|
||||
{/* label="流模式下缓存队列,默认不缓存,设置越大检测越准确,但是回复会有卡顿感"*/}
|
||||
{/* name="StreamCacheTextLength"*/}
|
||||
{/* onChange={handleInputChange}*/}
|
||||
{/* value={inputs.StreamCacheQueueLength}*/}
|
||||
{/* type="number"*/}
|
||||
{/* min="0"*/}
|
||||
{/* placeholder="例如:10"*/}
|
||||
{/* />*/}
|
||||
{/*</Form.Group>*/}
|
||||
<Form.Group widths="equal">
|
||||
<Form.TextArea
|
||||
label="屏蔽词列表,一行一个屏蔽词,不需要符号分割"
|
||||
|
Loading…
Reference in New Issue
Block a user