api

package
v0.0.0-...-a8bebdb Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GroupHandler = "group"
	UserHandler  = "personal"
)

Variables

View Source
var (
	ClearCardKind        = CardKind("clear")            // 清空上下文
	PicModeChangeKind    = CardKind("pic_mode_change")  // 切换图片创作模式
	VisionModeChangeKind = CardKind("vision_mode")      // 切换图片解析模式
	PicResolutionKind    = CardKind("pic_resolution")   // 图片分辨率调整
	PicStyleKind         = CardKind("pic_style")        // 图片风格调整
	VisionStyleKind      = CardKind("vision_style")     // 图片推理级别调整
	PicTextMoreKind      = CardKind("pic_text_more")    // 重新根据文本生成图片
	PicVarMoreKind       = CardKind("pic_var_more")     // 变量图片
	RoleTagsChooseKind   = CardKind("role_tags_choose") // 内置角色所属标签选择
	RoleChooseKind       = CardKind("role_choose")      // 内置角色选择
	AIModeChooseKind     = CardKind("ai_mode_choose")   // AI模式选择
)
View Source
var (
	GroupChatType = CardChatType("group")
	UserChatType  = CardChatType("personal")
)

Functions

This section is empty.

Types

type Action

type Action interface {
	Execute(a *ActionInfo) bool
}

type ActionInfo

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

func (*ActionInfo) PatchCard

func (a *ActionInfo) PatchCard(ctx context.Context, msgId *string,
	cardContent string) error

func (*ActionInfo) SendAIModeListsCard

func (a *ActionInfo) SendAIModeListsCard(ctx context.Context,
	sessionId *string, msgId *string, aiModeStrs []string)

func (*ActionInfo) SendRoleListCard

func (a *ActionInfo) SendRoleListCard(ctx context.Context,
	sessionId *string, msgId *string, roleTag string, roleList []string)

func (*ActionInfo) SendRoleTagsCard

func (a *ActionInfo) SendRoleTagsCard(ctx context.Context,
	sessionId *string, msgId *string, roleTags []string)

func (*ActionInfo) UpdateImageCard

func (a *ActionInfo) UpdateImageCard(ctx context.Context, base64Str string, msgId *string, sessionId *string, question string) error

func (*ActionInfo) UpdateTextCard

func (a *ActionInfo) UpdateTextCard(ctx context.Context, msg string, msgId *string, ifNewTopic bool) error

type CardChatType

type CardChatType string

type CardKind

type CardKind string

type CardMsg

type CardMsg struct {
	Kind      CardKind
	ChatType  CardChatType
	Value     interface{}
	SessionId string
	MsgId     string
}

type Config

type Config struct {
	FeishuAppId             string `mapstructure:"FEISHU_APP_ID"`
	FeishuAppSecret         string `mapstructure:"FEISHU_APP_SECRET"`
	FeishuEncryptKey        string `mapstructure:"FEISHU_ENCRYPT_KEY"`
	FeishuVerificationToken string `mapstructure:"FEISHU_VERIFICATION_TOKEN"`

	OpenaiApiKey    string `mapstructure:"OPENAI_KEY"`
	OpenaiModel     string `mapstructure:"OPENAI_MODEL"`
	OpenaiMaxTokens int    `mapstructure:"OPENAI_MAX_TOKENS"`
	OpenaiApiUrl    string `mapstructure:"OPENAI_API_URL"`
}

type FileAction

type FileAction struct {
}

func (*FileAction) Execute

func (*FileAction) Execute(a *ActionInfo) bool

type HandlerType

type HandlerType string

type HelpAction

type HelpAction struct {
}

func (*HelpAction) Execute

func (*HelpAction) Execute(a *ActionInfo) bool
type MenuOption struct {
	// contains filtered or unexported fields
}

type MessageAction

type MessageAction struct {
}

func (*MessageAction) Execute

func (*MessageAction) Execute(a *ActionInfo) bool

type MessageHandler

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

func (MessageHandler) MsgReceivedHandler

func (m MessageHandler) MsgReceivedHandler(ctx context.Context, event *larkim.P2MessageReceiveV1) error

type MessageHandlerInterface

type MessageHandlerInterface interface {
	MsgReceivedHandler(ctx context.Context, event *larkim.P2MessageReceiveV1) error
}

func NewMessageHandler

func NewMessageHandler(gpt *services.ChatGPT, config Config, logger *zap.Logger, larkClient *lark.Client) MessageHandlerInterface

type MsgInfo

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

type PreAction

type PreAction struct {
}

func (*PreAction) Execute

func (*PreAction) Execute(a *ActionInfo) bool

type Server

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

func NewServer

func NewServer(config *Config, logger *zap.Logger) (*Server, error)

func (*Server) ListenAndServe

func (s *Server) ListenAndServe()

Jump to

Keyboard shortcuts

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