(cfg config.Copilot)
| 54 | var _ Provider = &Copilot{} |
| 55 | |
| 56 | func NewCopilot(cfg config.Copilot) *Copilot { |
| 57 | if cfg.Name == "" { |
| 58 | cfg.Name = config.ProviderCopilot |
| 59 | } |
| 60 | if cfg.BaseURL == "" { |
| 61 | cfg.BaseURL = copilotBaseURL |
| 62 | } |
| 63 | if cfg.APIDumpDir == "" { |
| 64 | cfg.APIDumpDir = os.Getenv("BRIDGE_DUMP_DIR") |
| 65 | } |
| 66 | if cfg.CircuitBreaker != nil { |
| 67 | cfg.CircuitBreaker.OpenErrorResponse = copilotOpenErrorResponse |
| 68 | } |
| 69 | return &Copilot{ |
| 70 | cfg: cfg, |
| 71 | circuitBreaker: cfg.CircuitBreaker, |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | func (*Copilot) Type() string { |
| 76 | return config.ProviderCopilot |
no outgoing calls