Documentation
¶
Index ¶
- Constants
- func BuildPromptWithContext(memories []string, calendarEvents []string, currentTime string) string
- type AIResponse
- type Action
- type CalendarEvent
- type CalendarProvider
- type OllamaManager
- type ResponsePayload
- type Service
- func (s *Service) GenerateEmbedding(ctx context.Context, text string) ([]float32, error)
- func (s *Service) ProcessCommand(text string) (*ResponsePayload, []Action, error)
- func (s *Service) ProcessCommandStream(text string, onChunk StreamCallback) (*ResponsePayload, []Action, error)
- func (s *Service) ProcessCommandWithHistory(text string, history []openai.ChatCompletionMessage) (*ResponsePayload, []Action, error)
- func (s *Service) SetCalendar(cal CalendarProvider)
- type StreamCallback
Constants ¶
const SystemPrompt = `` /* 7529-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AIResponse ¶
type AIResponse struct {
Actions []Action `json:"actions"`
Response struct {
Text string `json:"text"`
Emotion string `json:"emotion"`
} `json:"response"`
}
AIResponse represents the structured response from the AI
type CalendarEvent ¶
CalendarEvent represents a calendar event for AI context
type CalendarProvider ¶
type CalendarProvider interface {
ListEvents(ctx context.Context) ([]*CalendarEvent, error)
IsInitialized() bool
}
CalendarProvider interface for fetching calendar events
type OllamaManager ¶
type OllamaManager struct {
// contains filtered or unexported fields
}
OllamaManager manages the lifecycle of a bundled Ollama binary.
func NewOllamaManager ¶
func NewOllamaManager(appDir string) *OllamaManager
NewOllamaManager creates a new Ollama manager. appDir should be the application data directory.
func (*OllamaManager) EnsureModel ¶
func (m *OllamaManager) EnsureModel(model string) error
EnsureModel pulls a model if it's not already available.
func (*OllamaManager) GetURL ¶
func (m *OllamaManager) GetURL() string
GetURL returns the Ollama API URL.
func (*OllamaManager) IsRunning ¶
func (m *OllamaManager) IsRunning() bool
IsRunning returns whether Ollama is currently running.
type ResponsePayload ¶
ResponsePayload for returning to WebSocket
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles AI interactions via requesty.ai
func NewService ¶
NewService creates a new AI service
func (*Service) GenerateEmbedding ¶
GenerateEmbedding creates a vector embedding for the given text using local Ollama. Returns a 768-dimensional vector suitable for pgvector storage.
func (*Service) ProcessCommand ¶
func (s *Service) ProcessCommand(text string) (*ResponsePayload, []Action, error)
ProcessCommand sends a command to the AI and returns the response
func (*Service) ProcessCommandStream ¶
func (s *Service) ProcessCommandStream(text string, onChunk StreamCallback) (*ResponsePayload, []Action, error)
ProcessCommandStream sends a command and streams the response
func (*Service) ProcessCommandWithHistory ¶
func (s *Service) ProcessCommandWithHistory(text string, history []openai.ChatCompletionMessage) (*ResponsePayload, []Action, error)
ProcessCommandWithHistory processes with conversation history
func (*Service) SetCalendar ¶
func (s *Service) SetCalendar(cal CalendarProvider)
SetCalendar sets the calendar provider (called after calendar service is created)
type StreamCallback ¶
StreamCallback is called for each chunk of streamed response