Documentation ¶
Index ¶
- Constants
- func ConstructListItems(sessions []Session, currentSessionId int) []list.Item
- func RenderBotMessage(msg string, width int) string
- func RenderUserMessage(msg string, width int) string
- func SendFinalProcessMessage(msg string) tea.Cmd
- func SendUpdateCurrentSessionMsg() tea.Cmd
- type Choice
- type CompletionChunk
- type CompletionResponse
- type FinalProcessMessage
- type LoadDataFromDB
- type MessageToSend
- type Model
- func (m *Model) CallChatGpt(resultChan chan ProcessResult) tea.Cmd
- func (m Model) GetLatestBotMessage() (string, error)
- func (m Model) GetMessagesAsPrettyString() string
- func (m Model) GetMessagesAsString() string
- func (m Model) Init() tea.Cmd
- func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)
- func (m Model) View() string
- type ProcessResult
- type Session
- type SessionService
- func (ss *SessionService) DeleteSession(id int) error
- func (ss *SessionService) GetAllSessions() ([]Session, error)
- func (ss *SessionService) GetMostRecessionSessionOrCreateOne() (Session, error)
- func (ss *SessionService) GetSession(id int) (Session, error)
- func (ss *SessionService) InsertNewSession(name string, messages []MessageToSend) (Session, error)
- func (ss *SessionService) UpdateSessionMessages(id int, messages []MessageToSend) error
- func (ss *SessionService) UpdateSessionName(id int, name string) error
- type UpdateCurrentSession
Constants ¶
View Source
const ( IDLE = "idle" PROCESSING = "processing" ERROR = "error" )
Variables ¶
This section is empty.
Functions ¶
func ConstructListItems ¶
func RenderBotMessage ¶
func RenderUserMessage ¶
func SendFinalProcessMessage ¶
Types ¶
type CompletionChunk ¶
type CompletionResponse ¶
type CompletionResponse struct {
Data CompletionChunk `json:"data"`
}
type FinalProcessMessage ¶
type FinalProcessMessage struct {
FinalMessage string
}
Final Message is the concatenated string from the chat gpt stream
type LoadDataFromDB ¶
type LoadDataFromDB struct {
// contains filtered or unexported fields
}
type MessageToSend ¶
func ConstructUserMessage ¶
func ConstructUserMessage(content string) MessageToSend
type Model ¶
type Model struct { Settings settings.Settings CurrentSessionID int CurrentSessionName string ArrayOfProcessResult []ProcessResult ArrayOfMessages []MessageToSend CurrentAnswer string AllSessions []Session ProcessingMode string // contains filtered or unexported fields }
func (*Model) CallChatGpt ¶
func (m *Model) CallChatGpt(resultChan chan ProcessResult) tea.Cmd
func (Model) GetLatestBotMessage ¶
func (Model) GetMessagesAsPrettyString ¶
func (Model) GetMessagesAsString ¶
type ProcessResult ¶
type ProcessResult struct { ID int Result CompletionChunk // or whatever type you need Err error Final bool }
Define a type for the data you want to return, if needed
type Session ¶
type Session struct { ID int Messages []MessageToSend CreatedAt string SessionName string }
type SessionService ¶
func NewSessionService ¶
func NewSessionService(db *sql.DB) *SessionService
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 []MessageToSend) (Session, error)
func (*SessionService) UpdateSessionMessages ¶
func (ss *SessionService) UpdateSessionMessages(id int, messages []MessageToSend) error
func (*SessionService) UpdateSessionName ¶
func (ss *SessionService) UpdateSessionName(id int, name string) error
type UpdateCurrentSession ¶
type UpdateCurrentSession struct{}
Click to show internal directories.
Click to hide internal directories.