sessions

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteToolCallRequest added in v0.8.0

func ExecuteToolCallRequest(tc util.ToolCall) tea.Cmd

func ExportSessionToMarkdown added in v0.8.1

func ExportSessionToMarkdown(session Session, exportDir string) error

func FinalizeResponse added in v0.8.0

func FinalizeResponse(response util.LocalStoreMessage, isToolCall bool) tea.Cmd

func SendFinalProcessMessage

func SendFinalProcessMessage(msg string) tea.Cmd

func SendRefreshSessionsListMsg

func SendRefreshSessionsListMsg() tea.Cmd

func SendResponseChunkProcessedMsg

func SendResponseChunkProcessedMsg(msg string, previousMsgs []util.LocalStoreMessage, isComplete bool) tea.Cmd

func SendSaveQuickChatMsg

func SendSaveQuickChatMsg() tea.Cmd

func SendUpdateCurrentSessionMsg

func SendUpdateCurrentSessionMsg(session Session) tea.Cmd

Types

type FinalProcessMessage

type FinalProcessMessage struct {
	FinalMessage string
}

Final Message is the concatenated string from the chat gpt stream

type InferenceFinalized added in v0.8.0

type InferenceFinalized struct {
	Response   util.LocalStoreMessage
	IsToolCall bool
}

type LoadDataFromDB

type LoadDataFromDB struct {
	Session                Session
	AllSessions            []Session
	CurrentActiveSessionID int
}

type MessageProcessor added in v0.7.7

type MessageProcessor struct {
	CurrentState          util.ProcessingState
	Settings              util.Settings
	CurrentResponseBuffer string
	ResponseDataChunks    []util.ProcessApiCompletionResponse
}

func NewMessageProcessor added in v0.7.7

func NewMessageProcessor(
	chunks []util.ProcessApiCompletionResponse,
	currentResponse string,
	processingState util.ProcessingState,
	settings util.Settings,
) MessageProcessor

func (MessageProcessor) Process added in v0.7.7

type Orchestrator

type Orchestrator struct {
	InferenceClient           util.LlmClient
	Settings                  util.Settings
	CurrentSessionID          int
	CurrentSessionName        string
	CurrentSessionIsTemporary bool
	ArrayOfProcessResult      []util.ProcessApiCompletionResponse
	ArrayOfMessages           []util.LocalStoreMessage
	CurrentAnswer             string
	ResponseBuffer            string
	ResponseProcessingState   util.ProcessingState
	AllSessions               []Session
	ProcessingMode            string
	// contains filtered or unexported fields
}

func NewOrchestrator

func NewOrchestrator(db *sql.DB, ctx context.Context) Orchestrator

func (*Orchestrator) Cancel added in v0.8.0

func (m *Orchestrator) Cancel()

func (*Orchestrator) FinalizeResponseOnCancel added in v0.8.0

func (m *Orchestrator) FinalizeResponseOnCancel() tea.Cmd

func (*Orchestrator) GetCompletion

func (m *Orchestrator) GetCompletion(
	ctx context.Context,
	resp chan util.ProcessApiCompletionResponse,
) tea.Cmd

func (Orchestrator) GetCurrentSessionId added in v0.8.0

func (m Orchestrator) GetCurrentSessionId() int

func (Orchestrator) GetLatestBotMessage

func (m Orchestrator) GetLatestBotMessage() (string, error)

func (Orchestrator) GetMessagesAsString

func (m Orchestrator) GetMessagesAsString() string

func (Orchestrator) Init

func (m Orchestrator) Init() tea.Cmd

func (Orchestrator) IsIdle added in v0.7.7

func (m Orchestrator) IsIdle() bool

func (Orchestrator) IsProcessing added in v0.7.7

func (m Orchestrator) IsProcessing() bool

func (*Orchestrator) ResumeCompletion added in v0.8.0

func (m *Orchestrator) ResumeCompletion(
	ctx context.Context,
	resp chan util.ProcessApiCompletionResponse,
) tea.Cmd

func (Orchestrator) Update

func (m Orchestrator) Update(msg tea.Msg) (Orchestrator, tea.Cmd)

type ProcessingResult added in v0.7.7

type ProcessingResult struct {
	IsSkipped                 bool
	IsCancelled               bool
	HasError                  bool
	PromptTokens              int
	CompletionTokens          int
	CurrentResponse           string
	CurrentResponseDataChunks []util.ProcessApiCompletionResponse
	ToolCalls                 []util.ToolCall
	JSONResponse              util.LocalStoreMessage
	State                     util.ProcessingState
}

type RefreshSessionsList

type RefreshSessionsList struct{}

type ResponseChunkProcessed

type ResponseChunkProcessed struct {
	PreviousMsgArray []util.LocalStoreMessage
	ChunkMessage     string
	IsComplete       bool
}

type SaveQuickChat

type SaveQuickChat struct{}

type Session

type Session struct {
	ID               int
	Messages         []util.LocalStoreMessage
	CreatedAt        string
	SessionName      string
	PromptTokens     int
	CompletionTokens int
	IsTemporary      bool
}

type SessionService

type SessionService struct {
	DB *sql.DB
}

func NewSessionService

func NewSessionService(db *sql.DB) *SessionService

func (*SessionService) AddSessionTokensStats added in v0.8.1

func (ss *SessionService) AddSessionTokensStats(id int, promptTokens, completionTokens int) error

func (*SessionService) DeleteSession

func (ss *SessionService) DeleteSession(id int) error

func (*SessionService) GetAllSessions

func (ss *SessionService) GetAllSessions() ([]Session, error)

get me all the sessions

func (*SessionService) GetMostRecessionSessionOrCreateOne

func (ss *SessionService) GetMostRecessionSessionOrCreateOne() (Session, error)

func (*SessionService) GetSession

func (ss *SessionService) GetSession(id int) (Session, error)

func (*SessionService) InsertNewSession

func (ss *SessionService) InsertNewSession(
	name string,
	messages []util.LocalStoreMessage,
	isTemporary bool,
) (Session, error)

func (*SessionService) SaveQuickChat

func (ss *SessionService) SaveQuickChat(id int) error

func (*SessionService) SweepTemporarySessions

func (ss *SessionService) SweepTemporarySessions() error

func (*SessionService) UpdateSessionMessages

func (ss *SessionService) UpdateSessionMessages(id int, messages []util.LocalStoreMessage) error

func (*SessionService) UpdateSessionName

func (ss *SessionService) UpdateSessionName(id int, name string) error

type ToolCallComplete added in v0.8.0

type ToolCallComplete struct {
	Id        string
	IsSuccess bool
	Name      string
	Result    string
}

type ToolCallRequest added in v0.8.0

type ToolCallRequest struct {
	ToolCall util.ToolCall
}

type UpdateCurrentSession

type UpdateCurrentSession struct {
	Session Session
}

Jump to

Keyboard shortcuts

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