MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / providerPatchFromDTO

Function providerPatchFromDTO

internal/desktop/provider_service.go:180–214  ·  view source on GitHub ↗
(input ProviderInput)

Source from the content-addressed store, hash-verified

178}
179
180func providerPatchFromDTO(input ProviderInput) appapi.ProviderPatch {
181 patch := appapi.ProviderPatch{
182 Enabled: input.Enabled,
183 }
184 if input.Endpoint != "" {
185 patch.Endpoint = &input.Endpoint
186 }
187 if input.APIKey != "" {
188 patch.APIKey = &input.APIKey
189 }
190 if input.APIKeyEnv != "" {
191 patch.APIKeyEnv = &input.APIKeyEnv
192 }
193 if input.SupportedClient != "" {
194 patch.SupportedClient = &input.SupportedClient
195 } else if len(input.Clients) > 0 {
196 patch.Clients = &providers.ListPatch{Op: providers.ListOpReplace, Items: input.Clients}
197 }
198 if input.Models != nil {
199 patch.Models = &providers.ListPatch{Op: providers.ListOpReplace, Items: input.Models}
200 }
201 if input.ListModelsCmd != "" {
202 patch.ListModelsCmd = &input.ListModelsCmd
203 }
204 if input.KeepProxyConfig {
205 patch.KeepProxyConfig = &input.KeepProxyConfig
206 }
207 if input.UseProxy {
208 patch.UseProxy = &input.UseProxy
209 }
210 if input.Description != "" {
211 patch.Description = &input.Description
212 }
213 return patch
214}
215
216func wrapProviderError(code string, err error, name string) error {
217 if err == nil {

Callers 1

UpdateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected