X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/522d7fd117285e4e4ce3ea5ec9b5a1722521b681..80e348724041a694002fc38f57e8868b9b9a2be9:/model_fake_helper_test.go diff --git a/model_fake_helper_test.go b/model_fake_helper_test.go index 9873fb6..f9d1451 100644 --- a/model_fake_helper_test.go +++ b/model_fake_helper_test.go @@ -34,6 +34,21 @@ type ModelFake struct { reply func(http.ResponseWriter, ModelFakeCall) } +func newModelFake(t *testing.T) *ModelFake { + t.Helper() + + f := &ModelFake{ + reply: func(w http.ResponseWriter, _ ModelFakeCall) { + modelWriteEvents(w, modelCompletedEvent([]any{modelMessageItem("a line")}, 100, 0, 5)) + }, + } + + f.Server = httptest.NewServer(http.HandlerFunc(f.serve)) + t.Cleanup(f.Close) + + return f +} + // Call returns call number n. func (f *ModelFake) Call(n int) ModelFakeCall { f.mutex.Lock() @@ -80,21 +95,6 @@ func (f *ModelFake) serve(w http.ResponseWriter, r *http.Request) { reply(w, call) } -func newModelFake(t *testing.T) *ModelFake { - t.Helper() - - f := &ModelFake{ - reply: func(w http.ResponseWriter, _ ModelFakeCall) { - modelWriteEvents(w, modelCompletedEvent([]any{modelMessageItem("a line")}, 100, 0, 5)) - }, - } - - f.Server = httptest.NewServer(http.HandlerFunc(f.serve)) - t.Cleanup(f.Close) - - return f -} - func modelTestRequest() ModelRequest { return ModelRequest{ Model: "gpt-test", @@ -174,15 +174,6 @@ func modelReadUsage(t *testing.T, path string) []ModelUsageRecord { return records } -func modelReasoningItem(id, encrypted string) map[string]any { - return map[string]any{ - "type": "reasoning", - "id": id, - "encrypted_content": encrypted, - "summary": []any{}, - } -} - func modelFunctionCallItem(id, callID, name, arguments string) map[string]any { return map[string]any{ "type": "function_call",