v0.3.70 5bef29b

gpt6_astra_test.go RawHistoryFolder

1package provider
2
3import (
4	"context"
5	"slices"
6	"testing"
7)
8
9func TestGPT6AstraCatalog(t *testing.T) {
10	for _, name := range []string{"openai", "openai-responses", "openai-codex", "github-copilot"} {
11		t.Run(name, func(t *testing.T) {
12			m, err := FindModel(name, "gpt-6-astra")
13			if err != nil {
14				t.Fatal(err)
15			}
16			wantContext := 272000
17			if name == "github-copilot" {
18				wantContext = 1050000
19			}
20			if m.API != APIResponses || m.ContextWindow != wantContext || m.MaxOutput != 128000 || !m.Reasoning || m.Speculative {
21				t.Fatalf("unexpected model capabilities: %+v", m)
22			}
23			if m.PriceInput != 10 || m.PriceOutput != 50 || m.PriceCacheRead != 1 || m.PriceCacheWrite != 12.5 {
24				t.Fatalf("unexpected standard prices: %+v", m)
25			}
26			if m.PriceTierInputTokens != 272000 || m.PriceInputAbove != 20 || m.PriceOutputAbove != 75 || m.PriceCacheReadAbove != 2 || m.PriceCacheWriteAbove != 25 {
27				t.Fatalf("unexpected long-context prices: %+v", m)
28			}
29			wantLevels := []string{"", "low", "medium", "high", "xhigh", "max"}
30			if got := AvailableReasoningLevels(m); !slices.Equal(got, wantLevels) {
31				t.Fatalf("reasoning levels = %q, want %q", got, wantLevels)
32			}
33		})
34	}
35}
36
37func TestGPT6AstraResponsesReasoning(t *testing.T) {
38	copilot := NewGithubCopilotClient("test-token").(*copilotClient).router
39	clients := map[string]*codexClient{
40		"openai":           NewOpenAIResponsesNamed("test-token", "", "openai").(*renamedClient).inner.(*codexClient),
41		"openai-responses": NewOpenAIResponsesNamed("test-token", "", "openai-responses").(*renamedClient).inner.(*codexClient),
42		"openai-codex":     NewOpenAICodex("test-token", "test-account", "").(*codexClient),
43		"github-copilot":   copilot.byAPI[APIResponses].(*codexClient),
44	}
45	for name, client := range clients {
46		t.Run(name, func(t *testing.T) {
47			for _, effort := range []string{"", "low", "medium", "high", "xhigh", "max"} {
48				wire, err := client.buildRequest(Request{Model: "gpt-6-astra", Reasoning: effort})
49				if err != nil {
50					t.Fatal(err)
51				}
52				if wire.Model != "gpt-6-astra" {
53					t.Fatalf("wire model = %q", wire.Model)
54				}
55				if effort == "" {
56					if wire.Reasoning != nil {
57						t.Fatalf("unexpected reasoning config: %+v", wire.Reasoning)
58					}
59				} else if wire.Reasoning == nil || wire.Reasoning.Effort != effort {
60					t.Fatalf("reasoning = %+v, want %q", wire.Reasoning, effort)
61				}
62			}
63		})
64	}
65}
66
67func TestGPT6AstraCopilotDispatch(t *testing.T) {
68	router := NewGithubCopilotClient("test-token").(*copilotClient).router
69	completions := &routeCaptureClient{name: "github-copilot"}
70	responses := &routeCaptureClient{name: "github-copilot"}
71	router.fallback = completions
72	router.byAPI[APIResponses] = responses
73
74	stream, err := router.Stream(context.Background(), Request{Model: "gpt-6-astra"})
75	if err != nil {
76		t.Fatal(err)
77	}
78	for range stream {
79	}
80	if !slices.Equal(responses.models, []string{"gpt-6-astra"}) || len(completions.models) != 0 {
81		t.Fatalf("Responses models = %v, Completions models = %v", responses.models, completions.models)
82	}
83}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 477

↑↓ moveenter openesc close