actions

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionHandler

type ActionHandler func(ctx context.Context, data map[string]interface{}) *ActionResult

ActionHandler is a function that handles a specific action

type ActionResult

type ActionResult struct {
	ActionType string      `json:"action_type"`
	Success    bool        `json:"success"`
	Data       interface{} `json:"data,omitempty"`
	Error      string      `json:"error,omitempty"`
}

ActionResult represents the result of executing an action

type ActionType

type ActionType string

ActionType represents the type of action

const (
	ActionSaveToCalendar   ActionType = "SAVE_TO_CALENDAR"
	ActionEditCalendar     ActionType = "EDIT_CALENDAR_EVENT"
	ActionDeleteCalendar   ActionType = "DELETE_CALENDAR_EVENT"
	ActionSaveMemory       ActionType = "SAVE_MEMORY"
	ActionGetWeather       ActionType = "GET_WEATHER"
	ActionSearchPokemon    ActionType = "SEARCH_POKEMON"
	ActionStopListening    ActionType = "STOP_LISTENING"
	ActionNoAction         ActionType = "NO_ACTION"
	ActionCreateReminder   ActionType = "CREATE_REMINDER"
	ActionEditReminder     ActionType = "EDIT_REMINDER"
	ActionDeleteReminder   ActionType = "DELETE_REMINDER"
	ActionListReminders    ActionType = "LIST_REMINDERS"
	ActionCompleteReminder ActionType = "COMPLETE_REMINDER"
	ActionStartGame        ActionType = "START_GAME"
	ActionGameMove         ActionType = "GAME_MOVE"
)

type GameState

type GameState struct {
	GameType      string `json:"game_type"`
	CurrentNumber int    `json:"current_number"`
	TargetNumber  int    `json:"target_number"`
	Streak        int    `json:"streak"`
	BestStreak    int    `json:"best_streak"`
	IsCorrect     *bool  `json:"is_correct,omitempty"`
	GameOver      bool   `json:"game_over"`
	Message       string `json:"message,omitempty"`
}

GameState represents the state of a higher/lower game

type PokemonResponse

type PokemonResponse struct {
	Name      string         `json:"name"`
	ID        int            `json:"id"`
	Types     []string       `json:"types"`
	Height    float64        `json:"height_m"`
	Weight    float64        `json:"weight_kg"`
	Sprite    string         `json:"sprite"`
	Abilities []string       `json:"abilities"`
	Stats     map[string]int `json:"stats"`
}

PokemonResponse represents Pokemon data from PokeAPI

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry manages action handlers

func NewRegistry

func NewRegistry(memoryStore *memory.Store, calendarService *calendar.Service, reminderStore *reminder.Store) *Registry

NewRegistry creates a new action registry

func (*Registry) Execute

func (r *Registry) Execute(action ai.Action) *ActionResult

Execute runs an action and returns the result

func (*Registry) Register

func (r *Registry) Register(actionType ActionType, handler ActionHandler)

Register adds an action handler

type WeatherResponse

type WeatherResponse struct {
	Location    string  `json:"location"`
	Temperature float64 `json:"temperature"`
	FeelsLike   float64 `json:"feels_like"`
	Humidity    int     `json:"humidity"`
	WindSpeed   float64 `json:"wind_speed"`
	Description string  `json:"description"`
	Unit        string  `json:"unit"`
}

WeatherResponse represents weather data from Open-Meteo API

Jump to

Keyboard shortcuts

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