diff options
| author | Paul Buetow <paul@buetow.org> | 2025-08-17 22:57:19 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-08-17 22:57:19 +0300 |
| commit | 8dfbbbb6de0f0c67413ee157e976fc3eaee4f914 (patch) | |
| tree | 8147798438d61a7ddb2769e005c05aece9b586fc /internal/llm/copilot.go | |
| parent | c83acd3f5749fe240464283a43f8b03797a1b544 (diff) | |
logging: move ChatLogger to value semantics; llm: switch clients to value receivers and return values from constructors
Diffstat (limited to 'internal/llm/copilot.go')
| -rw-r--r-- | internal/llm/copilot.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/internal/llm/copilot.go b/internal/llm/copilot.go index 7cc0278..cf24565 100644 --- a/internal/llm/copilot.go +++ b/internal/llm/copilot.go @@ -21,7 +21,7 @@ type copilotClient struct { apiKey string baseURL string defaultModel string - chatLogger *logging.ChatLogger + chatLogger logging.ChatLogger } func newCopilot(baseURL, model, apiKey string) Client { @@ -31,13 +31,13 @@ func newCopilot(baseURL, model, apiKey string) Client { if strings.TrimSpace(model) == "" { model = "gpt-4.1" } - return &copilotClient{ - httpClient: &http.Client{Timeout: 30 * time.Second}, - apiKey: apiKey, - baseURL: strings.TrimRight(baseURL, "/"), - defaultModel: model, - chatLogger: logging.NewChatLogger("copilot"), - } + return copilotClient{ + httpClient: &http.Client{Timeout: 30 * time.Second}, + apiKey: apiKey, + baseURL: strings.TrimRight(baseURL, "/"), + defaultModel: model, + chatLogger: logging.NewChatLogger("copilot"), + } } type copilotChatRequest struct { @@ -70,7 +70,7 @@ type copilotChatResponse struct { } `json:"error,omitempty"` } -func (c *copilotClient) Chat(ctx context.Context, messages []Message, opts ...RequestOption) (string, error) { +func (c copilotClient) Chat(ctx context.Context, messages []Message, opts ...RequestOption) (string, error) { if strings.TrimSpace(c.apiKey) == "" { return nilStringErr("missing Copilot API key") } @@ -158,5 +158,5 @@ func (c *copilotClient) Chat(ctx context.Context, messages []Message, opts ...Re } // Provider metadata -func (c *copilotClient) Name() string { return "copilot" } -func (c *copilotClient) DefaultModel() string { return c.defaultModel }
\ No newline at end of file +func (c copilotClient) Name() string { return "copilot" } +func (c copilotClient) DefaultModel() string { return c.defaultModel } |
