.gitignore 🔗
@@ -34,3 +34,6 @@ go.work.sum
# crush
.crush
dist/
+
+# temp dir
+/tmp
Andrey Nering created
.gitignore | 3 +++
cmd/copilot/main.go | 12 +++++++++++-
internal/providers/configs/copilot.json | 2 +-
3 files changed, 15 insertions(+), 2 deletions(-)
@@ -34,3 +34,6 @@ go.work.sum
# crush
.crush
dist/
+
+# temp dir
+/tmp
@@ -5,6 +5,7 @@ import (
"context"
"encoding/json"
"fmt"
+ "io"
"net/http"
"os"
"path/filepath"
@@ -128,8 +129,17 @@ func fetchCopilotModels() ([]Model, error) {
return nil, fmt.Errorf("unexpected status code: %d", resp.StatusCode)
}
+ bts, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return nil, fmt.Errorf("unable to read response body: %w", err)
+ }
+
+ // for debugging
+ _ = os.MkdirAll("tmp", 0o700)
+ _ = os.WriteFile("tmp/copilot-response.json", bts, 0o600)
+
var data Response
- if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
+ if err := json.Unmarshal(bts, &data); err != nil {
return nil, fmt.Errorf("unable to unmarshal json: %w", err)
}
return data.Data, nil
@@ -26,7 +26,7 @@
"cost_per_1m_out": 0,
"cost_per_1m_in_cached": 0,
"cost_per_1m_out_cached": 0,
- "context_window": 144000,
+ "context_window": 160000,
"default_max_tokens": 16000,
"can_reason": false,
"supports_attachments": false,