chat

package
v0.0.0-...-f680af2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HmacWithShaTobase64

func HmacWithShaTobase64(algorithm, data, key string) string

func WithTimeChat

func WithTimeChat(userID, msg string, f func(userID, msg string) string) string

加入超时控制

Types

type BaseChat

type BaseChat interface {
	Chat(userID string, msg string) string
	HandleMediaMsg(msg *message.MixMessage) string
}

func GetChatBot

func GetChatBot() BaseChat

type Echo

type Echo struct{}

func (*Echo) Chat

func (e *Echo) Chat(userID string, msg string) string

func (*Echo) HandleMediaMsg

func (e *Echo) HandleMediaMsg(msg *message.MixMessage) string

type ErrorChat

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

func (*ErrorChat) Chat

func (e *ErrorChat) Chat(userID string, msg string) string

func (*ErrorChat) HandleMediaMsg

func (e *ErrorChat) HandleMediaMsg(msg *message.MixMessage) string

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

type SimpleChat

type SimpleChat struct {
}

func (SimpleChat) Chat

func (s SimpleChat) Chat(userID string, msg string) string

func (SimpleChat) HandleMediaMsg

func (s SimpleChat) HandleMediaMsg(msg *message.MixMessage) string

type SimpleGptChat

type SimpleGptChat struct {
	SimpleChat
	// contains filtered or unexported fields
}

func (*SimpleGptChat) Chat

func (s *SimpleGptChat) Chat(userID string, msg string) string

type SparkChat

type SparkChat struct {
	BaseChat
}

func (*SparkChat) Chat

func (chat *SparkChat) Chat(userId, message string) (res string)

type SparkResponse

type SparkResponse struct {
	Header  *SparkResponseHeader `json:"header"`
	Payload map[string]any       `json:"payload"`
}

type SparkResponseHeader

type SparkResponseHeader struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Sid     string `json:"sid"`
	Status  int    `json:"status"`
}

func (*SparkResponseHeader) IsFailed

func (header *SparkResponseHeader) IsFailed() bool

func (*SparkResponseHeader) IsSuccess

func (header *SparkResponseHeader) IsSuccess() bool

func (*SparkResponseHeader) ToString

func (header *SparkResponseHeader) ToString() string

Jump to

Keyboard shortcuts

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