feedback

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package feedback stores human ratings on AI task outputs. Records are appended to .cloop/feedback.jsonl as an append-only JSONL log.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append(workDir string, rec Record) error

Append writes a single feedback record to the JSONL log, creating the file and parent directory as needed.

func AvgRating

func AvgRating(records []Record) (avg float64, count int)

AvgRating returns the average rating across the supplied records, and the count of records included. Returns 0, 0 when the slice is empty.

func Stars

func Stars(rating int) string

Stars returns a star-string representation of a 1-5 rating, e.g. "★★★☆☆".

Types

type Record

type Record struct {
	TaskID    int       `json:"task_id"`
	TaskTitle string    `json:"task_title"`
	Rating    int       `json:"rating"` // 1-5
	Comment   string    `json:"comment,omitempty"`
	Provider  string    `json:"provider,omitempty"`
	Model     string    `json:"model,omitempty"`
	Timestamp time.Time `json:"timestamp"`
}

Record is a single human-rating entry for a task output.

func List

func List(workDir string, taskID int) ([]Record, error)

List reads all feedback records from the JSONL log. When taskID > 0 only records matching that task ID are returned. Returns nil, nil when the file does not exist yet.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL