messages

package
v0.0.0-...-fc4cb94 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Type         MessageType // The type of the message
	Content      string      // The content of the message
	Sender       string      // The sender of the message (custom user name)
	FunctionName string      // The name of the function (if applicable)
}

Message represents a single message in the chat history.

type MessageHistory

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

MessageHistory stores a history of messages.

func NewMessageHistory

func NewMessageHistory() *MessageHistory

NewMessageHistory creates a new instance of MessageHistory.

func (*MessageHistory) AddMessage

func (m *MessageHistory) AddMessage(msgType MessageType, sender, functionName, content string)

AddMessage adds a new message to the history.

func (*MessageHistory) GetAllMessagesAsString

func (m *MessageHistory) GetAllMessagesAsString() string

GetAllMessagesAsString returns all messages in the history as a single string.

type MessageType

type MessageType int

MessageType is an enumeration of different types of messages.

const (
	FunctionResult MessageType = iota // Represents a function result
	AIMessage                         // Represents a message from AI
	HumanMessage                      // Represents a message from a human
	ChatMessage                       // Represents a generic chat message
)

Jump to

Keyboard shortcuts

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