conversation

package
v0.4.21 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WebChatMessage

type WebChatMessage struct {
	Role   string   `json:"role"`
	Text   string   `json:"text"`
	Images []string `json:"images,omitempty"` // URLs only for web rendering
}

WebChatMessage represents a chat message for web rendering

func (*WebChatMessage) ToJSON

func (w *WebChatMessage) ToJSON() ([]byte, error)

func (*WebChatMessage) Type

func (w *WebChatMessage) Type() string

type WebConversation

type WebConversation struct {
	Messages []*WebMessage `json:"messages"`
}

WebConversation represents a conversation for web rendering

func ConvertConversation

func ConvertConversation(conv conversation.Conversation) (*WebConversation, error)

ConvertConversation converts a conversation.Conversation to a WebConversation

type WebMessage

type WebMessage struct {
	ID         string                 `json:"id"`
	ParentID   string                 `json:"parentId"`
	Time       time.Time              `json:"time"`
	LastUpdate time.Time              `json:"lastUpdate"`
	Type       string                 `json:"type"`
	Content    WebMessageContent      `json:"content"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
}

WebMessage represents a simplified message structure for web rendering

func ConvertMessage

func ConvertMessage(msg *conversation.Message) (*WebMessage, error)

ConvertMessage converts a conversation.Message to a WebMessage

type WebMessageContent

type WebMessageContent interface {
	Type() string
	ToJSON() ([]byte, error)
}

WebMessageContent is the base interface for different types of web message content

type WebToolResultMessage

type WebToolResultMessage struct {
	ToolID string `json:"toolId"`
	Result string `json:"result"`
}

WebToolResultMessage represents a tool result message for web rendering

func (*WebToolResultMessage) ToJSON

func (w *WebToolResultMessage) ToJSON() ([]byte, error)

func (*WebToolResultMessage) Type

func (w *WebToolResultMessage) Type() string

type WebToolUseMessage

type WebToolUseMessage struct {
	ToolID string          `json:"toolId"`
	Name   string          `json:"name"`
	Input  json.RawMessage `json:"input"`
}

WebToolUseMessage represents a tool use message for web rendering

func (*WebToolUseMessage) ToJSON

func (w *WebToolUseMessage) ToJSON() ([]byte, error)

func (*WebToolUseMessage) Type

func (w *WebToolUseMessage) Type() string

Jump to

Keyboard shortcuts

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