fix local model bug

This commit is contained in:
Liujian
2025-03-13 14:16:03 +08:00
parent 111877a1e4
commit 6210a06d43
5 changed files with 213 additions and 214 deletions
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -512,8 +512,8 @@ func (i *imlLocalModel) OnInit() {
})
models, version := ai_provider_local.ModelsCanInstall()
for _, model := range models {
if v, ok := oldModels[model.Id]; ok {
delete(oldModels, model.Id)
if v.Version == version {
continue
}
@@ -541,7 +541,7 @@ func (i *imlLocalModel) OnInit() {
return
}
}
delete(oldModels, model.Id)
}
for id := range oldModels {
err = i.localModelPackageService.Delete(ctx, id)
-1
View File
@@ -694,7 +694,6 @@ func (i *imlProviderModule) UpdateProviderConfig(ctx context.Context, id string,
}, newKey(defaultKey),
}, true)
return nil
})
}
+1 -1
View File
@@ -21,7 +21,7 @@ type imlLocalModelService struct {
}
func (i *imlLocalModelService) UpdateProvider(ctx context.Context, provider string, ids ...string) error {
_, err := i.store.UpdateWhere(ctx, map[string]interface{}{"provider": provider}, map[string]interface{}{"uuid": ids})
_, err := i.store.UpdateField(ctx, "provider", provider, "uuid in (?)", ids)
return err
}
+2 -2
View File
@@ -138,7 +138,8 @@ type LocalModelPackage struct {
Name string `gorm:"type:varchar(100);not null;column:name;comment:名称"`
Size string `gorm:"type:varchar(100);not null;column:size;comment:模型大小"`
Hash string `gorm:"type:varchar(100);not null;column:hash;comment:模型hash"`
Description string `gorm:"type:varchar(255);not null;column:description;comment:描述"`
Description string `gorm:"type:varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;not null;column:description;comment:描述"`
Text string `gorm:"type:varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;not null;column:text;comment:描述"`
Version string `gorm:"type:varchar(100);not null;column:version;comment:版本"`
IsPopular bool `gorm:"type:tinyint(1);not null;column:is_popular;comment:是否热门"`
}
@@ -187,4 +188,3 @@ func (i *ProviderModel) TableName() string {
func (i *ProviderModel) IdValue() int64 {
return i.Id
}