internal

package
v0.0.0-...-3c5ca83 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AI

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

func NewAI

func NewAI(cfg Config) *AI

func (*AI) Imagine

func (a *AI) Imagine(ctx context.Context, prompt string) ([]string, error)

func (*AI) StreamingReply

func (a *AI) StreamingReply(ctx context.Context, thread []*telegram.Message) (chan StreamChunk, error)

func (*AI) Transcribe

func (a *AI) Transcribe(ctx context.Context, file *os.File) (string, error)

type Bot

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

func NewBot

func NewBot(cfg Config) (*Bot, error)

func (*Bot) Run

func (b *Bot) Run() error

type Config

type Config struct {
	TelegramToken string    `env:"TELEGRAM_TOKEN,notEmpty"`
	OpenAIAPIKey  string    `env:"OPENAI_API_KEY,notEmpty"`
	AllowedUsers  []int64   `env:"ALLOWED_USERS,notEmpty"`
	MeasureUnits  string    `env:"MEASURE_UNITS" envDefault:"metric"`
	LogLevel      log.Level `env:"LOG_LEVEL" envDefault:"INFO"`
}

func ConfigFromEnv

func ConfigFromEnv() (Config, error)

type Store

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

func NewStore

func NewStore() *Store

func (*Store) Clear

func (s *Store) Clear(chatID int64)

func (*Store) Put

func (s *Store) Put(msg *telegram.Message)

func (*Store) Thread

func (s *Store) Thread(chatID int64) []*telegram.Message

type StreamChunk

type StreamChunk struct {
	Delta string
	Error error
}

Jump to

Keyboard shortcuts

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