Files
ai-agent/workflow/model/dto/session/session_dto.go
T
19904408334 cef837a35c feat: 支持工作流断点续跑并拆分错误信息存储
- 新增同会话+同工作流最近执行失败且参数一致时断点续跑逻辑
- exec_workflow/exec_chat 新增 error 字段存储原始错误,error_message 仅存友好提示
- 新增 UpdateExecChatReq 与 exec_chat_dao Update 方法
- 新增 GetLatestBySessionAndFlow 查询最近执行记录
- 修正 ListDates 分组与排序 SQL 表达式
- 新增 pipeline 配置结构,删除旧设计文档
2026-08-21 09:54:06 +08:00

101 lines
4.4 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package session
import (
"ai-agent/workflow/model/entity"
"gitea.redpowerfuture.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// WebSocketConnectReq WebSocket 连接请求(query string 参数)
type WebSocketConnectReq struct {
g.Meta `path:"/wsExecute" method:"get" tags:"工作流执行" summary:"WebSocket执行工作流" dc:"通过WebSocket连接实时执行工作流,支持进度推送和取消"`
SessionId string `p:"sessionId" dc:"会话ID"`
}
type WebSocketExecChatReq struct {
Id int64 `json:"id" dc:"id"`
ModelId int64 `json:"modelId" dc:"模型ID" v:"required#模型ID不能为空"`
Question string `json:"question" dc:"用户提问" v:"required#用户提问不能为空"`
SystemPrompt string `json:"systemPrompt" dc:"系统提示词"`
}
type WebSocketExecWorkflowReq struct {
FlowId int64 `json:"flowId" dc:"用户流程ID" v:"required#用户流程ID不能为空"`
FlowContent *entity.FlowInfo `json:"flowContent" dc:"用户流程内容" v:"required#用户流程内容不能为空"`
}
type CreateSessionReq struct {
SessionId string `json:"sessionId" dc:"会话ID"`
SessionName string `json:"sessionName" dc:"会话名称"`
}
type ListSessionReq struct {
g.Meta `path:"/list" method:"get" tags:"会话管理" summary:"会话列表" dc:"会话列表"`
PageNum int64 `json:"pageNum" dc:"页码,从1开始"`
PageSize int64 `json:"pageSize" dc:"每页数量"`
}
type ListSessionRes struct {
List []*VOSession `json:"list"`
Total int `json:"total"`
}
type VOSession struct {
SessionId string `json:"sessionId" dc:"会话ID"`
SessionName string `json:"sessionName" dc:"会话名称"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
}
type DeleteSessionReq struct {
g.Meta `path:"/delete" method:"delete" tags:"会话管理" summary:"删除会话" dc:"删除会话"`
SessionId string `json:"sessionId" v:"required#会话ID不能为空"`
}
type DeleteSessionRecordReq struct {
g.Meta `path:"/deleteRecord" method:"post" tags:"会话管理" summary:"删除会话记录" dc:"删除会话记录"`
Ids []struct {
Id int64 `json:"id" v:"required#ID不能为空"`
Type string `json:"type" v:"required#类型不能为空"`
}
}
type GetSessionInfoReq struct {
g.Meta `path:"/get" method:"get" tags:"会话管理" summary:"会话内结果列表" dc:"会话内结果列表,工作流+普通对话混排按时间倒序"`
PageNum int64 `json:"pageNum" dc:"页码,从1开始"`
PageSize int64 `json:"pageSize" dc:"每页数量"`
SessionId string `json:"sessionId" v:"required#会话ID不能为空"`
}
type GetSessionInfoRes struct {
List []*VOSessionInfoResult `json:"list"`
Total int `json:"total"`
}
// VOSessionInfoResult 会话内单条结果(工作流/普通对话混排)
type VOSessionInfoResult struct {
Id int64 `json:"id,string" dc:"结果ID"`
Type string `json:"type" dc:"workflow-工作流结果,chat-普通对话结果"`
Status int `json:"status" dc:"1-运行中,2-成功,3-失败"`
FlowId int64 `json:"flowId,string" dc:"工作流IDchat类型为空)"`
RequestParams map[string]any `json:"requestParams" description:"请求参数"`
ResultFileUrl string `json:"resultFileUrl" description:"结果文件路径(供预览/下载)"`
ResultContent string `json:"resultContent" description:"结果文件内容(服务端已读取,前端直接展示)"`
TotalTokens int `json:"totalTokens" dc:"总token消耗"`
TotalFee float64 `json:"totalFee" dc:"总费用"`
ErrorMsg string `json:"errorMsg" dc:"错误信息(友好提示)"`
Error string `json:"error" dc:"错误明细(原始错误)"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
}
type ListWorkflowResultReq struct {
g.Meta `path:"/resultList" method:"get" tags:"会话管理" summary:"工作流执行结果树" dc:"按创建人分页查询工作流执行结果,按天分组返回树结构(日期→流程→结果文件),pageSize=每页天数,不传返回全部"`
Page *beans.Page `json:"page"`
}
type DeleteWorkflowResultReq struct {
g.Meta `path:"/resultDelete" method:"delete" tags:"会话管理" summary:"删除工作流执行结果" dc:"删除工作流执行结果"`
Id int64 `json:"id" v:"required#ID不能为空"`
}