(ctx *gin.Context, input *ai_local_dto.OllamaConfig)
| 78 | ) |
| 79 | |
| 80 | func (i *imlLocalModelController) OllamaConfigUpdate(ctx *gin.Context, input *ai_local_dto.OllamaConfig) error { |
| 81 | u, err := url.Parse(input.Address) |
| 82 | if err != nil { |
| 83 | return nil |
| 84 | } |
| 85 | ollamaClient := ollama_api.NewClient(u, client) |
| 86 | _, err = ollamaClient.Version(ctx) |
| 87 | if err != nil { |
| 88 | return err |
| 89 | } |
| 90 | return i.transaction.Transaction(ctx, func(ctx context.Context) error { |
| 91 | err = i.module.SyncLocalModels(ctx, input.Address) |
| 92 | if err != nil { |
| 93 | return err |
| 94 | } |
| 95 | err = i.aiBalanceModule.SyncLocalBalances(ctx, input.Address) |
| 96 | if err != nil { |
| 97 | return err |
| 98 | } |
| 99 | |
| 100 | return i.settingModule.Set(ctx, &system_dto.InputSetting{ |
| 101 | OllamaAddress: &input.Address, |
| 102 | }) |
| 103 | }) |
| 104 | } |
| 105 | |
| 106 | func (i *imlLocalModelController) SimpleList(ctx *gin.Context) ([]*ai_local_dto.SimpleItem, error) { |
| 107 | return i.module.SimpleList(ctx) |
nothing calls this directly
no test coverage detected