llm_ctrl_sessions

package
v0.3.71 Latest Latest
Warning

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

Go to latest
Published: May 17, 2025 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ID

func ID(id string) string

Types

type LLMSessionItem

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

LLMSessionItem is a data structure representing a session with properties for metadata, messages, context, and file data.

func NewLLMSessionItem

func NewLLMSessionItem(ctrlSessions *LLMSessions, id string) (instance *LLMSessionItem)

func (*LLMSessionItem) AddAssistantText

func (instance *LLMSessionItem) AddAssistantText(text string)

func (*LLMSessionItem) AddContext

func (instance *LLMSessionItem) AddContext(model string, data interface{})

func (*LLMSessionItem) AddFile

func (instance *LLMSessionItem) AddFile(filename string) (response *LLMSessionItemFile, err error)

func (*LLMSessionItem) AddFileContent

func (instance *LLMSessionItem) AddFileContent(name string, bytes []byte) (response *LLMSessionItemFile, err error)

func (*LLMSessionItem) AddModel

func (instance *LLMSessionItem) AddModel(text string)

func (*LLMSessionItem) AddNote added in v0.3.56

func (instance *LLMSessionItem) AddNote(name, text string) (response *LLMSessionItemNote, err error)

func (*LLMSessionItem) AddSystemText

func (instance *LLMSessionItem) AddSystemText(text string)

func (*LLMSessionItem) AddUserText

func (instance *LLMSessionItem) AddUserText(text string)

func (*LLMSessionItem) Clear

func (instance *LLMSessionItem) Clear() *LLMSessionItem

func (*LLMSessionItem) DeleteNote added in v0.3.57

func (instance *LLMSessionItem) DeleteNote(name, text string) (response *LLMSessionItemNote, err error)

func (*LLMSessionItem) GetContext

func (instance *LLMSessionItem) GetContext() (response *LLMSessionItemContext)

func (*LLMSessionItem) GetContextData

func (instance *LLMSessionItem) GetContextData() (response interface{})

func (*LLMSessionItem) GetContextLen

func (instance *LLMSessionItem) GetContextLen() (response int)

func (*LLMSessionItem) GetData

func (instance *LLMSessionItem) GetData() (response *LLMSessionItemDataWrapper)

func (*LLMSessionItem) GetDataLite

func (instance *LLMSessionItem) GetDataLite() (response map[string]interface{})

func (*LLMSessionItem) GetFiles

func (instance *LLMSessionItem) GetFiles() (response *gg_collections.List[*LLMSessionItemFile])

func (*LLMSessionItem) GetId

func (instance *LLMSessionItem) GetId() (response string)

func (*LLMSessionItem) GetImageFiles

func (instance *LLMSessionItem) GetImageFiles() (response []*LLMSessionItemFile)

func (*LLMSessionItem) GetLastUsedModel

func (instance *LLMSessionItem) GetLastUsedModel() (response string)

func (*LLMSessionItem) GetMessageLimitBeforeAutoPinContext

func (instance *LLMSessionItem) GetMessageLimitBeforeAutoPinContext() (response int)

func (*LLMSessionItem) GetMessages

func (instance *LLMSessionItem) GetMessages() (response []*LLMSessionItemMessage)

func (*LLMSessionItem) GetMessagesLen

func (instance *LLMSessionItem) GetMessagesLen() (response int)

func (*LLMSessionItem) GetModels

func (instance *LLMSessionItem) GetModels() (response []string)

func (*LLMSessionItem) GetNotes added in v0.3.56

func (instance *LLMSessionItem) GetNotes() (response []*LLMSessionItemNote)

func (*LLMSessionItem) GetTextFiles

func (instance *LLMSessionItem) GetTextFiles() (response []*LLMSessionItemFile)

func (*LLMSessionItem) IsPinned

func (instance *LLMSessionItem) IsPinned() (response bool)

func (*LLMSessionItem) PinContext

func (instance *LLMSessionItem) PinContext(value bool)

func (*LLMSessionItem) Reset

func (instance *LLMSessionItem) Reset() *LLMSessionItem

Reset re-initialize the LLMSessionItem instance, clearing its state and resetting specific fields to default values.

func (*LLMSessionItem) Save

func (instance *LLMSessionItem) Save()

func (*LLMSessionItem) SetMessageLimitBeforeAutoPinContext

func (instance *LLMSessionItem) SetMessageLimitBeforeAutoPinContext(value int) *LLMSessionItem

type LLMSessionItemContext

type LLMSessionItemContext struct {
	Model   string      `json:"model"`
	Context interface{} `json:"context"` // array of num. Always incremented
}

type LLMSessionItemDataWrapper

type LLMSessionItemDataWrapper struct {
	Id       string                                    `json:"id"`
	Pinned   bool                                      `json:"pinned"`
	Models   []string                                  `json:"models"`
	Messages []*LLMSessionItemMessage                  `json:"messages"`
	Context  *LLMSessionItemContext                    `json:"context"`
	FileList *gg_collections.List[*LLMSessionItemFile] `json:"file-list"`
	Notes    []*LLMSessionItemNote                     `json:"notes"`
}

func (*LLMSessionItemDataWrapper) Map

func (instance *LLMSessionItemDataWrapper) Map() map[string]interface{}

func (*LLMSessionItemDataWrapper) String

func (instance *LLMSessionItemDataWrapper) String() string

type LLMSessionItemFile

type LLMSessionItemFile struct {
	Path     string `json:"path"`
	MimeType string `json:"mime-type"`
	IsImage  bool   `json:"is_image"`
	IsPDF    bool   `json:"is_pdf"`
	IsTXT    bool   `json:"is_txt"`
	Base64   string `json:"base64"`
}

func NewSessionItemFile added in v0.3.56

func NewSessionItemFile(filename string) (instance *LLMSessionItemFile)

func (*LLMSessionItemFile) Clone

func (instance *LLMSessionItemFile) Clone() *LLMSessionItemFile

func (*LLMSessionItemFile) GetContent

func (instance *LLMSessionItemFile) GetContent() (response []byte)

func (*LLMSessionItemFile) GetIsImage

func (instance *LLMSessionItemFile) GetIsImage() (response bool)

func (*LLMSessionItemFile) GetIsPDF

func (instance *LLMSessionItemFile) GetIsPDF() (response bool)

func (*LLMSessionItemFile) GetIsTXT

func (instance *LLMSessionItemFile) GetIsTXT() (response bool)

func (*LLMSessionItemFile) GetMimeType

func (instance *LLMSessionItemFile) GetMimeType() (response string)

func (*LLMSessionItemFile) GetPath

func (instance *LLMSessionItemFile) GetPath() (response string)

func (*LLMSessionItemFile) Map

func (instance *LLMSessionItemFile) Map() map[string]interface{}

func (*LLMSessionItemFile) RemoveContent

func (instance *LLMSessionItemFile) RemoveContent()

func (*LLMSessionItemFile) SetContent added in v0.3.52

func (instance *LLMSessionItemFile) SetContent(bytes []byte)

func (*LLMSessionItemFile) String

func (instance *LLMSessionItemFile) String() string

type LLMSessionItemMessage

type LLMSessionItemMessage struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

type LLMSessionItemNote added in v0.3.56

type LLMSessionItemNote struct {
	Name string `json:"name"`
	Text string `json:"text"`
}

func (*LLMSessionItemNote) Map added in v0.3.56

func (instance *LLMSessionItemNote) Map() map[string]interface{}

func (*LLMSessionItemNote) String added in v0.3.56

func (instance *LLMSessionItemNote) String() string

type LLMSessions

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

func NewLLMSessions

func NewLLMSessions(root, rootSessions string, args ...interface{}) (instance *LLMSessions)

func (*LLMSessions) AddAssistantText

func (instance *LLMSessions) AddAssistantText(id string, text string)

func (*LLMSessions) AddContext

func (instance *LLMSessions) AddContext(id, model string, data interface{})

func (*LLMSessions) AddFile

func (instance *LLMSessions) AddFile(id string, filename string) (response *LLMSessionItemFile, err error)

func (*LLMSessions) AddFileContent

func (instance *LLMSessions) AddFileContent(id string, name string, bytes []byte) (response *LLMSessionItemFile, err error)

func (*LLMSessions) AddModel

func (instance *LLMSessions) AddModel(id string, value string)

func (*LLMSessions) AddNote added in v0.3.56

func (instance *LLMSessions) AddNote(id string, name string, text string) (response *LLMSessionItemNote, err error)

func (*LLMSessions) AddSystemText

func (instance *LLMSessions) AddSystemText(id string, text string)

func (*LLMSessions) AddUserText

func (instance *LLMSessions) AddUserText(id string, text string)

func (*LLMSessions) Clear

func (instance *LLMSessions) Clear(id string) (response *LLMSessionItemDataWrapper)

func (*LLMSessions) DeleteNote added in v0.3.57

func (instance *LLMSessions) DeleteNote(id string, name string, text string) (response *LLMSessionItemNote, err error)

func (*LLMSessions) GetContextData

func (instance *LLMSessions) GetContextData(id string) (response interface{})

func (*LLMSessions) GetContextLen

func (instance *LLMSessions) GetContextLen(id string) (response int)

func (*LLMSessions) GetLastUsedModel

func (instance *LLMSessions) GetLastUsedModel(id string) string

func (*LLMSessions) GetMessageLimitBeforeAutoPinContext

func (instance *LLMSessions) GetMessageLimitBeforeAutoPinContext() int

func (*LLMSessions) GetSession

func (instance *LLMSessions) GetSession(id string) (response *LLMSessionItem)

GetSession retrieves or creates an LLMSessionItem by the given ID. It ensures thread safety and manages session storage.

func (*LLMSessions) GetSessionData

func (instance *LLMSessions) GetSessionData(id string) (response *LLMSessionItemDataWrapper)

GetSessionData retrieves and returns session data for a given session ID. Returns a map containing session data. If the session ID is invalid or the session does not exist, an empty map is returned. Session Data may contain chat history and files to be processed from the LLM

func (*LLMSessions) GetSessionDataLite

func (instance *LLMSessions) GetSessionDataLite(id string) (response map[string]interface{})

func (*LLMSessions) HasSession

func (instance *LLMSessions) HasSession(id string) (response bool)

func (*LLMSessions) IsPinned

func (instance *LLMSessions) IsPinned(id string) bool

func (*LLMSessions) PinContext

func (instance *LLMSessions) PinContext(id string, pinned bool)

func (*LLMSessions) Save

func (instance *LLMSessions) Save(id string)

func (*LLMSessions) SetMessageLimitBeforeAutoPinContext

func (instance *LLMSessions) SetMessageLimitBeforeAutoPinContext(value int) *LLMSessions

Jump to

Keyboard shortcuts

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