Files
ai-agent/workflow/model/entity/session.go
T

91 lines
3.2 KiB
Go

package entity
import "gitea.redpowerfuture.com/red-future/common/beans"
// Session 会话记录
type Session struct {
beans.SQLBaseDO `orm:",inherit"` // 嵌入基础字段:Id, TenantId, Creator, CreatedAt, Updater, UpdatedAt, DeletedAt
SessionName string `orm:"session_name" json:"sessionName" description:"会话名称"`
}
type sessionCol struct {
beans.SQLBaseCol
SessionName string
}
var SessionCol = sessionCol{
SQLBaseCol: beans.DefSQLBaseCol,
SessionName: "session_name",
}
// WorkflowSessionResult 工作流会话结果
type WorkflowSessionResult struct {
beans.SQLBaseDO `orm:",inherit"`
SessionId int64 `orm:"session_id" json:"sessionId" description:"所属会话ID"`
FlowId int64 `orm:"flow_id" json:"flowId" description:"工作流ID"`
FlowName string `orm:"flow_name" json:"flowName" description:"工作流名称"`
RequestParams map[string]any `orm:"request_params" json:"requestParams" description:"请求参数"`
ResultParams []map[string]any `orm:"result_params" json:"resultParams" description:"返回结果"`
Status int `orm:"status" json:"status" description:"状态:1-运行中,2-成功,3-失败"`
TotalTokens int `orm:"total_tokens" json:"totalTokens" description:"总token消耗"`
TotalFee float64 `orm:"total_fee" json:"totalFee" description:"总费用"`
ErrorMessage string `orm:"error_message" json:"errorMessage" description:"错误信息"`
}
type workflowSessionResultCol struct {
beans.SQLBaseCol
SessionId string
FlowId string
FlowName string
RequestParams string
ResultParams string
Status string
TotalTokens string
TotalFee string
ErrorMessage string
}
var WorkflowSessionResultCol = workflowSessionResultCol{
SQLBaseCol: beans.DefSQLBaseCol,
SessionId: "session_id",
FlowId: "flow_id",
FlowName: "flow_name",
RequestParams: "request_params",
ResultParams: "result_params",
Status: "status",
TotalTokens: "total_tokens",
TotalFee: "total_fee",
ErrorMessage: "error_message",
}
// ChatSessionResult 普通会话结果
type ChatSessionResult struct {
beans.SQLBaseDO `orm:",inherit"`
SessionId int64 `orm:"session_id" json:"sessionId" description:"所属会话ID"`
Question string `orm:"question" json:"question" description:"用户问题"`
Answer string `orm:"answer" json:"answer" description:"模型返回结果"`
TotalTokens int `orm:"total_tokens" json:"totalTokens" description:"总token消耗"`
TotalFee float64 `orm:"total_fee" json:"totalFee" description:"总费用"`
ErrorMessage string `orm:"error_message" json:"errorMessage" description:"错误信息"`
}
type chatSessionResultCol struct {
beans.SQLBaseCol
SessionId string
Question string
Answer string
TotalTokens string
TotalFee string
ErrorMessage string
}
var ChatSessionResultCol = chatSessionResultCol{
SQLBaseCol: beans.DefSQLBaseCol,
SessionId: "session_id",
Question: "question",
Answer: "answer",
TotalTokens: "total_tokens",
TotalFee: "total_fee",
ErrorMessage: "error_message",
}