Documentation
¶
Overview ¶
Package history reads the web chat's sessions from a workspace's session store: the list of sessions and each one's transcript, as the launcher's /api/sessions and the gateway's /web/sessions serve them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("session not found")
ErrNotFound reports that no web chat session has the asked id, or that it has nothing to show.
Functions ¶
func FileBase ¶
FileBase returns the name a session's files have in the sessions directory, before their extension.
func ServeDetail ¶
func ServeDetail(w http.ResponseWriter, reader Reader, id string)
ServeDetail answers a request for the transcript of the session id: 404 when it has none.
func ServeList ¶
func ServeList(w http.ResponseWriter, r *http.Request, reader Reader)
ServeList answers a request for one page of sessions: offset (0 by default) and limit (20 by default) come from the query.
func SessionsDir ¶
SessionsDir returns the sessions directory of workspace: its "sessions" folder, or that of the default workspace when workspace is empty.
Types ¶
type Attachment ¶
type Detail ¶
type Detail struct {
ID string `json:"id"`
Messages []Message `json:"messages"`
Summary string `json:"summary"`
Created string `json:"created"`
Updated string `json:"updated"`
}
Detail is a session's transcript.
type Message ¶
type Message struct {
Role string `json:"role"`
Content string `json:"content"`
Kind string `json:"kind,omitempty"`
ModelName string `json:"model_name,omitempty"`
RequestedSelection string `json:"requested_selection,omitempty"`
ServedTarget string `json:"served_target,omitempty"`
ServedIdentity string `json:"served_identity,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
Media []string `json:"media,omitempty"`
Attachments []Attachment `json:"attachments,omitempty"`
ToolCalls []utils.VisibleToolCall `json:"tool_calls,omitempty"`
}
type Reader ¶
type Reader struct {
// Dir is the workspace's sessions directory (see SessionsDir).
Dir string
// MaxArgsLength cuts the tool call arguments a transcript shows; 0 uses
// the default.
MaxArgsLength int
}
Reader reads the web chat's sessions in a sessions directory.
func (Reader) Delete ¶
Delete removes the files of the session id. It returns ErrNotFound when there were none.