Documentation
¶
Index ¶
- func CheckFTS() bool
- func ParseQuery(input string) string
- type ChatMessage
- type Manager
- func (m *Manager) Close()
- func (m *Manager) EnsureMigrated()
- func (m *Manager) GetSessionMessages(uuid string) ([]ChatMessage, error)
- func (m *Manager) ListRecentSessions(limit int) ([]SessionSummary, error)
- func (m *Manager) ResolveSessionUUID(partial string) (string, error)
- func (m *Manager) SaveMessage(data MessageEvent) error
- func (m *Manager) SaveSessionStart(data SessionStartEvent) error
- func (m *Manager) SaveShellEvent(data ShellEvent) error
- func (m *Manager) Search(query string) ([]SearchResult, error)
- func (m *Manager) UpdateSessionModel(uuid, model string) error
- type MessageEvent
- type SearchResult
- type SessionStartEvent
- type SessionSummary
- type ShellEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseQuery ¶
ParseQuery converts user input into FTS5 syntax Supports: "phrase search", user:term, ai:term
Types ¶
type ChatMessage ¶
type ChatMessage struct {
UUID string `json:"uuid"`
Role string `json:"role"`
Content string `json:"content"`
Images []string `json:"images,omitempty"`
}
ChatMessage matches the internal Message struct
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles dual-write history (JSONL + SQLite)
func (*Manager) EnsureMigrated ¶
func (m *Manager) EnsureMigrated()
EnsureMigrated checks if DB is empty and if so, imports from JSONL
func (*Manager) GetSessionMessages ¶
func (m *Manager) GetSessionMessages(uuid string) ([]ChatMessage, error)
func (*Manager) ListRecentSessions ¶
func (m *Manager) ListRecentSessions(limit int) ([]SessionSummary, error)
func (*Manager) ResolveSessionUUID ¶
ResolveSessionUUID finds the full UUID given a prefix or full string
func (*Manager) SaveMessage ¶
func (m *Manager) SaveMessage(data MessageEvent) error
func (*Manager) SaveSessionStart ¶
func (m *Manager) SaveSessionStart(data SessionStartEvent) error
func (*Manager) SaveShellEvent ¶
func (m *Manager) SaveShellEvent(data ShellEvent) error
func (*Manager) UpdateSessionModel ¶ added in v0.6.0
UpdateSessionModel updates the model name for an existing session in the database
type MessageEvent ¶
type MessageEvent struct {
ID string `json:"uuid"`
SID string `json:"sid"`
TS int64 `json:"ts"`
Message ChatMessage `json:"msg"`
}
MessageEvent represents the JSON structure logged for each message
type SearchResult ¶
type SearchResult struct {
SessionUUID string
Timestamp time.Time
Role string
Content string
Preview string
}
SearchResult represents a hit from the FTS index
type SessionStartEvent ¶
type SessionStartEvent struct {
SID string `json:"sid"`
TS int64 `json:"ts"`
UserMsg string `json:"user_msg"`
SystemPrompt string `json:"system_prompt"`
Model string `json:"model"`
Seed int `json:"seed"`
Temperature *float64 `json:"temperature,omitempty"`
APIBase string `json:"api_base"`
MaxTokens int `json:"max_tokens"`
JSONMode bool `json:"json_mode"`
StopSequences interface{} `json:"stop_sequences"`
ExtraParams string `json:"extra_params"`
JsonSchema string `json:"json_schema"`
ReasoningEffort string `json:"reasoning_effort,omitempty"`
ReasoningMaxTokens int `json:"reasoning_max_tokens,omitempty"`
ReasoningExclude bool `json:"reasoning_exclude,omitempty"`
}
SessionStartEvent represents the JSON structure logged when a chat starts
type SessionSummary ¶
SessionSummary represents a resume-able session
type ShellEvent ¶
type ShellEvent struct {
Type string `json:"type"`
Query string `json:"query"`
History string `json:"history_snippet"`
}
ShellEvent represents session interception events