feat(session): add AttemptsFrom converter for exec.AttemptRecord
This commit is contained in:
26
internal/session/attempts.go
Normal file
26
internal/session/attempts.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// internal/session/attempts.go
|
||||
package session
|
||||
|
||||
import iexec "github.com/mathiasbq/supervisor/internal/exec"
|
||||
|
||||
// AttemptsFrom converts exec.AttemptRecord slice to session.Attempt slice
|
||||
// for writing into a session JSONL entry.
|
||||
func AttemptsFrom(records []iexec.AttemptRecord) []Attempt {
|
||||
if len(records) == 0 {
|
||||
return nil
|
||||
}
|
||||
out := make([]Attempt, len(records))
|
||||
for i, r := range records {
|
||||
out[i] = Attempt{
|
||||
Attempt: i + 1,
|
||||
Model: r.Model,
|
||||
Tier: r.Tier,
|
||||
DurationMs: r.DurationMs,
|
||||
WarmStart: r.WarmStart,
|
||||
Verdict: r.Verdict,
|
||||
Feedback: r.Feedback,
|
||||
Verified: r.Verdict == "accept",
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
Reference in New Issue
Block a user