bots

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUsageRestriction = errors.New("usage restriction")

Functions

This section is empty.

Types

type Bot

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

func NewBot

func NewBot(cfg llm.BotConfig, bot *model.Bot) *Bot

func (*Bot) GetConfig

func (b *Bot) GetConfig() llm.BotConfig

func (*Bot) GetMMBot

func (b *Bot) GetMMBot() *model.Bot

func (*Bot) LLM

func (b *Bot) LLM() llm.LanguageModel

func (*Bot) SetLLMForTest

func (b *Bot) SetLLMForTest(llm llm.LanguageModel)

type Config

type Config interface {
	GetDefaultBotName() string
	EnableLLMLogging() bool
	GetTranscriptGenerator() string
}

type MMBots

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

func New

func New(mutexPluginAPI cluster.MutexPluginAPI, pluginAPI *pluginapi.Client, licenseChecker *enterprise.LicenseChecker, config Config, llmUpstreamHTTPClient *http.Client) *MMBots

func (*MMBots) CheckUsageRestrictions

func (m *MMBots) CheckUsageRestrictions(requestingUserID string, bot *Bot, channel *model.Channel) error

func (*MMBots) CheckUsageRestrictionsForUser

func (m *MMBots) CheckUsageRestrictionsForUser(bot *Bot, requestingUserID string) error

func (*MMBots) EnsureBots

func (b *MMBots) EnsureBots(cfgBots []llm.BotConfig) error

func (*MMBots) GetAllBots

func (b *MMBots) GetAllBots() []*Bot

GetAllBots returns all bots

func (*MMBots) GetBotByID

func (b *MMBots) GetBotByID(botID string) *Bot

GetBotByID retrieves the bot associated with the given bot ID

func (*MMBots) GetBotByUsername

func (b *MMBots) GetBotByUsername(botUsername string) *Bot

GetBotByUsername retrieves the bot associated with the given bot username

func (*MMBots) GetBotByUsernameOrFirst

func (b *MMBots) GetBotByUsernameOrFirst(botUsername string) *Bot

GetBotByUsernameOrFirst retrieves the bot associated with the given bot username or the first bot if not found

func (*MMBots) GetBotConfig

func (b *MMBots) GetBotConfig(botUsername string) (llm.BotConfig, error)

func (*MMBots) GetBotForDMChannel

func (b *MMBots) GetBotForDMChannel(channel *model.Channel) *Bot

GetBotForDMChannel returns the bot for the given DM channel.

func (*MMBots) GetBotMentioned

func (b *MMBots) GetBotMentioned(text string) *Bot

GetBotMentioned returns the bot mentioned in the text, if any.

func (*MMBots) GetTranscribe

func (b *MMBots) GetTranscribe() Transcriber

TODO: This really doesn't belong here. Figure out where to put this.

func (*MMBots) IsAnyBot

func (b *MMBots) IsAnyBot(userID string) bool

IsAnyBot returns true if the given user is an AI bot.

func (*MMBots) SetBotsForTesting

func (b *MMBots) SetBotsForTesting(bots []*Bot)

SetBotsForTesting sets bots directly for testing purposes only

func (*MMBots) UpdateBotsCache

func (b *MMBots) UpdateBotsCache(cfgBots []llm.BotConfig) error

type Transcriber

type Transcriber interface {
	Transcribe(file io.Reader) (*subtitles.Subtitles, error)
}

Transcriber interface defines the contract for transcription services

Jump to

Keyboard shortcuts

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