constrain edge value of serveWeight for llm

This commit is contained in:
geekgeekrun
2025-04-16 00:32:06 +08:00
parent 76339ebc5c
commit 94e237fee8
2 changed files with 10 additions and 2 deletions

View File

@@ -34,6 +34,14 @@ const pickLlmConfigFromList = (llmConfigList) => {
if (!llmConfigList.length) { if (!llmConfigList.length) {
return null return null
} }
llmConfigList.forEach((conf) => {
if (!Number(conf.serveWeight) || conf.serveWeight < 1) {
conf.serveWeight = 1
}
if (conf.serveWeight > 100) {
conf.serveWeight = 100
}
})
const pool: number[] = [] const pool: number[] = []
for (let i = 0; i < llmConfigList.length; i++) { for (let i = 0; i < llmConfigList.length; i++) {
for (let j = 0; j < Math.floor(llmConfigList[i].serveWeight); j++) { for (let j = 0; j < Math.floor(llmConfigList[i].serveWeight); j++) {

View File

@@ -188,13 +188,13 @@
<el-input-number <el-input-number
v-if="formContent.length > 1" v-if="formContent.length > 1"
v-model="conf.serveWeight" v-model="conf.serveWeight"
:min="0" :min="1"
:max="100" :max="100"
:step="1" :step="1"
step-strictly step-strictly
:precision="0" :precision="0"
font-size-12px font-size-12px
placeholder="0 ~ 100" placeholder="1 ~ 100"
@change=" @change="
(new_val, old_val) => { (new_val, old_val) => {
gtagRenderer('serve_weight_changed', { new_val, old_val }) gtagRenderer('serve_weight_changed', { new_val, old_val })