coze

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: MIT Imports: 9 Imported by: 1

README

coze

coze bots/workflow

Documentation

Index

Constants

View Source
const (
	ID            = "coze"
	Comment       = "easy to share coze bots/workflow"
	RoutePrefix   = "/"
	DefaultEnable = false
)

Variables

View Source
var Module = module.Module{
	ID:          ID,
	Comment:     Comment,
	RouteFunc:   AddRoute,
	RoutePrefix: RoutePrefix,
	FlagFunc:    ServeFlag,
}

Functions

func AddRoute

func AddRoute(g *gin.Engine)

func ServeFlag

func ServeFlag(serveCmd *cobra.Command)

Types

type CozeResponse

type CozeResponse struct {
	Messages       []Message `json:"messages"`
	ConversationID string    `json:"conversation_id"`
	Code           int       `json:"code"`
	Msg            string    `json:"msg"`
}

CozeResponse 定义接口返回结构

type Message

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

Message 定义消息结构

type RequestPayload

type RequestPayload struct {
	UserID         string `json:"user_id" form:"user_id" binding:"required"`
	BotID          string `json:"bot_id" form:"bot_id" binding:"required"`
	Prompt         string `json:"prompt" form:"prompt" binding:"required"`
	ConversationID string `json:"conversation_id" form:"conversation_id"`
}

RequestPayload 定义接收的请求数据结构

type ResponseContent

type ResponseContent struct {
	Code           int    `json:"code"`
	Content        string `json:"content"`
	ConversationID string `json:"conversation_id"`
}

ResponseContent 定义返回的数据结构

Jump to

Keyboard shortcuts

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