connector

package
v0.5.22 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIgnoreMessage = errors.New("ignore message")

Functions

This section is empty.

Types

type App

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

func NewApp

func NewApp(cfg config.Config, processor *Processor) *App

func (*App) FlushRuntimeState

func (a *App) FlushRuntimeState() error

func (*App) FlushRuntimeStateIfDirty

func (a *App) FlushRuntimeStateIfDirty() error

func (*App) LoadRuntimeState

func (a *App) LoadRuntimeState(path string) error

func (*App) Run

func (a *App) Run(ctx context.Context) error

func (*App) SetAutomationRunner

func (a *App) SetAutomationRunner(runner AutomationRunner)

func (*App) SetPromptLoader

func (a *App) SetPromptLoader(loader *prompting.Loader)

func (*App) UpdateRuntimeConfig

func (a *App) UpdateRuntimeConfig(cfg config.Config)

type Attachment

type Attachment struct {
	SourceMessageID string
	Kind            string
	FileKey         string
	ImageKey        string
	FileName        string
	LocalPath       string
	DownloadError   string
}

type AttachmentDownloader

type AttachmentDownloader interface {
	DownloadAttachment(ctx context.Context, resourceScopeKey, sourceMessageID string, attachment *Attachment) error
}

type AutomationRunner

type AutomationRunner interface {
	Run(ctx context.Context)
}

type ChatMemberNameResolver

type ChatMemberNameResolver interface {
	ResolveChatMemberName(ctx context.Context, chatID, openID, userID string) (string, error)
}

type Job

type Job struct {
	ReceiveID            string
	ReceiveIDType        string
	ChatType             string
	BotID                string
	BotName              string
	BotOpenID            string
	BotUserID            string
	SoulPath             string
	SenderName           string
	SenderOpenID         string
	SenderUserID         string
	SenderUnionID        string
	MentionedUsers       []MentionedUser
	SourceMessageID      string
	ReplyParentMessageID string
	ThreadID             string
	RootID               string
	MessageType          string
	Text                 string
	Attachments          []Attachment
	RawContent           string
	EventID              string
	ReceivedAt           time.Time
	ResourceScopeKey     string
	SessionKey           string
	SessionVersion       uint64
	Scene                string
	ResponseMode         string
	CreateFeishuThread   bool
	LLMProvider          string
	LLMModel             string
	LLMProfile           string
	LLMReasoningEffort   string
	LLMPersonality       string
	NoReplyToken         string
	SoulDoc              soulDocument
	DisableAck           bool
	WorkflowPhase        string
}

func BuildJob

func BuildJob(event *larkim.P2MessageReceiveV1) (*Job, error)

type JobProcessState

type JobProcessState string
const (
	JobProcessCompleted         JobProcessState = "completed"
	JobProcessRetryAfterRestart JobProcessState = "retry_after_restart"
)

type LarkSender

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

func NewLarkSender

func NewLarkSender(client *lark.Client, resourceDir string) *LarkSender

func (*LarkSender) AddReaction

func (s *LarkSender) AddReaction(ctx context.Context, messageID, emojiType string) error

func (*LarkSender) DownloadAttachment

func (s *LarkSender) DownloadAttachment(ctx context.Context, resourceScopeKey, sourceMessageID string, attachment *Attachment) error

func (*LarkSender) GetMessageText

func (s *LarkSender) GetMessageText(ctx context.Context, messageID string) (string, error)

func (*LarkSender) ReplyCard

func (s *LarkSender) ReplyCard(ctx context.Context, sourceMessageID, cardContent string) (string, error)

func (*LarkSender) ReplyCardDirect added in v0.3.13

func (s *LarkSender) ReplyCardDirect(ctx context.Context, sourceMessageID, cardContent string) (string, error)

func (*LarkSender) ReplyFile

func (s *LarkSender) ReplyFile(ctx context.Context, sourceMessageID, fileKey string) (string, error)

func (*LarkSender) ReplyFileDirect added in v0.5.17

func (s *LarkSender) ReplyFileDirect(ctx context.Context, sourceMessageID, fileKey string) (string, error)

func (*LarkSender) ReplyImage

func (s *LarkSender) ReplyImage(ctx context.Context, sourceMessageID, imageKey string) (string, error)

func (*LarkSender) ReplyImageDirect added in v0.5.17

func (s *LarkSender) ReplyImageDirect(ctx context.Context, sourceMessageID, imageKey string) (string, error)

func (*LarkSender) ReplyRichText

func (s *LarkSender) ReplyRichText(ctx context.Context, sourceMessageID string, lines []string) (string, error)

func (*LarkSender) ReplyRichTextMarkdown

func (s *LarkSender) ReplyRichTextMarkdown(ctx context.Context, sourceMessageID, markdown string) (string, error)

func (*LarkSender) ReplyRichTextMarkdownDirect added in v0.3.13

func (s *LarkSender) ReplyRichTextMarkdownDirect(ctx context.Context, sourceMessageID, markdown string) (string, error)

func (*LarkSender) ReplyText

func (s *LarkSender) ReplyText(ctx context.Context, sourceMessageID, text string) (string, error)

func (*LarkSender) ReplyTextDirect added in v0.3.13

func (s *LarkSender) ReplyTextDirect(ctx context.Context, sourceMessageID, text string) (string, error)

func (*LarkSender) ResolveChatMemberName

func (s *LarkSender) ResolveChatMemberName(ctx context.Context, chatID, openID, userID string) (string, error)

func (*LarkSender) ResolveUserName

func (s *LarkSender) ResolveUserName(ctx context.Context, openID, userID string) (string, error)

func (*LarkSender) ResourceRootForScope

func (s *LarkSender) ResourceRootForScope(resourceScopeKey string) string

func (*LarkSender) SendCard

func (s *LarkSender) SendCard(ctx context.Context, receiveIDType, receiveID, cardContent string) error

func (*LarkSender) SendFile

func (s *LarkSender) SendFile(ctx context.Context, receiveIDType, receiveID, fileKey string) error

func (*LarkSender) SendImage

func (s *LarkSender) SendImage(ctx context.Context, receiveIDType, receiveID, imageKey string) error

func (*LarkSender) SendText

func (s *LarkSender) SendText(ctx context.Context, receiveIDType, receiveID, text string) error

func (*LarkSender) UploadFile

func (s *LarkSender) UploadFile(ctx context.Context, localPath, fileName string) (string, error)

func (*LarkSender) UploadImage

func (s *LarkSender) UploadImage(ctx context.Context, localPath string) (string, error)

type MentionedUser

type MentionedUser struct {
	Key     string
	Name    string
	OpenID  string
	UserID  string
	UnionID string
}

type Processor

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

func NewProcessor

func NewProcessor(
	backend llm.Backend,
	sender Sender,
	failureMessage string,
	thinkingMessage string,
) *Processor

func (*Processor) FlushSessionState

func (p *Processor) FlushSessionState() error

func (*Processor) FlushSessionStateIfDirty

func (p *Processor) FlushSessionStateIfDirty() error

func (*Processor) LoadSessionState

func (p *Processor) LoadSessionState(path string) error

func (*Processor) ProcessJob

func (p *Processor) ProcessJob(ctx context.Context, job Job) bool

func (*Processor) ProcessJobState

func (p *Processor) ProcessJobState(ctx context.Context, job Job) JobProcessState

func (*Processor) SetBuiltinHelpConfig added in v0.3.12

func (p *Processor) SetBuiltinHelpConfig(cfg config.Config)

func (*Processor) SetImageGeneration added in v0.5.11

func (p *Processor) SetImageGeneration(cfg config.ImageGenerationConfig, env map[string]string) error

func (*Processor) SetImmediateFeedback

func (p *Processor) SetImmediateFeedback(mode, emojiType string)

func (*Processor) SetLLMBackend

func (p *Processor) SetLLMBackend(backend llm.Backend)

func (*Processor) SetPromptLoader

func (p *Processor) SetPromptLoader(loader *prompting.Loader)

func (*Processor) SetReplyMessages

func (p *Processor) SetReplyMessages(failureMessage, thinkingMessage string)

func (*Processor) SetRuntimeAPI

func (p *Processor) SetRuntimeAPI(baseURL, token, runtimeBin string)

type ReplyContextProvider

type ReplyContextProvider interface {
	GetMessageText(ctx context.Context, messageID string) (string, error)
}

type Sender

type Sender interface {
	SendText(ctx context.Context, receiveIDType, receiveID, text string) error
	SendCard(ctx context.Context, receiveIDType, receiveID, cardContent string) error
	AddReaction(ctx context.Context, messageID, emojiType string) error
	ReplyText(ctx context.Context, sourceMessageID, text string) (string, error)
	ReplyTextDirect(ctx context.Context, sourceMessageID, text string) (string, error)
	ReplyRichText(ctx context.Context, sourceMessageID string, lines []string) (string, error)
	ReplyRichTextMarkdown(ctx context.Context, sourceMessageID, markdown string) (string, error)
	ReplyRichTextMarkdownDirect(ctx context.Context, sourceMessageID, markdown string) (string, error)
	ReplyCard(ctx context.Context, sourceMessageID, cardContent string) (string, error)
	ReplyCardDirect(ctx context.Context, sourceMessageID, cardContent string) (string, error)
}

type UserNameResolver

type UserNameResolver interface {
	ResolveUserName(ctx context.Context, openID, userID string) (string, error)
}

Jump to

Keyboard shortcuts

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