ai

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(g *echo.Group, src Sources)

Types

type Column

type Column struct {
	Key    string
	Header string
	Right  bool
	Format func(any) string
}

type Commit

type Commit struct {
	Hash    string `json:"hash"`
	Message string `json:"message"`
}

type Doc

type Doc struct {
	Title    string    `json:"title"`
	GroupID  string    `json:"group_id,omitempty"`
	Commit   *Commit   `json:"commit,omitempty"`
	Score    *int64    `json:"score,omitempty"`
	Notes    []string  `json:"notes,omitempty"`
	Links    []Link    `json:"links,omitempty"`
	Sections []Section `json:"sections"`
}

Doc is one AI-facing response. It renders to Markdown by default and to JSON when requested; both carry the same information.

func (*Doc) JSON

func (d *Doc) JSON() ([]byte, error)

func (*Doc) Markdown

func (d *Doc) Markdown() string

type Field

type Field struct {
	Key   string
	Value any
}

Field is one entry of an ordered key/value list.

type Fields

type Fields []Field

Fields keeps insertion order in both Markdown and JSON.

func (Fields) MarshalJSON

func (f Fields) MarshalJSON() ([]byte, error)
type Link struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

type Omitted

type Omitted struct {
	Rows  int      `json:"rows"`
	Share *float64 `json:"share,omitempty"`
}

Omitted reports rows cut by ?limit=. Share is the fraction of the table's total they carried, when that total is meaningful.

type Section

type Section struct {
	Title   string   `json:"title"`
	Label   string   `json:"label,omitempty"`
	Status  string   `json:"status,omitempty"`
	Message string   `json:"message,omitempty"`
	Totals  Fields   `json:"totals,omitempty"`
	Tables  []*Table `json:"tables,omitempty"`
}

type Sources

type Sources struct {
	PProf   *collect.Collector
	HTTPLog *collect.Collector
	SlowLog *collect.Collector
	Memo    *collect.Collector
}

Sources are the collectors whose snapshots the AI views read.

type Table

type Table struct {
	Title   string           `json:"title"`
	Note    string           `json:"note,omitempty"`
	Columns []Column         `json:"-"`
	Rows    []map[string]any `json:"rows"`
	Omitted *Omitted         `json:"omitted,omitempty"`
}

Jump to

Keyboard shortcuts

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