Documentation
¶
Overview ¶
Package convodag implements a DAG-based conversation store using SQLite. Instead of linear chat history, conversations are stored as a directed acyclic graph so users can fork from any point and explore alternatives.
Index ¶
- type DAG
- func (d *DAG) Append(parentID string, role string, content string) (*Node, error)
- func (d *DAG) Branches(nodeID string) ([]*Node, error)
- func (d *DAG) Close() error
- func (d *DAG) Fork(nodeID string) (*Node, error)
- func (d *DAG) Head() (*Node, error)
- func (d *DAG) History(nodeID string) ([]*Node, error)
- func (d *DAG) Prune(nodeID string) error
- func (d *DAG) SetHead(nodeID string) error
- type Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DAG ¶
type DAG struct {
// contains filtered or unexported fields
}
DAG is a conversation stored as a directed acyclic graph backed by SQLite.
func (*DAG) Append ¶
Append adds a new node as a child of the given parent and advances the head pointer. Pass an empty parentID to create a root node.
func (*DAG) Fork ¶
Fork creates a new branch from the given node. It copies the fork point node as a marker and returns it. The returned node can be used as a parent for new messages on the alternative branch. Fork also moves the head pointer to this new fork point.
func (*DAG) Head ¶
Head returns the most recent node in the current branch, i.e. the node the session's head pointer points to.
func (*DAG) History ¶
History returns the linear path from root to the given node by walking parent pointers. The returned slice is ordered from root to the given node.