feat:会话查询

This commit is contained in:
wolter 2025-12-09 14:25:13 +08:00
parent 2c9874a180
commit 945f3ff4fc
2 changed files with 10 additions and 1 deletions

View File

@ -26,10 +26,18 @@ func NewChatHistoryBiz(chatHiRepo *impl.ChatHisImpl, taskRepo *impl.TaskImpl) *C
// 查询会话历史 // 查询会话历史
func (s *ChatHistoryBiz) List(ctx context.Context, query *entitys.ChatHistQuery) ([]entitys.ChatHisQueryResponse, error) { func (s *ChatHistoryBiz) List(ctx context.Context, query *entitys.ChatHistQuery) ([]entitys.ChatHisQueryResponse, error) {
chats, err := s.chatHiRepo.FindAll(
con := []impl.CondFunc{
s.chatHiRepo.WithSessionId(query.SessionID), s.chatHiRepo.WithSessionId(query.SessionID),
s.chatHiRepo.PaginateScope(query.Page, query.PageSize), s.chatHiRepo.PaginateScope(query.Page, query.PageSize),
s.chatHiRepo.OrderByDesc("his_id"), s.chatHiRepo.OrderByDesc("his_id"),
}
if query.HisID > 0 {
con = append(con, s.chatHiRepo.WithHisId(query.HisID))
}
chats, err := s.chatHiRepo.FindAll(
con...,
) )
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -19,6 +19,7 @@ type ChatHisLog struct {
} }
type ChatHistQuery struct { type ChatHistQuery struct {
HisID int64 `json:"his_id"`
SessionID string `json:"session_id"` SessionID string `json:"session_id"`
Page int `json:"page"` Page int `json:"page"`
PageSize int `json:"page_size"` PageSize int `json:"page_size"`