diff --git a/internal/biz/chat_history.go b/internal/biz/chat_history.go index 58266e8..c3912a4 100644 --- a/internal/biz/chat_history.go +++ b/internal/biz/chat_history.go @@ -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) { - chats, err := s.chatHiRepo.FindAll( + + con := []impl.CondFunc{ s.chatHiRepo.WithSessionId(query.SessionID), s.chatHiRepo.PaginateScope(query.Page, query.PageSize), 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 { return nil, err diff --git a/internal/entitys/chat_history.go b/internal/entitys/chat_history.go index 019a8c6..b50148e 100644 --- a/internal/entitys/chat_history.go +++ b/internal/entitys/chat_history.go @@ -19,6 +19,7 @@ type ChatHisLog struct { } type ChatHistQuery struct { + HisID int64 `json:"his_id"` SessionID string `json:"session_id"` Page int `json:"page"` PageSize int `json:"page_size"`