application

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTelegramEventHandler

func NewTelegramEventHandler(log logger.Logger, bot *tgbotapi.BotAPI) mediator.EventHandler

func NewWechatEventHandler added in v0.2.0

func NewWechatEventHandler(log logger.Logger, wechat *officialaccount.OfficialAccount) mediator.EventHandler

Types

type Application

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

func NewApplication

func NewApplication(repo domain.Repository, mediator mediator.Mediator, api domain.ChatGTPService) *Application

func (*Application) End

func (app *Application) End(ctx context.Context, log logger.Logger, f domain.From)

func (*Application) Get added in v0.1.1

func (app *Application) Get(ctx context.Context, log logger.Logger, f domain.From) (*Chat, error)

func (*Application) GetByChatID added in v0.1.3

func (app *Application) GetByChatID(ctx context.Context, log logger.Logger, cid string) (*Chat, error)

func (*Application) NewChat

func (app *Application) NewChat(ctx context.Context, log logger.Logger, f domain.From) error

func (*Application) Prompt

func (app *Application) Prompt(ctx context.Context, log logger.Logger, f domain.From, q string, msgID domain.ChannelMessageID) error

type Chat added in v0.1.1

type Chat struct {
	ID            string          `json:"id"`
	Channel       int             `json:"channel"`
	ChannelUserID string          `json:"channel_user_id"`
	Current       *Converstaion   `json:"current,omitempty"`
	Previous      []*Converstaion `json:"previous,omitempty"`
}

func AssembleEntidy added in v0.1.2

func AssembleEntidy(entity *domain.Chat) *Chat

type Converstaion added in v0.1.1

type Converstaion struct {
	Prompt     string `json:"prompt"`
	Completion string `json:"completion"`
}

type TelegramEventHandler

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

func (*TelegramEventHandler) Handle

func (ev *TelegramEventHandler) Handle(ctx context.Context, event mediator.Event)

func (*TelegramEventHandler) Listening

func (ev *TelegramEventHandler) Listening() []mediator.EventKind

type WechatEventHandler added in v0.2.0

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

func (*WechatEventHandler) Handle added in v0.2.0

func (w *WechatEventHandler) Handle(ctx context.Context, ev mediator.Event)

func (*WechatEventHandler) Listening added in v0.2.0

func (w *WechatEventHandler) Listening() []mediator.EventKind

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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