fix: fail to delete model

This commit is contained in:
Liujian
2025-08-08 11:29:26 +08:00
parent 8fba1911ad
commit ef1ccb81a9
+6 -2
View File
@@ -128,10 +128,11 @@ func (i *imlProviderModelModule) DeleteProviderModel(ctx *gin.Context, provider
if err := i.providerModelService.Delete(ctx, id); err != nil {
return err
}
if p.GetModelConfig().AccessConfigurationStatus {
err = i.syncGateway(ctx, cluster.DefaultClusterID, []*gateway.DynamicRelease{
{
BasicItem: &gateway.BasicItem{
ID: fmt.Sprintf("%s#%s", provider, modelInfo.Name),
ID: fmt.Sprintf("%s$%s", provider, modelInfo.Name),
Resource: "ai-model",
},
Attr: nil,
@@ -140,6 +141,7 @@ func (i *imlProviderModelModule) DeleteProviderModel(ctx *gin.Context, provider
if err != nil {
return err
}
}
p.RemoveModel(id)
return nil
@@ -200,7 +202,9 @@ func (i *imlProviderModelModule) AddProviderModel(ctx *gin.Context, provider str
}
func newModel(provider string, model string, config string) *gateway.DynamicRelease {
if config == "" {
config = "{}"
}
return &gateway.DynamicRelease{
BasicItem: &gateway.BasicItem{
ID: fmt.Sprintf("%s$%s", provider, model),