domain

package
v0.0.0-...-167d493 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: GPL-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 Action

type Action interface {
	Execute(ctx context.Context, actionInfo *ActionInfo) (next bool, err error)
}

type ActionInfo

type ActionInfo struct {
	Message *LarkMessage

	Result *ActionResult // 返回的消息。如果已经有了返回的消息,则不执行下一阶段。
}

func (*ActionInfo) ExistsResult

func (a *ActionInfo) ExistsResult() bool

func (*ActionInfo) GetMessageID

func (a *ActionInfo) GetMessageID() string

func (*ActionInfo) GetText

func (a *ActionInfo) GetText() string

func (*ActionInfo) UsePlugin

func (a *ActionInfo) UsePlugin() bool

type ActionResult

type ActionResult struct {
	ReplyMsgID string

	Result string // may: text, base64 for image

	Type ActionResultType
}

type ActionResultType

type ActionResultType string
const (
	ActionResultText     ActionResultType = "text"
	ActionResultImageB64 ActionResultType = "image_b64"
	ActionResultHelpCard ActionResultType = "help_card"
)

type FeishuEx

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

func NewFeishuEx

func NewFeishuEx(feishuer Feishuer, opts ...FeishuExOption) (*FeishuEx, error)

func (*FeishuEx) HandleMessageReceive

func (f *FeishuEx) HandleMessageReceive(ctx context.Context, msg *LarkMessage) error

type FeishuExOption

type FeishuExOption func(*FeishuEx)

func WithAction

func WithAction(action Action) FeishuExOption

WithAction 添加单个处理流程

func WithActions

func WithActions(actions ...Action) FeishuExOption

WithActions 添加多个处理流程

type Feishuer

type Feishuer interface {
	Reply(ctx context.Context, actionResult *ActionResult) error
}

type FinalReply

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

func NewFinalReply

func NewFinalReply(text string) *FinalReply

func (*FinalReply) Execute

func (a *FinalReply) Execute(ctx context.Context, actionInfo *ActionInfo) (next bool, err error)

type HelperAction

type HelperAction struct{}

HelperAction 帮助卡片

func NewHelperAction

func NewHelperAction() *HelperAction

func (HelperAction) Execute

func (h HelperAction) Execute(ctx context.Context, actionInfo *ActionInfo) (next bool, err error)

type LLMer

type LLMer interface {
	Chat(ctx context.Context, messages []LlmMessage) (*LlmAnswer, error)
}

type LarkMessage

type LarkMessage larkim.EventMessage

func (LarkMessage) GetChatType

func (m LarkMessage) GetChatType() consts.ChatType

func (LarkMessage) GetText

func (m LarkMessage) GetText() string

func (LarkMessage) ID

func (m LarkMessage) ID() string

func (LarkMessage) IsMentionAt

func (m LarkMessage) IsMentionAt(name string) bool

type LlmAnswer

type LlmAnswer struct {
	Role    string
	Content string
}

type LlmMessage

type LlmMessage struct {
	Role    string
	Content string
}

type MessageAction

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

func NewMessageAction

func NewMessageAction(llmer LLMer) *MessageAction

func (MessageAction) Execute

func (a MessageAction) Execute(ctx context.Context, actionInfo *ActionInfo) (next bool, err error)

type PluginAction

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

func NewPluginAction

func NewPluginAction(manager *llmplugin.PluginManager) *PluginAction

func (PluginAction) Execute

func (a PluginAction) Execute(ctx context.Context, actionInfo *ActionInfo) (next bool, err error)

type ProcessMentionAction

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

ProcessMentionAction 是否 @ 机器人

func NewProcessMentionAction

func NewProcessMentionAction(botname string) *ProcessMentionAction

func (ProcessMentionAction) Execute

func (a ProcessMentionAction) Execute(ctx context.Context, actionInfo *ActionInfo) (bool, error)

type ProcessUniqueAction

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

func NewProcessUniqueAction

func NewProcessUniqueAction() *ProcessUniqueAction

func (*ProcessUniqueAction) Execute

func (a *ProcessUniqueAction) Execute(ctx context.Context, actionInfo *ActionInfo) (next bool, err error)

Jump to

Keyboard shortcuts

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