]> git.giacomolli.uk - onechat/blobdiff - turn_test.go
Order functions by their first use
[onechat] / turn_test.go
index 5341de5ba3b261d036af66933146e76278d36286..27151a9af9d6bafb1191c5da589f6c8cfb2a43ea 100644 (file)
@@ -370,6 +370,13 @@ func (r *TurnEventRecorder) Last(kind string) string {
        return r.LastEvent(kind).Text
 }
 
+func (r *TurnEventRecorder) Add(event Event) {
+       r.mutex.Lock()
+       defer r.mutex.Unlock()
+
+       r.events = append(r.events, event)
+}
+
 // LastEvent returns the last event of kind.
 func (r *TurnEventRecorder) LastEvent(kind string) Event {
        r.mutex.Lock()
@@ -384,11 +391,13 @@ func (r *TurnEventRecorder) LastEvent(kind string) Event {
        return Event{}
 }
 
-func (r *TurnEventRecorder) Add(event Event) {
-       r.mutex.Lock()
-       defer r.mutex.Unlock()
-
-       r.events = append(r.events, event)
+func modelReasoningItem(id, encrypted string) map[string]any {
+       return map[string]any{
+               "type":              "reasoning",
+               "id":                id,
+               "encrypted_content": encrypted,
+               "summary":           []any{},
+       }
 }
 
 // turnInputTexts returns the text of each user message of the input of call.
@@ -424,12 +433,3 @@ func turnInputTexts(t *testing.T, call ModelFakeCall) []string {
 
        return texts
 }
-
-func modelReasoningItem(id, encrypted string) map[string]any {
-       return map[string]any{
-               "type":              "reasoning",
-               "id":                id,
-               "encrypted_content": encrypted,
-               "summary":           []any{},
-       }
-}