MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / OllamaConfigUpdate

Method OllamaConfigUpdate

controller/ai-local/iml.go:80–104  ·  view source on GitHub ↗
(ctx *gin.Context, input *ai_local_dto.OllamaConfig)

Source from the content-addressed store, hash-verified

78)
79
80func (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
106func (i *imlLocalModelController) SimpleList(ctx *gin.Context) ([]*ai_local_dto.SimpleItem, error) {
107 return i.module.SimpleList(ctx)

Callers

nothing calls this directly

Calls 4

VersionMethod · 0.65
SyncLocalModelsMethod · 0.65
SyncLocalBalancesMethod · 0.65
SetMethod · 0.65

Tested by

no test coverage detected