@@ -250,12 +250,13 @@ func (llm *SLLM) PerformQuickModels(ctx context.Context, userCred mcclient.Token
250250 errs = append (errs , errors .Wrap (err , "FetchByIdOrName" ))
251251 }
252252 } else {
253- instApp := instModelObj .(* SInstantModel )
254- input .Models [i ].Id = instApp .Id
255- input .Models [i ].ModelId = instApp .ModelId
256- input .Models [i ].Tag = instApp .ModelTag
253+ instMdl := instModelObj .(* SInstantModel )
254+ input .Models [i ].Id = instMdl .Id
255+ input .Models [i ].ModelId = instMdl .ModelId
256+ input .Models [i ].Tag = instMdl .ModelTag
257+ input .Models [i ].LlmType = instMdl .LlmType
257258 if input .Method == apis .QuickModelInstall {
258- toInstallSizeGb += float64 (instApp .GetActualSizeMb ()) * 1024 * 1024 / 1000 / 1000 / 1000
259+ toInstallSizeGb += float64 (instMdl .GetActualSizeMb ()) * 1024 * 1024 / 1000 / 1000 / 1000
259260 }
260261 }
261262 } else {
@@ -269,8 +270,12 @@ func (llm *SLLM) PerformQuickModels(ctx context.Context, userCred mcclient.Token
269270 input .Models [i ].Id = mdl .Id
270271 input .Models [i ].Tag = mdl .ModelTag
271272 input .Models [i ].ModelId = mdl .ModelId
273+ input .Models [i ].LlmType = mdl .LlmType
272274 }
273275 }
276+ if ! apis .IsLLMContainerType (input .Models [i ].LlmType ) || apis .LLMContainerType (input .Models [i ].LlmType ) != llm .GetLLMContainerDriver ().GetType () {
277+ errs = append (errs , errors .Wrapf (httperrors .ErrInvalidStatus , "model %s is not of type %s" , input .Models [i ].ModelId , llm .GetLLMContainerDriver ().GetType ()))
278+ }
274279 }
275280 if len (errs ) > 0 {
276281 return nil , errors .NewAggregate (errs )
@@ -610,7 +615,7 @@ type mdlFullNameInfo struct {
610615 IsMounted bool
611616}
612617
613- func (llm * SLLM ) UpdateMountedModelFullNames (ctx context.Context , mdlinfos []string , isReset bool , imageId string , skuId string ) error {
618+ func (llm * SLLM ) UpdateMountedModelFullNames (ctx context.Context , userCred mcclient. TokenCredential , mdlinfos []string , isReset bool , imageId string , skuId string ) error {
614619 mdlFullNameInfos := make (map [string ]* mdlFullNameInfo )
615620 for i := range mdlinfos {
616621 parts := strings .Split (mdlinfos [i ], "@" )
@@ -636,15 +641,19 @@ func (llm *SLLM) UpdateMountedModelFullNames(ctx context.Context, mdlinfos []str
636641 }
637642 }
638643 for i := range sku .MountedModels {
639- parts := strings .Split (sku .MountedModels [i ], "@" )
640- if ! isReset && slices .Contains (deletedModelIds , parts [0 ]) {
641- // if not reset, and the package is deleted, skip it
644+ instMdl , err := GetInstantModelManager ().FetchByIdOrName (ctx , userCred , sku .MountedModels [i ])
645+ if err != nil {
646+ return errors .Wrap (err , "FetchByIdOrName" )
647+ }
648+ instantModle := instMdl .(* SInstantModel )
649+ if ! isReset && slices .Contains (deletedModelIds , instantModle .ModelId ) {
650+ // if not reset, and the model is deleted, skip it
642651 continue
643652 }
644- if _ , ok := mdlFullNameInfos [parts [ 0 ] ]; ! ok {
645- mdlFullNameInfos [parts [ 0 ] ] = & mdlFullNameInfo {
646- ModelId : parts [ 0 ] ,
647- ModelFullName : parts [ 1 ] ,
653+ if _ , ok := mdlFullNameInfos [instantModle . ModelId ]; ! ok {
654+ mdlFullNameInfos [instantModle . ModelId ] = & mdlFullNameInfo {
655+ ModelId : instantModle . ModelId ,
656+ ModelFullName : instantModle . ModelName + ":" + instantModle . ModelTag ,
648657 IsMounted : false ,
649658 }
650659 }
0 commit comments