Versions in this module Expand all Collapse all v1 v1.1.0 Nov 12, 2023 Changes in this version + func RegisterAliyun(i IAliyun) + func RegisterBaidu(i IBaidu) + func RegisterChat(i IChat) + func RegisterCommon(i ICommon) + func RegisterFile(i IFile) + func RegisterMidjourney(i IMidjourney) + func RegisterOpenAI(i IOpenAI) + func RegisterRobot(i IRobot) + func RegisterSession(i ISession) + func RegisterUser(i IUser) + func RegisterXfyun(i IXfyun) + type IAliyun interface + Text func(ctx context.Context, robot *model.Robot, message *model.Message) (*model.Text, error) + func Aliyun() IAliyun + type IBaidu interface + Text func(ctx context.Context, robot *model.Robot, message *model.Message) (*model.Text, error) + func Baidu() IBaidu + type IChat interface + Chat func(ctx context.Context, chat *model.Chat, retry ...int) (response openai.ChatCompletionResponse, err error) + ChatStream func(ctx context.Context, chat *model.Chat, retry ...int) (responseChan chan model.ChatCompletionStreamResponse, err error) + func Chat() IChat + type ICommon interface + ClearMessageContext func(ctx context.Context, robot *model.Robot, message *model.Message) (int64, error) + GetMessageContext func(ctx context.Context, robot *model.Robot, message *model.Message) []string + SaveMessageContext func(ctx context.Context, robot *model.Robot, message *model.Message, value any) error + Translate func(ctx context.Context, text string, retry ...int) (res string) + TrimMessageContext func(ctx context.Context, robot *model.Robot, message *model.Message, ...) error + func Common() ICommon + type IFile interface + SaveImage func(ctx context.Context, imgBytes []byte, ext string, fileName ...string) (*model.Image, error) + func File() IFile + type IMidjourney interface + Image func(ctx context.Context, robot *model.Robot, message *model.Message) (imageInfo *model.Image, err error) + func Midjourney() IMidjourney + type IOpenAI interface + Image func(ctx context.Context, robot *model.Robot, message *model.Message) (imageInfo *model.Image, err error) + Text func(ctx context.Context, robot *model.Robot, message *model.Message, retry ...int) (*model.Text, error) + func OpenAI() IOpenAI + type IRobot interface + ClearMessageContext func(ctx context.Context, robot *model.Robot, message *model.Message) (int64, error) + GetRobotByUserId func(ctx context.Context, userId int) (*model.Robot, error) + GetRobotsByUserIds func(ctx context.Context, userId ...int) ([]*model.Robot, error) + Image func(ctx context.Context, robot *model.Robot, message *model.Message) (*model.Image, error) + IsNeedRobotReply func(ctx context.Context, userId ...int) ([]*model.Robot, bool) + Text func(ctx context.Context, robot *model.Robot, message *model.Message) (*model.Text, error) + func Robot() IRobot + type ISession interface + GetUid func(ctx context.Context) int + GetUser func(ctx context.Context) *model.User + func Session() ISession + type IUser interface + GetUserById func(ctx context.Context, userId int) (*model.User, error) + func User() IUser + type IXfyun interface + Text func(ctx context.Context, robot *model.Robot, message *model.Message) (*model.Text, error) + func Xfyun() IXfyun