mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-04 16:37:46 +08:00
fix(frontend): preserve fetched model preset pricing
This commit is contained in:
@@ -394,6 +394,7 @@
|
||||
ref="tieredPricingEditorRef"
|
||||
v-model="tieredPricing"
|
||||
class="mt-3"
|
||||
:auto-fill-missing-cache-prices="autoFillMissingCachePrices"
|
||||
:show-token-pricing="billingMode === 'token'"
|
||||
:show-image-pricing="isImageGenerationEnabled"
|
||||
:show-image-editor="billingMode === 'image'"
|
||||
@@ -780,6 +781,7 @@ function enterManualEntryMode() {
|
||||
}
|
||||
|
||||
function reopenPresetPanel() {
|
||||
clearSelection()
|
||||
presetPanelCollapsed.value = false
|
||||
}
|
||||
|
||||
@@ -1068,8 +1070,6 @@ function selectModel(model: ModelsDevModelItem) {
|
||||
imageGenerationExplicitOverride.value = null
|
||||
selectedModel.value = model
|
||||
expandedProvider.value = model.providerId
|
||||
form.value.name = model.modelId
|
||||
form.value.display_name = model.modelName
|
||||
|
||||
// 构建 config
|
||||
const config: Record<string, unknown> = {
|
||||
@@ -1089,11 +1089,16 @@ function selectModel(model: ModelsDevModelItem) {
|
||||
if (model.releaseDate) config.release_date = model.releaseDate
|
||||
if (model.inputModalities?.length) config.input_modalities = model.inputModalities
|
||||
if (model.outputModalities?.length) config.output_modalities = model.outputModalities
|
||||
form.value.config = config
|
||||
const supportedCapabilities = new Set<string>()
|
||||
if (model.supportsEmbedding) supportedCapabilities.add('embedding')
|
||||
if (model.outputModalities?.includes('image')) supportedCapabilities.add('image_generation')
|
||||
form.value.supported_capabilities = [...supportedCapabilities]
|
||||
form.value = {
|
||||
...defaultForm(),
|
||||
name: model.modelId,
|
||||
display_name: model.modelName,
|
||||
config,
|
||||
supported_capabilities: [...supportedCapabilities],
|
||||
}
|
||||
if (model.supportsEmbedding) {
|
||||
setEmbeddingEnabled(true)
|
||||
}
|
||||
@@ -1120,6 +1125,7 @@ function clearSelection() {
|
||||
selectedModel.value = null
|
||||
form.value = defaultForm()
|
||||
tieredPricing.value = null
|
||||
videoResolutionPrices.value = []
|
||||
billingMode.value = 'token'
|
||||
}
|
||||
|
||||
@@ -1192,6 +1198,10 @@ const { isEditMode, handleDialogUpdate, handleCancel } = useFormDialog({
|
||||
resetForm,
|
||||
})
|
||||
|
||||
const autoFillMissingCachePrices = computed(() => (
|
||||
!isEditMode.value && selectedModel.value === null
|
||||
))
|
||||
|
||||
async function handleSubmit() {
|
||||
if (!form.value.name || !form.value.display_name) {
|
||||
showError('请填写模型ID和名称')
|
||||
|
||||
Reference in New Issue
Block a user