feat:会话查询
This commit is contained in:
parent
2c9874a180
commit
945f3ff4fc
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"`
|
||||
|
|
|
|||
Loading…
Reference in New Issue