mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
perf: 优化模型代码 (#461)
This commit is contained in:
parent
69f5450db2
commit
7f699c9c90
|
|
@ -134,7 +134,6 @@ import type { FormField } from '@/components/dynamics-form/type'
|
|||
import DynamicsForm from '@/components/dynamics-form/index.vue'
|
||||
import type { FormRules } from 'element-plus'
|
||||
import { MsgSuccess } from '@/utils/message'
|
||||
import { QuestionFilled } from '@element-plus/icons-vue'
|
||||
|
||||
const providerValue = ref<Provider>()
|
||||
const dynamicsFormRef = ref<InstanceType<typeof DynamicsForm>>()
|
||||
|
|
@ -214,6 +213,7 @@ const list_base_model = (model_type: any) => {
|
|||
const close = () => {
|
||||
base_form_data.value = { name: '', model_type: '', model_name: '' }
|
||||
credential_form_data.value = {}
|
||||
model_form_field.value = []
|
||||
dialogVisible.value = false
|
||||
}
|
||||
const submit = () => {
|
||||
|
|
|
|||
|
|
@ -128,7 +128,6 @@ import type { FormField } from '@/components/dynamics-form/type'
|
|||
import DynamicsForm from '@/components/dynamics-form/index.vue'
|
||||
import type { FormRules } from 'element-plus'
|
||||
import { MsgSuccess } from '@/utils/message'
|
||||
import { QuestionFilled } from '@element-plus/icons-vue'
|
||||
import AppIcon from '@/components/icons/AppIcon.vue'
|
||||
|
||||
const providerValue = ref<Provider>()
|
||||
|
|
@ -218,6 +217,7 @@ const close = () => {
|
|||
base_form_data.value = { name: '', model_type: '', model_name: '' }
|
||||
dynamicsFormRef.value?.ruleFormRef?.resetFields()
|
||||
credential_form_data.value = {}
|
||||
model_form_field.value = []
|
||||
dialogVisible.value = false
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,6 @@
|
|||
ref="createModelRef"
|
||||
@submit="list_model"
|
||||
@change="openCreateModel($event)"
|
||||
:key="dialogState.createModelDialogKey"
|
||||
></CreateModelDialog>
|
||||
|
||||
<SelectProviderDialog
|
||||
|
|
@ -81,8 +80,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { onMounted, ref, computed, reactive } from 'vue'
|
||||
import { onMounted, ref, computed } from 'vue'
|
||||
import ModelApi from '@/api/model'
|
||||
import type { Provider, Model } from '@/api/type/model'
|
||||
import AppIcon from '@/components/icons/AppIcon.vue'
|
||||
|
|
@ -129,7 +127,6 @@ const openCreateModel = (provider?: Provider) => {
|
|||
createModelRef.value?.open(provider)
|
||||
} else {
|
||||
selectProviderRef.value?.open()
|
||||
refreshCreateModelDialogKey() // 更新key
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -140,16 +137,6 @@ const list_model = () => {
|
|||
})
|
||||
}
|
||||
|
||||
// 添加一个响应式的state来存储dialog的key
|
||||
const dialogState = reactive({
|
||||
createModelDialogKey: Date.now() // 初始值为当前的时间戳
|
||||
})
|
||||
|
||||
// 更新dialogState.createModelDialogKey的函数
|
||||
const refreshCreateModelDialogKey = () => {
|
||||
dialogState.createModelDialogKey = Date.now() // 更新为新的时间戳
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
ModelApi.getProvider(loading).then((ok) => {
|
||||
active_provider.value = allObj
|
||||
|
|
|
|||
Loading…
Reference in New Issue