handler

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatHandler

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

func NewChatHandler

func NewChatHandler(cmd *cli.Command, chatID string) (*ChatHandler, error)

func (*ChatHandler) Handle

func (h *ChatHandler) Handle(ctx context.Context, cmd *cli.Command, prompt string) (string, error)

type ChatSession

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

The ChatSession caches chat messages and keeps track of the conversation history. It is designed to store cached messages in a specified directory and in JSON format.

func NewChatSession

func NewChatSession(storagePath string) (*ChatSession, error)

type Content

type Content struct {
	Text string `json:"text"`
	Type string `json:"type"`
}

todo: These structs are used to parse the JSON data stored in the cache. This is a temporary solution and should be replaced with a more robust solution. ref: https://github.com/openai/openai-go/issues/133

type DefaultHandler

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

func NewDefaultHandler

func NewDefaultHandler(cmd *cli.Command) (*DefaultHandler, error)

func (*DefaultHandler) Handle

func (h *DefaultHandler) Handle(ctx context.Context, cmd *cli.Command, prompt string) (string, error)

type GeminiChatHandler

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

func NewGeminiChatHandler

func NewGeminiChatHandler(ctx context.Context, apiKey string, model string) (*GeminiChatHandler, error)

func (*GeminiChatHandler) Handle

func (h *GeminiChatHandler) Handle(ctx context.Context, cmd *cli.Command, prompt string) (string, error)

Handle

type Handler

type Handler interface {
	Handle(ctx context.Context, cmd *cli.Command, prompt string) (string, error)
}

type Message

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

type Root

type Root struct {
	Messages []Message `json:"messages"`
	Model    string    `json:"model"`
}

Jump to

Keyboard shortcuts

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