models

package
v0.0.0-...-a0244a8 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HumanLoopTypeApprove      = "approval"
	HumanLoopTypeInformation  = "information"
	HumanLoopTypeConversation = "conversation"
)
View Source
const (
	// 等待处理状态
	HumanLoopStatusPending = "pending"
	// 已批准状态
	HumanLoopStatusApproved = "approved"
	// 已拒绝状态
	HumanLoopStatusRejected = "rejected"
	// 已过期状态
	HumanLoopStatusExpired = "expired"
	// 错误状态
	HumanLoopStatusError = "error"
	// 已完成状态(用于非审批类交互)
	HumanLoopStatusCompleted = "completed"
	// 进行中状态(用于多轮对话的中间状态)
	HumanLoopStatusInProgress = "inprogress"
	// 已取消状态
	HumanLoopStatusCancelled = "cancelled"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKey

type APIKey struct {
	ID        int64     `orm:"auto;pk;column(id)" json:"id"`
	Name      string    `orm:"size(128);unique" json:"name"`
	Key       string    `orm:"size(128);unique" json:"key"`
	Status    bool      `orm:"default(true)" json:"status"`
	Created   time.Time `orm:"auto_now_add;type(datetime)" json:"created_at"`
	Updated   time.Time `orm:"auto_now;type(datetime)" json:"updated_at"`
	DeletedAt time.Time `orm:"null;type(datetime)" json:"-"` // 软删除字段
	IsDeleted bool      `orm:"default(false)" json:"-"`      // 是否已删除标记
}

func (*APIKey) TableName

func (k *APIKey) TableName() string

TableName 设置表名

type APIKeyDeleteData

type APIKeyDeleteData struct {
	ID int64 `json:"id"` // 密钥ID
}

type APIKeyListResponse

type APIKeyListResponse struct {
	APIResponse
	APIKeys []*APIKey `json:"api_keys"`
}

type APIKeyRequestData

type APIKeyRequestData struct {
	Agentid    string `json:"agentid"`    // 企业微信应用ID
	Corpsecret string `json:"corpsecret"` // 企业微信应用密钥
	Name       string `json:"name"`       //密钥名称
}

HumanLoopRequestData 人机协作请求数据

type APIKeyResponseData

type APIKeyResponseData struct {
	APIResponse
	APIKey
}

type APIKeyUpdateData

type APIKeyUpdateData struct {
	ID     int64  `json:"id"`     // 密钥ID
	Name   string `json:"name"`   // 密钥名称
	Status bool   `json:"status"` // 密钥状态
}

type APIResponse

type APIResponse struct {
	Success bool   `json:"success"`         // 请求是否成功
	Error   string `json:"error,omitempty"` // 错误信息(可选)
}

APIResponse 基础 API 响应模型

type HumanLoop

type HumanLoop struct {
	ID             int64     `orm:"auto;pk;column(id)" json:"-"`
	TaskId         string    `orm:"size(128);index" json:"task_id"`
	ConversationId string    `orm:"size(128);index" json:"conversation_id"`
	RequestId      string    `orm:"size(128);unique" json:"request_id"`
	SpNo           string    `orm:"size(128);index" json:"sp_no"`
	LoopType       string    `orm:"size(64)" json:"loop_type"`
	Context        string    `orm:"type(text)" json:"-"` // 实际存储
	Platform       string    `orm:"size(64);index" json:"platform"`
	Metadata       string    `orm:"type(text);null" json:"-"` // 实际存储
	Status         string    `orm:"size(32);default(pending)" json:"status"`
	Response       string    `orm:"type(text);null" json:"response,omitempty"` // 实际存储
	Feedback       string    `orm:"type(text);null" json:"feedback,omitempty"` // 实际存储
	RespondedBy    string    `orm:"size(128);null" json:"responded_by,omitempty"`
	RespondedAt    time.Time `orm:"null;type(datetime)" json:"responded_at,omitempty"`
	Created        time.Time `orm:"auto_now_add;type(datetime)" json:"-"`
	Updated        time.Time `orm:"auto_now;type(datetime)" json:"-"`
	DeletedAt      time.Time `orm:"null;type(datetime)" json:"-"` // 软删除字段
	IsDeleted      bool      `orm:"default(false)" json:"-"`      // 是否已删除标记

	// 非数据库字段,用于JSON序列化
	ContextMap  map[string]any `orm:"-" json:"context"`
	MetadataMap map[string]any `orm:"-" json:"metadata,omitempty"`
}

HumanLoop 人机协作请求主模型

func (*HumanLoop) AfterLoad

func (h *HumanLoop) AfterLoad()

字符串转map

func (*HumanLoop) BeforeSave

func (h *HumanLoop) BeforeSave()

Map转字符串存数据库

func (*HumanLoop) TableName

func (h *HumanLoop) TableName() string

TableName 设置表名

type HumanLoopCancelConversationData

type HumanLoopCancelConversationData struct {
	ConversationId string `json:"conversation_id"` // 会话标识符
	Platform       string `json:"platform"`        // 使用平台
}

HumanLoopCancelConversationData 取消整个会话

type HumanLoopCancelData

type HumanLoopCancelData struct {
	ConversationId string `json:"conversation_id"` // 会话标识符
	RequestId      string `json:"request_id"`      // 请求标识符
	Platform       string `json:"platform"`        // 使用平台
}

HumanLoopCancelData 取消单个人机请求

type HumanLoopContinueData

type HumanLoopContinueData struct {
	ConversationId string         `json:"conversation_id"`    // 会话标识符
	RequestId      string         `json:"request_id"`         // 请求标识符
	TaskId         string         `json:"task_id"`            // 任务标识符
	Context        map[string]any `json:"context"`            // 上下文信息
	Platform       string         `json:"platform"`           // 使用平台
	Metadata       map[string]any `json:"metadata,omitempty"` // 附加元数据(可选)
}

HumanLoopContinueData 继续人机协作

type HumanLoopRequestData

type HumanLoopRequestData struct {
	TaskId         string         `json:"task_id"`            // 任务标识符
	ConversationId string         `json:"conversation_id"`    // 会话标识符
	RequestId      string         `json:"request_id"`         // 请求标识符
	LoopType       string         `json:"loop_type"`          // 循环类型
	Context        map[string]any `json:"context"`            // 提供给人类的上下文信息
	Platform       string         `json:"platform"`           // 使用平台(如微信、飞书)
	Metadata       map[string]any `json:"metadata,omitempty"` // 附加元数据(可选)
}

HumanLoopRequestData 人机协作请求数据

type HumanLoopStatusParams

type HumanLoopStatusParams struct {
	ConversationId string `json:"conversation_id"` // 会话标识符
	RequestId      string `json:"request_id"`      // 请求标识符
	Platform       string `json:"platform"`        // 使用平台
}

HumanLoopStatusParams 人机协作状态查询参数

type HumanLoopStatusResponse

type HumanLoopStatusResponse struct {
	APIResponse           // 内嵌基础响应
	Status      string    `json:"status"`                 // 请求状态(默认:"pending")
	Response    any       `json:"response,omitempty"`     // 人类响应数据(可选)
	Feedback    any       `json:"feedback,omitempty"`     // 反馈数据(可选)
	RespondedBy string    `json:"responded_by,omitempty"` // 响应者信息(可选)
	RespondedAt time.Time `json:"responded_at,omitempty"` // 响应时间戳(可选)
}

HumanLoopStatusResponse 人机协作状态响应

Jump to

Keyboard shortcuts

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