]> git.giacomolli.uk - onechat/blobdiff - model_fake_helper_test.go
Order daemon and storage declarations
[onechat] / model_fake_helper_test.go
index 08c4732a2c9bd80147815de738b469b1b2eb165a..00fa8083ac5457290dee86c472980e209be12330 100644 (file)
@@ -54,6 +54,7 @@ func (f *ModelFake) serve(w http.ResponseWriter, r *http.Request) {
        raw, err := io.ReadAll(r.Body)
        if err != nil {
                http.Error(w, err.Error(), http.StatusBadRequest)
+
                return
        }
 
@@ -65,10 +66,12 @@ func (f *ModelFake) serve(w http.ResponseWriter, r *http.Request) {
        err = json.Unmarshal(raw, &call.body)
        if err != nil {
                http.Error(w, err.Error(), http.StatusBadRequest)
+
                return
        }
 
        f.mutex.Lock()
+
        call.number = len(f.calls)
        f.calls = append(f.calls, call)
        reply := f.reply
@@ -103,6 +106,7 @@ func modelTestRequest() ModelRequest {
 // modelWriteEvents writes events as a server-sent event stream.
 func modelWriteEvents(w http.ResponseWriter, events ...any) {
        w.Header().Set("Content-Type", "text/event-stream")
+
        for _, event := range events {
                data, err := json.Marshal(event)
                if err != nil {
@@ -155,10 +159,13 @@ func modelReadUsage(t *testing.T, path string) []ModelUsageRecord {
        }()
 
        var records []ModelUsageRecord
+
        scanner := bufio.NewScanner(file)
        for scanner.Scan() {
                var record ModelUsageRecord
+
                require.NoError(t, json.Unmarshal(scanner.Bytes(), &record))
+
                records = append(records, record)
        }
 
@@ -167,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",