@@ -56,23 +56,22 @@ const loading = ref<boolean>(false)
5656const dialogVisible = ref <boolean >(false )
5757const list_provider = ref <Array <Provider >>([])
5858const currentModelType = ref (' ' )
59-
59+ const selectModelType = ref ( ' ' )
6060const modelTypeOptions = [{ text: t (' views.template.model.allModel' ), value: ' ' }, ... modelTypeList ]
6161
62- const open = () => {
62+ const open = (model_type ? : string ) => {
6363 dialogVisible .value = true
6464 const option = modelTypeOptions .find ((item ) => item .text === currentModelType .value )
65- checkModelType (option ? option .value : ' ' )
65+ checkModelType (model_type ? model_type : option ? option .value : ' ' )
6666}
6767
6868const close = () => {
6969 dialogVisible .value = false
7070}
7171
7272const checkModelType = (model_type : string ) => {
73- currentModelType .value = modelTypeOptions .filter (
74- (item ) => item .value === model_type
75- )[0 ].text
73+ selectModelType .value = model_type
74+ currentModelType .value = modelTypeOptions .filter ((item ) => item .value === model_type )[0 ].text
7675 ModelApi .getProviderByModelType (model_type , loading ).then ((ok ) => {
7776 list_provider .value = ok .data
7877 list_provider .value .sort ((a , b ) => a .provider .localeCompare (b .provider ))
@@ -82,7 +81,7 @@ const checkModelType = (model_type: string) => {
8281const emit = defineEmits ([' change' ])
8382const go_create = (provider : Provider ) => {
8483 close ()
85- emit (' change' , provider )
84+ emit (' change' , provider , selectModelType . value )
8685}
8786defineExpose ({ open , close })
8887 </script >
0 commit comments