Documentation
¶
Index ¶
- Variables
- type LLM
- type LastByteDetector
- type TalkContext
- type TalkContextInfo
- type TalkContextManager
- func (m *TalkContextManager) Clear()
- func (m *TalkContextManager) Current() *TalkContext
- func (m *TalkContextManager) Delete(index int) error
- func (m *TalkContextManager) List() []*TalkContextInfo
- func (m *TalkContextManager) Load(store string) error
- func (m *TalkContextManager) LoadOnce(store string) (err error)
- func (m *TalkContextManager) New()
- func (m *TalkContextManager) Pop() (*openai.ChatCompletionMessageParamUnion, error)
- func (m *TalkContextManager) Save(store string) error
- func (m *TalkContextManager) SwitchTo(index int) error
Constants ¶
This section is empty.
Variables ¶
var (
ErrDisabled = errors.New("llm disabled")
)
var (
ErrInvalidContextIndex = fmt.Errorf("invalid context index")
)
Functions ¶
This section is empty.
Types ¶
type LastByteDetector ¶
type LastByteDetector struct {
// contains filtered or unexported fields
}
func (*LastByteDetector) LastByte ¶
func (d *LastByteDetector) LastByte() byte
func (*LastByteDetector) TotalBytes ¶
func (d *LastByteDetector) TotalBytes() int64
type TalkContext ¶
type TalkContext struct {
Messages []openai.ChatCompletionMessageParamUnion `json:"messages"`
}
func (*TalkContext) IsEmpty ¶ added in v0.2.1
func (t *TalkContext) IsEmpty() bool
IsEmpty checks if the TalkContext has no messages.
type TalkContextInfo ¶
type TalkContextManager ¶
type TalkContextManager struct {
// contains filtered or unexported fields
}
TalkContextManager manages multiple TalkContexts.
func (*TalkContextManager) Clear ¶
func (m *TalkContextManager) Clear()
Clear clears the messages of the current context.
func (*TalkContextManager) Current ¶
func (m *TalkContextManager) Current() *TalkContext
Current returns the current TalkContext, creating a new one if none exists.
func (*TalkContextManager) Delete ¶
func (m *TalkContextManager) Delete(index int) error
Delete removes a context by index and adjusts the current context if necessary.
func (*TalkContextManager) List ¶
func (m *TalkContextManager) List() []*TalkContextInfo
List returns a list of TalkContextInfo for all contexts, including the current one.
func (*TalkContextManager) Load ¶
func (m *TalkContextManager) Load(store string) error
Load contexts from file
func (*TalkContextManager) LoadOnce ¶
func (m *TalkContextManager) LoadOnce(store string) (err error)
LoadOnce loads the contexts from the store only once, using sync.Once to ensure it is only done once.
func (*TalkContextManager) New ¶
func (m *TalkContextManager) New()
New creates a new TalkContext and sets it as the current context.
func (*TalkContextManager) Pop ¶ added in v0.2.1
func (m *TalkContextManager) Pop() (*openai.ChatCompletionMessageParamUnion, error)
Pop removes the last message from the current TalkContext.
func (*TalkContextManager) Save ¶
func (m *TalkContextManager) Save(store string) error
Save contexts to file
func (*TalkContextManager) SwitchTo ¶
func (m *TalkContextManager) SwitchTo(index int) error
SwitchTo switches the current context to the one at the specified index.