| 280 | } |
| 281 | |
| 282 | func endpointFromInput(input ProviderInput) providers.Endpoint { |
| 283 | supportedClient := input.SupportedClient |
| 284 | if supportedClient == "" && len(input.Clients) > 0 { |
| 285 | supportedClient = joinClients(input.Clients) |
| 286 | } |
| 287 | endpoint := providers.Endpoint{ |
| 288 | Endpoint: input.Endpoint, |
| 289 | APIKey: input.APIKey, |
| 290 | APIKeyEnv: input.APIKeyEnv, |
| 291 | SupportedClient: supportedClient, |
| 292 | ListModelsCmd: input.ListModelsCmd, |
| 293 | Models: append([]string(nil), input.Models...), |
| 294 | KeepProxyConfig: input.KeepProxyConfig, |
| 295 | UseProxy: input.UseProxy, |
| 296 | Description: input.Description, |
| 297 | } |
| 298 | if input.Enabled != nil { |
| 299 | endpoint.Enabled = input.Enabled |
| 300 | } |
| 301 | return endpoint |
| 302 | } |
| 303 | |
| 304 | func splitClients(raw string) []string { |
| 305 | return providers.Endpoint{SupportedClient: raw}.Clients() |