v0.2.88 24f1547

azure_openai_test.go RawHistoryFolder

1package provider
2
3import (
4	"context"
5	"encoding/json"
6	"io"
7	"net/http"
8	"strings"
9	"testing"
10)
11
12func TestAzureOpenAIResponsesRequestShape(t *testing.T) {
13	t.Setenv("AZURE_OPENAI_API_VERSION", "v1")
14	t.Setenv("AZURE_OPENAI_DEPLOYMENT_NAME_MAP", "gpt-5.6-sol=sol-preview")
15
16	named := NewAzureOpenAIResponses("azure-key", "https://example.openai.azure.com").(*renamedClient)
17	c := named.inner.(*codexClient)
18	transport := c.http.Transport.(*azureResponsesTransport)
19	var gotReq *http.Request
20	var gotBody codexRequest
21	transport.inner = roundTripFunc(func(r *http.Request) (*http.Response, error) {
22		gotReq = r
23		if err := json.NewDecoder(r.Body).Decode(&gotBody); err != nil {
24			t.Fatal(err)
25		}
26		return &http.Response{
27			StatusCode: http.StatusOK,
28			Header:     http.Header{"Content-Type": []string{"text/event-stream"}},
29			Body:       io.NopCloser(strings.NewReader("")),
30		}, nil
31	})
32
33	events, err := c.Stream(context.Background(), Request{
34		Model:     "gpt-5.6-sol",
35		Reasoning: "max",
36		Messages:  []Message{{Role: RoleUser, Content: []Content{TextBlock{Text: "hi"}}}},
37	})
38	if err != nil {
39		t.Fatal(err)
40	}
41	var startProvider string
42	for event := range events {
43		if start, ok := event.(EventStart); ok {
44			startProvider = start.Provider
45		}
46	}
47
48	if startProvider != "azure-openai-responses" {
49		t.Fatalf("start provider = %q", startProvider)
50	}
51	if gotReq == nil {
52		t.Fatal("request was not sent")
53	}
54	if gotReq.URL.String() != "https://example.openai.azure.com/openai/v1/responses?api-version=v1" {
55		t.Fatalf("url = %q", gotReq.URL.String())
56	}
57	if gotReq.Header.Get("api-key") != "azure-key" || gotReq.Header.Get("authorization") != "" {
58		t.Fatalf("headers = %#v", gotReq.Header)
59	}
60	if gotBody.Model != "sol-preview" {
61		t.Fatalf("model = %q", gotBody.Model)
62	}
63	if gotBody.Reasoning == nil || gotBody.Reasoning.Effort != "max" {
64		t.Fatalf("reasoning = %+v", gotBody.Reasoning)
65	}
66	if gotBody.PromptCacheKey != "" {
67		t.Fatalf("prompt_cache_key = %q", gotBody.PromptCacheKey)
68	}
69}

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 476

↑↓ moveenter openesc close