Skip to content

Commit 80f0f34

Browse files
authored
Add quantization selection to NewEndpoint.vue (#962)
- Add quantization form item - Add quantization validation rule - Fetch available quantizations on model select - Update locale files with quantization translation
1 parent 2c55446 commit 80f0f34

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

frontend/src/components/endpoints/NewEndpoint.vue

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
v-model="dataForm.model_id"
6262
:fetch-suggestions="fetchModels"
6363
:placeholder="t('all.pleaseInput', { value: t('endpoints.new.modelId') })"
64-
@select="updateRuntimeFramework"
64+
@select="loadRequiredData"
6565
/>
6666
</el-form-item>
6767
</div>
@@ -153,6 +153,7 @@
153153
</p>
154154
</el-form-item>
155155

156+
<!-- runtime framework -->
156157
<el-form-item
157158
:label="t('endpoints.new.framework')"
158159
class="w-full"
@@ -172,6 +173,26 @@
172173
</el-select>
173174
</el-form-item>
174175

176+
<!-- quantization -->
177+
<el-form-item
178+
:label="t('endpoints.new.quantization')"
179+
class="w-full"
180+
prop="quantization">
181+
<el-select
182+
v-model="dataForm.quantization"
183+
:placeholder="
184+
t('all.pleaseSelect', { value: t('endpoints.new.quantization') })
185+
"
186+
size="large"
187+
style="width: 100%">
188+
<el-option
189+
v-for="item in availableQuantizations"
190+
:key="item.name"
191+
:label="item.name"
192+
:value="item.name" />
193+
</el-select>
194+
</el-form-item>
195+
175196
<el-form-item class="w-full">
176197
<PublicAndPrivateRadioGroup
177198
v-model="dataForm.visibility"
@@ -221,6 +242,7 @@
221242
const endpointClusters = ref([])
222243
const endpointResources = ref([])
223244
const loading = ref(false)
245+
const availableQuantizations = ref([])
224246
225247
const replicaRanges = [1, 2, 3, 4, 5]
226248
@@ -304,6 +326,15 @@
304326
}),
305327
trigger: 'blur'
306328
}
329+
],
330+
quantization: [
331+
{
332+
required: true,
333+
message: t('all.pleaseSelect', {
334+
value: t('endpoints.new.quantization')
335+
}),
336+
trigger: 'blur'
337+
}
307338
]
308339
})
309340
@@ -355,6 +386,11 @@
355386
}
356387
}
357388
389+
const loadRequiredData = () => {
390+
updateRuntimeFramework()
391+
fetchQuantizations()
392+
}
393+
358394
const updateRuntimeFramework = async () => {
359395
if (!dataForm.value.model_id) return
360396
const { data, error } = await useFetchApi(
@@ -437,6 +473,16 @@
437473
}
438474
}
439475
476+
const fetchQuantizations = async () => {
477+
const quantizationEndpoint = `/models/${dataForm.value.model_id}/quantizations`
478+
const { data, error } = await useFetchApi(quantizationEndpoint).json()
479+
if (data.value) {
480+
availableQuantizations.value = data.value.data
481+
} else {
482+
console.log(error.value.msg)
483+
}
484+
}
485+
440486
onMounted(() => {
441487
fetchClusters()
442488
})

frontend/src/locales/en_js/endpoints.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const endpoints = {
3333
dedicated: "Dedicated endpoint",
3434
tip: "Applied to the endpoint, cannot be changed after creation",
3535
createFail: "Failed to create endpoint",
36+
quantization: "Quantization"
3637
},
3738
settings: {
3839
stop: "Stop",

frontend/src/locales/zh_js/endpoints.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const endpoints = {
3333
tip: "应用于专属实例,创建后不可更改",
3434
createSuccess: "专属实例创建成功",
3535
createFail: "专属实例创建失败",
36+
quantization: "量化"
3637
},
3738
settings: {
3839
stop: "暂停",

0 commit comments

Comments
 (0)