app

package
v0.0.0-...-aa9b7ea Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessTextCmd

func ProcessTextCmd(app *App, input string) tea.Cmd

ProcessTextCmd returns a command to process text input

func ProcessVoiceCmd

func ProcessVoiceCmd(app *App, audioData interface{}) tea.Cmd

ProcessVoiceCmd returns a command to process voice input

func StartRecordingCmd

func StartRecordingCmd(app *App) tea.Cmd

StartRecordingCmd returns a command to start recording

func StopRecordingCmd

func StopRecordingCmd(app *App) tea.Cmd

StopRecordingCmd returns a command to stop recording

func ValidateAPIKeyCmd

func ValidateAPIKeyCmd(app *App, apiKey string) tea.Cmd

Types

type APIKeyValidationDoneMsg

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

APIKeyValidationDoneMsg indicates result of API key validation

type App

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

App represents the main application

func NewApp

func NewApp() (*App, error)

NewApp creates a new application instance

func (*App) Cleanup

func (a *App) Cleanup() error

Cleanup performs cleanup operations

func (*App) GenerateExplanationSample

func (a *App) GenerateExplanationSample() (string, error)

GenerateExplanationSample creates a sample explanation using the current knowledge level.

func (*App) GenerateVoiceResponse

func (a *App) GenerateVoiceResponse(text string) (string, error)

GenerateVoiceResponse converts text response to speech

func (*App) GetState

func (a *App) GetState() *models.AppState

GetState returns the current application state

func (*App) HealthCheck

func (a *App) HealthCheck() error

func (*App) PlayAudio

func (a *App) PlayAudio(filename string) error

PlayAudio plays an audio file

func (*App) PlayAudioSample

func (a *App) PlayAudioSample() error

PlayAudioSample generates and plays a sample TTS audio using the current TTS settings.

func (*App) ProcessTextInput

func (a *App) ProcessTextInput(input string) (string, error)

ProcessTextInput processes text input and returns AI response

func (*App) ProcessVoiceInput

func (a *App) ProcessVoiceInput(audioData *models.AudioData) (string, error)

ProcessVoiceInput processes voice input and returns appropriate response

func (*App) Run

func (a *App) Run() error

Run starts the application

func (*App) SetKnowledgeLevel

func (a *App) SetKnowledgeLevel(level models.KnowledgeLevel)

SetKnowledgeLevel changes the knowledge level

func (*App) SetMode

func (a *App) SetMode(mode models.CommunicationMode)

SetMode changes the communication mode

func (*App) StartRecording

func (a *App) StartRecording() error

StartRecording starts audio recording

func (*App) StopAudio

func (a *App) StopAudio() error

StopAudio stops current audio playback

func (*App) StopRecording

func (a *App) StopRecording() (*models.AudioData, error)

StopRecording stops audio recording and returns the recorded data

type AudioPlaybackStartedMsg

type AudioPlaybackStartedMsg struct{}

AudioPlaybackStartedMsg indicates audio playback has started

type AudioPlaybackStoppedMsg

type AudioPlaybackStoppedMsg struct {
	Error error
}

AudioPlaybackStoppedMsg indicates audio playback has stopped

type Model

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

Model represents the Bubbletea model

func NewModel

func NewModel(app *App) *Model

NewModel creates a new Bubbletea model

func (*Model) Init

func (m *Model) Init() tea.Cmd

Init initializes the model

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages and updates the model

func (*Model) View

func (m *Model) View() string

View renders the UI

type ProcessingCompletedMsg

type ProcessingCompletedMsg struct {
	Response string
	Error    error
}

ProcessingCompletedMsg indicates AI processing has completed

type ProcessingStartedMsg

type ProcessingStartedMsg struct{}

ProcessingStartedMsg indicates AI processing has started

type RecordingStartedMsg

type RecordingStartedMsg struct{}

RecordingStartedMsg indicates recording has started

type RecordingStoppedMsg

type RecordingStoppedMsg struct {
	AudioData interface{} // Will contain *models.AudioData
	Error     error
}

RecordingStoppedMsg indicates recording has stopped

type UIModel

type UIModel struct {
	// Current UI state
	CurrentView string

	// Input handling
	TextInput string
	CursorPos int

	// Selection states
	SelectedMode  int
	SelectedLevel int

	// Status and messages
	StatusMessage string
	ErrorMessage  string
	LastResponse  string

	// Recording state
	IsRecording   bool
	RecordingTime time.Duration

	// Processing state
	IsProcessing bool

	// Display dimensions
	Width  int
	Height int

	// Conversation history for display
	ConversationHistory []models.ConversationEntry
}

UIModel represents the UI state and data

func NewUIModel

func NewUIModel() *UIModel

NewUIModel creates a new UI model with default values

func (*UIModel) ClearError

func (m *UIModel) ClearError()

ClearError clears the error message

func (*UIModel) ClearStatus

func (m *UIModel) ClearStatus()

ClearStatus clears the status message

func (*UIModel) Reset

func (m *UIModel) Reset()

Reset clears the UI model state

func (*UIModel) SetError

func (m *UIModel) SetError(err error)

SetError sets an error message

func (*UIModel) SetStatus

func (m *UIModel) SetStatus(message string)

SetStatus sets a status message

type UIState

type UIState int

UIState represents the current UI state

const (
	MainMenu UIState = iota
	ModeSelection
	KnowledgeLevelSelection
	Conversation
	Recording
	Processing
	Settings        // NEW: Settings menu state
	SettingsEdit    // NEW: Settings edit dialog state
	APIKeyInput     // NEW: API Key input dialog state
	APIKeyVerifying // NEW: API Key verifying state
)

Jump to

Keyboard shortcuts

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