Browse Source

Merge branch 'master' into yhg_240730

jimmyyem 3 months ago
parent
commit
96a4e0d18e

+ 9 - 5
crontask/send_wx_on_timeout.go

@@ -28,7 +28,10 @@ func (l *CronTask) sendWxOnTimeout() {
 		sopTasks = append(sopTasks, st.ID)
 	}
 	sopStages, _ := l.svcCtx.DB.SopStage.Query().Where(sopstage.TaskIDIn(sopTasks...), sopstage.DeletedAtIsNil()).All(l.ctx)
-
+	stageMap := make(map[uint64]*ent.SopStage)
+	for _, stage := range sopStages {
+		stageMap[stage.ID] = stage
+	}
 	// 查询所有 no_reply_condition 值非 0  的 sop_node 记录
 	nodes, err := l.svcCtx.DB.SopNode.Query().
 		Where(sopnode.NoReplyConditionNEQ(0)).
@@ -174,7 +177,7 @@ func (l *CronTask) sendWxOnTimeout() {
 					Wxid:   s.ContactWxid,
 				}
 				if node.ActionLabelAdd != nil || node.ActionLabelDel != nil {
-					_ = l.AddLabelRelationships(sopStages, *contact, currentLabelIds, node.ActionLabelAdd, node.ActionLabelDel, s.OrganizationID)
+					_ = l.AddLabelRelationships(stageMap, *contact, currentLabelIds, node.ActionLabelAdd, node.ActionLabelDel, s.OrganizationID)
 				}
 			}
 		}
@@ -193,7 +196,7 @@ func splitString(input string) []string {
 	return re.Split(input, -1)
 }
 
-func (l *CronTask) AddLabelRelationships(sopStages []*ent.SopStage, contact ent.Contact, currentLabelIds []uint64, addLabelIds []uint64, delLabelIds []uint64, organizationId uint64) (err error) {
+func (l *CronTask) AddLabelRelationships(sopStages map[uint64]*ent.SopStage, contact ent.Contact, currentLabelIds []uint64, addLabelIds []uint64, delLabelIds []uint64, organizationId uint64) (err error) {
 	//// 开始事务
 	//tx, err := l.svcCtx.DB.Tx(context.Background())
 	//if err != nil {
@@ -268,8 +271,8 @@ func (l *CronTask) AddLabelRelationships(sopStages []*ent.SopStage, contact ent.
 		finalLabelIds = append(finalLabelIds, id)
 	}
 	// 遍历 sop_stages,找出满足条件的 stage
-	for _, stage := range sopStages {
-		if stage.ConditionType == 1 && isLabelIdListMatchFilter(finalLabelIds, stage.ConditionOperator, stage.ConditionList) {
+	for key, stage := range sopStages {
+		if stage != nil && stage.ConditionType == 1 && isLabelIdListMatchFilter(finalLabelIds, stage.ConditionOperator, stage.ConditionList) {
 			// 判断是否有 contact_wxid、source_type、source_id、sub_source_id 相同的记录
 			_, err := l.svcCtx.DB.MessageRecords.Query().
 				Where(
@@ -340,6 +343,7 @@ func (l *CronTask) AddLabelRelationships(sopStages []*ent.SopStage, contact ent.
 
 			if stage.ActionLabelAdd != nil || stage.ActionLabelDel != nil {
 				// 递归调用 AddLabelRelationships
+				sopStages[key] = nil
 				err = l.AddLabelRelationships(sopStages, contact, finalLabelIds, stage.ActionLabelAdd, stage.ActionLabelDel, organizationId)
 				if err != nil {
 					//_ = tx.Rollback()

+ 3 - 0
desc/wechat/agent.api

@@ -56,6 +56,9 @@ type (
 
 		// status | 状态 1-可用 2-不可用
 		Status  *int `json:"status,optional"`
+
+		// 租户id
+        OrganizationId  *uint64 `json:"organizationId,optional"`
     }
 
     // Agent information response | Agent信息返回体

+ 3 - 0
desc/wechat/chat_records.api

@@ -11,6 +11,9 @@ type (
         // 内容类型:1-提问 2-回答 
         ContentType  *uint8 `json:"contentType,optional"`
 
+        // 角色类型:1-用户 2-智能体
+        RoleType  *string `json:"roleType,optional"`
+
         // 会话ID 
         SessionId  *uint64 `json:"sessionId,optional"`
 

+ 8 - 0
desc/wechat/chat_session.api

@@ -11,11 +11,19 @@ type (
         // 用户ID 
         UserId  *uint64 `json:"userId,optional"`
 
+        UserName  *string `json:"userName,optional"`
+
         // 聊天ID 
         BotId  *uint64 `json:"botId,optional"`
 
+        // 主体名称
+        BotName  *string `json:"botName,optional"`
+
         // 类型:1-微信 2-小程序card 3-智能体 
         BotType  *uint8 `json:"botType,optional"`
+
+        // 类型:1-微信 2-小程序card 3-智能体
+        BotTypeStr  *string `json:"botTypeStr,optional"`
     }
 
     // The response data of chat session list | ChatSession列表数据

+ 3 - 1
desc/wechat/wx_card.api

@@ -48,7 +48,7 @@ type (
         // 个人介绍 
         Intro  *string `json:"intro,optional"`
 	
-		ShowChat *bool `json:"showChat,optioal"`
+		ShowChat *bool `json:"showChat,optional"`
 		ShowAi *bool `json:"showAi,optional"`
 		IsVip *bool `json:"isVip,optional"`
     }
@@ -60,6 +60,8 @@ type (
 
 		// 名称
 		Name  *string `json:"name,optional"`
+
+		Type *string `json:"type,optional"`
 	}
 
     // The response data of wx card list | WxCard列表数据

+ 3 - 0
desc/wechat/wx_card_user.api

@@ -64,6 +64,9 @@ type (
 
         // 头像 
         Avatar  *string `json:"avatar,optional"`
+
+        // 昵称
+        Nickname  *string `json:"nickname,optional"`
     }
 
     // WxCardUser information response | WxCardUser信息返回体

+ 10 - 1
desc/wechat/wx_card_visit.api

@@ -9,12 +9,18 @@ type (
         // user表ID 
         UserId  *uint64 `json:"userId,optional"`
 
+        // user名
+        UserName  *string `json:"userName,optional"`
+
         // 被访ID 
         BotId  *uint64 `json:"botId,optional"`
 
-        // 类型:1-微信 2-小程序 3-智能体 
+        // 类型:1-微信 2-小程序 3-智能体
         BotType  *uint8 `json:"botType,optional"`
 
+        // 类型:1-微信 2-小程序 3-智能体
+        BotTypeStr  *string `json:"botTypeStr,optional"`
+
 		CardInfo WxCardSimpleInfo `json:"cardInfo,optional,omitempty"`
     }
 
@@ -65,6 +71,9 @@ type (
     // Get wx card visit list request params | WxCardVisit列表请求参数
     WxCardVisitListReq {
         PageInfo
+        BotId  *uint64 `json:"botId,optional"`
+        BotType  *uint8 `json:"botType,optional"`
+        BotName *string `json:"botName,optional"`
     }
 
     // WxCardVisit information response | WxCardVisit信息返回体

+ 11 - 2
internal/logic/agent/get_agent_list_logic.go

@@ -30,9 +30,18 @@ func NewGetAgentListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetA
 }
 
 func (l *GetAgentListLogic) GetAgentList(req *types.AgentListReq) (*types.AgentListResp, error) {
-	organizationId := l.ctx.Value("organizationId").(uint64)
+	orgId := l.ctx.Value("organizationId").(uint64)
 	var predicates []predicate.Agent
-	predicates = append(predicates, agent.OrganizationID(organizationId))
+	if req.OrganizationId != nil && *req.OrganizationId != 0 {
+		isAdmin := l.ctx.Value("isAdmin").(bool)
+		if isAdmin {
+			predicates = append(predicates, agent.OrganizationIDEQ(*req.OrganizationId))
+		} else {
+			predicates = append(predicates, agent.OrganizationIDEQ(orgId))
+		}
+	} else {
+		predicates = append(predicates, agent.OrganizationID(orgId))
+	}
 	if req.Name != nil {
 		predicates = append(predicates, agent.NameContains(*req.Name))
 	}

+ 9 - 1
internal/logic/chatrecords/get_chat_records_list_logic.go

@@ -5,6 +5,7 @@ import (
 	"github.com/suyuan32/simple-admin-common/msg/errormsg"
 	"github.com/suyuan32/simple-admin-common/utils/pointy"
 	"github.com/zeromicro/go-zero/core/errorx"
+	"wechat-api/ent"
 	"wechat-api/ent/chatrecords"
 	"wechat-api/ent/predicate"
 	"wechat-api/internal/utils/dberrorhandler"
@@ -42,7 +43,7 @@ func (l *GetChatRecordsListLogic) GetChatRecordsList(req *types.ChatRecordsListR
 		predicates = append(predicates, chatrecords.BotType(*req.BotType))
 	}
 
-	data, err := l.svcCtx.DB.ChatRecords.Query().Where(predicates...).Page(l.ctx, req.Page, req.PageSize)
+	data, err := l.svcCtx.DB.ChatRecords.Query().Where(predicates...).Order(ent.Asc("created_at")).Page(l.ctx, req.Page, req.PageSize)
 
 	if err != nil {
 		return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
@@ -53,6 +54,12 @@ func (l *GetChatRecordsListLogic) GetChatRecordsList(req *types.ChatRecordsListR
 	resp.Data.Total = data.PageDetails.Total
 
 	for _, v := range data.List {
+		roleType := ""
+		if v.ContentType == 1 {
+			roleType = "用户"
+		} else if v.ContentType == 2 {
+			roleType = "智能体"
+		}
 		resp.Data.Data = append(resp.Data.Data,
 			types.ChatRecordsInfo{
 				BaseIDInfo: types.BaseIDInfo{
@@ -62,6 +69,7 @@ func (l *GetChatRecordsListLogic) GetChatRecordsList(req *types.ChatRecordsListR
 				},
 				Content:     &v.Content,
 				ContentType: &v.ContentType,
+				RoleType:    &roleType,
 				SessionId:   &v.SessionID,
 				UserId:      &v.UserID,
 				BotId:       &v.BotID,

+ 31 - 4
internal/logic/chatsession/get_chat_session_list_logic.go

@@ -2,10 +2,14 @@ package chatsession
 
 import (
 	"context"
+	"fmt"
 	"github.com/suyuan32/simple-admin-common/msg/errormsg"
 	"github.com/suyuan32/simple-admin-common/utils/pointy"
 	"wechat-api/ent/chatsession"
+	"wechat-api/ent/employee"
 	"wechat-api/ent/predicate"
+	"wechat-api/ent/wxcard"
+	"wechat-api/ent/wxcarduser"
 	"wechat-api/internal/utils/dberrorhandler"
 
 	"wechat-api/internal/svc"
@@ -91,6 +95,26 @@ func (l *GetChatSessionListLogic) GetChatSessionList(req *types.ChatSessionListR
 	resp.Data.Total = data.PageDetails.Total
 
 	for _, v := range data.List {
+		botType := ""
+		botName := ""
+		userName := ""
+		if v.BotType == 1 {
+			botType = "微信"
+		} else if v.BotType == 2 {
+			botType = "名片"
+			cardInfo, _ := l.svcCtx.DB.WxCard.Query().Where(wxcard.ID(v.BotID)).First(l.ctx)
+			botName = cardInfo.Name
+		} else if v.BotType == 3 {
+			botType = "数字员工"
+			employeeInfo, _ := l.svcCtx.DB.Employee.Query().Where(employee.ID(v.BotID)).First(l.ctx)
+			botName = employeeInfo.Title
+		}
+		userInfo, _ := l.svcCtx.DB.WxCardUser.Query().Where(wxcarduser.ID(v.UserID)).First(l.ctx)
+		if userInfo != nil {
+			userName = userInfo.Nickname
+		} else {
+			userName = fmt.Sprintf("用户_%d", v.UserID)
+		}
 		resp.Data.Data = append(resp.Data.Data,
 			types.ChatSessionInfo{
 				BaseIDInfo: types.BaseIDInfo{
@@ -98,10 +122,13 @@ func (l *GetChatSessionListLogic) GetChatSessionList(req *types.ChatSessionListR
 					CreatedAt: pointy.GetPointer(v.CreatedAt.UnixMilli()),
 					UpdatedAt: pointy.GetPointer(v.UpdatedAt.UnixMilli()),
 				},
-				Name:    &v.Name,
-				UserId:  &v.UserID,
-				BotId:   &v.BotID,
-				BotType: &v.BotType,
+				Name:       &v.Name,
+				UserId:     &v.UserID,
+				UserName:   &userName,
+				BotId:      &v.BotID,
+				BotName:    &botName,
+				BotType:    &v.BotType,
+				BotTypeStr: &botType,
 			})
 	}
 

+ 10 - 6
internal/logic/label_relationship/update_label_relationships_logic.go

@@ -104,21 +104,24 @@ func (l *UpdateLabelRelationshipsLogic) UpdateLabelRelationships(req *types.Labe
 	}
 
 	// 获取所有 filteredSopTasks 的 sop_stages
-	var sopStages []*ent.SopStage
+	stageMap := make(map[uint64]*ent.SopStage)
 	for _, task := range filteredSopTasks {
 		stages, err := task.QueryTaskStages().All(l.ctx)
 		if err != nil {
 			_ = tx.Rollback()
 			return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
 		}
-		sopStages = append(sopStages, stages...)
+		for _, stage := range stages {
+			stageMap[stage.ID] = stage
+		}
+		//sopStages = append(sopStages, stages...)
 	}
 	// 所有操作成功,提交事务
 	err = tx.Commit()
 	if err != nil {
 		return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
 	}
-	err = l.AddLabelRelationships(sopStages, *c, req.LabelIds, organizationId)
+	err = l.AddLabelRelationships(stageMap, *c, req.LabelIds, organizationId)
 
 	if err != nil {
 		return nil, err
@@ -127,10 +130,10 @@ func (l *UpdateLabelRelationshipsLogic) UpdateLabelRelationships(req *types.Labe
 	return &types.BaseMsgResp{Msg: errormsg.UpdateSuccess}, nil
 }
 
-func (l *UpdateLabelRelationshipsLogic) AddLabelRelationships(sopStages []*ent.SopStage, contact ent.Contact, currentLabelIds []uint64, organizationId uint64) (err error) {
+func (l *UpdateLabelRelationshipsLogic) AddLabelRelationships(sopStages map[uint64]*ent.SopStage, contact ent.Contact, currentLabelIds []uint64, organizationId uint64) (err error) {
 	// 遍历 sop_stages,找出满足条件的 stage
-	for _, stage := range sopStages {
-		if stage.ConditionType == 1 && isLabelIdListMatchFilter(currentLabelIds, stage.ConditionOperator, stage.ConditionList) {
+	for key, stage := range sopStages {
+		if stage != nil && stage.ConditionType == 1 && isLabelIdListMatchFilter(currentLabelIds, stage.ConditionOperator, stage.ConditionList) {
 			// 开始事务
 			tx, err := l.svcCtx.DB.Tx(context.Background())
 			if err != nil {
@@ -285,6 +288,7 @@ func (l *UpdateLabelRelationshipsLogic) AddLabelRelationships(sopStages []*ent.S
 				}
 
 				// 递归调用 AddLabelRelationships
+				sopStages[key] = nil
 				err = l.AddLabelRelationships(sopStages, contact, finalLabelIds, organizationId)
 				if err != nil {
 					return err

+ 1 - 1
internal/logic/message_records/get_message_records_list_logic.go

@@ -68,7 +68,7 @@ func (l *GetMessageRecordsListLogic) GetMessageRecordsList(req *types.MessageRec
 				Status:      &v.Status,
 				BotWxid:     &v.BotWxid,
 				ContactWxid: &v.ContactWxid,
-				ContentType: &v.ContentType,
+				ContactType: &v.ContactType,
 				Content:     &v.Content,
 				ErrorDetail: &v.ErrorDetail,
 				SendTime:    pointy.GetUnixMilliPointer(v.SendTime.UnixMilli()),

+ 9 - 5
internal/logic/sop_task/publish_sop_task_logic.go

@@ -80,7 +80,10 @@ func (l *PublishSopTaskLogic) PublishSopTask(req *types.IDReq) (resp *types.Base
 			//_ = tx.Rollback()
 			return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
 		}
-
+		stageMap := make(map[uint64]*ent.SopStage)
+		for _, stage := range sopStages {
+			stageMap[stage.ID] = stage
+		}
 		// 遍历 stage
 		for _, stage := range sopTask.Edges.TaskStages {
 			if stage.ConditionType == 1 {
@@ -187,7 +190,7 @@ func (l *PublishSopTaskLogic) PublishSopTask(req *types.IDReq) (resp *types.Base
 
 						if stage.ActionLabelAdd != nil || stage.ActionLabelDel != nil {
 							// 递归调用 AddLabelRelationships
-							err = l.AddLabelRelationships(sopStages, *c, currentLabelIds, stage.ActionLabelAdd, stage.ActionLabelDel, organizationId)
+							err = l.AddLabelRelationships(stageMap, *c, currentLabelIds, stage.ActionLabelAdd, stage.ActionLabelDel, organizationId)
 							if err != nil {
 								//_ = tx.Rollback()
 								return nil, err
@@ -214,7 +217,7 @@ func (l *PublishSopTaskLogic) PublishSopTask(req *types.IDReq) (resp *types.Base
 	}
 }
 
-func (l *PublishSopTaskLogic) AddLabelRelationships(sopStages []*ent.SopStage, contact ent.Contact, currentLabelIds []uint64, addLabelIds []uint64, delLabelIds []uint64, organizationId uint64) (err error) {
+func (l *PublishSopTaskLogic) AddLabelRelationships(sopStages map[uint64]*ent.SopStage, contact ent.Contact, currentLabelIds []uint64, addLabelIds []uint64, delLabelIds []uint64, organizationId uint64) (err error) {
 	//// 开始事务
 	//tx, err := l.svcCtx.DB.Tx(context.Background())
 	//if err != nil {
@@ -293,8 +296,8 @@ func (l *PublishSopTaskLogic) AddLabelRelationships(sopStages []*ent.SopStage, c
 	}
 
 	// 遍历 sop_stages,找出满足条件的 stage
-	for _, stage := range sopStages {
-		if stage.ConditionType == 1 && isLabelIdListMatchFilter(finalLabelIds, stage.ConditionOperator, stage.ConditionList) {
+	for key, stage := range sopStages {
+		if stage != nil && stage.ConditionType == 1 && isLabelIdListMatchFilter(finalLabelIds, stage.ConditionOperator, stage.ConditionList) {
 			// 判断是否有 contact_wxid、source_type、source_id、sub_source_id 相同的记录
 			_, err := l.svcCtx.DB.MessageRecords.Query().
 				Where(
@@ -365,6 +368,7 @@ func (l *PublishSopTaskLogic) AddLabelRelationships(sopStages []*ent.SopStage, c
 
 			if stage.ActionLabelAdd != nil || stage.ActionLabelDel != nil {
 				// 递归调用 AddLabelRelationships
+				sopStages[key] = nil
 				err = l.AddLabelRelationships(sopStages, contact, finalLabelIds, stage.ActionLabelAdd, stage.ActionLabelDel, organizationId)
 				if err != nil {
 					//_ = tx.Rollback()

+ 3 - 0
internal/logic/wxcarduser/get_wx_card_user_list_logic.go

@@ -36,6 +36,9 @@ func (l *GetWxCardUserListLogic) GetWxCardUserList(req *types.WxCardUserListReq)
 	if req.Account != nil && *req.Account != "" {
 		predicates = append(predicates, wxcarduser.AccountContains(*req.Account))
 	}
+	if req.Nickname != nil && *req.Nickname != "" {
+		predicates = append(predicates, wxcarduser.NicknameContains(*req.Nickname))
+	}
 
 	data, err := l.svcCtx.DB.WxCardUser.Query().Where(predicates...).Page(l.ctx, req.Page, req.PageSize)
 	if err != nil {

+ 30 - 5
internal/logic/wxcardvisit/get_wx_card_visit_list_logic.go

@@ -2,12 +2,16 @@ package wxcardvisit
 
 import (
 	"context"
+	"fmt"
 	"github.com/alibabacloud-go/tea/tea"
 	"github.com/suyuan32/simple-admin-common/msg/errormsg"
 	"github.com/suyuan32/simple-admin-common/utils/pointy"
 	"wechat-api/ent"
-	"wechat-api/ent/agent"
+	"wechat-api/ent/employee"
+	"wechat-api/ent/predicate"
 	"wechat-api/ent/wxcard"
+	"wechat-api/ent/wxcarduser"
+	"wechat-api/ent/wxcardvisit"
 	"wechat-api/internal/utils/dberrorhandler"
 
 	"wechat-api/internal/svc"
@@ -30,7 +34,15 @@ func NewGetWxCardVisitListLogic(ctx context.Context, svcCtx *svc.ServiceContext)
 }
 
 func (l *GetWxCardVisitListLogic) GetWxCardVisitList(req *types.WxCardVisitListReq) (*types.WxCardVisitListResp, error) {
-	data, err := l.svcCtx.DB.WxCardVisit.Query().Page(l.ctx, req.Page, req.PageSize)
+	var predicates []predicate.WxCardVisit
+	if req.BotType != nil && *req.BotType > 0 {
+		predicates = append(predicates, wxcardvisit.BotType(*req.BotType))
+	}
+
+	if req.BotId != nil && *req.BotId > 0 {
+		predicates = append(predicates, wxcardvisit.BotID(*req.BotId))
+	}
+	data, err := l.svcCtx.DB.WxCardVisit.Query().Where(predicates...).Page(l.ctx, req.Page, req.PageSize)
 
 	if err != nil {
 		return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
@@ -42,7 +54,7 @@ func (l *GetWxCardVisitListLogic) GetWxCardVisitList(req *types.WxCardVisitListR
 
 	wxIds, cardIds, agentIds := make([]uint64, 0), make([]uint64, 0), make([]uint64, 0)
 	wxCardList := make(map[uint64]*ent.WxCard)
-	wxAgentList := make(map[uint64]*ent.Agent)
+	wxAgentList := make(map[uint64]*ent.Employee)
 	for _, v := range data.List {
 		if v.BotType == 1 {
 			wxIds = append(wxIds, v.BotID)
@@ -59,7 +71,7 @@ func (l *GetWxCardVisitListLogic) GetWxCardVisitList(req *types.WxCardVisitListR
 		}
 	}
 	if len(agentIds) > 0 {
-		agentList, _ := l.svcCtx.DB.Agent.Query().Where(agent.IDIn(agentIds...)).All(l.ctx)
+		agentList, _ := l.svcCtx.DB.Employee.Query().Where(employee.IDIn(agentIds...)).All(l.ctx)
 		for _, val := range agentList {
 			wxAgentList[val.ID] = val
 		}
@@ -67,19 +79,31 @@ func (l *GetWxCardVisitListLogic) GetWxCardVisitList(req *types.WxCardVisitListR
 
 	for _, v := range data.List {
 		cardInfo := types.WxCardSimpleInfo{}
+		botType := ""
 		if v.BotType == 1 {
 
 		} else if v.BotType == 2 {
 			if card, ok := wxCardList[v.BotID]; ok {
 				cardInfo.Name = &card.Name
 				cardInfo.Avatar = &card.Avatar
+				botType = "名片"
+				cardInfo.Type = &botType
 			}
 		} else {
 			if agentItem, ok := wxAgentList[v.BotID]; ok {
-				cardInfo.Name = &agentItem.Name
+				cardInfo.Name = &agentItem.Title
 				cardInfo.Avatar = tea.String("")
+				botType = "数字员工"
+				cardInfo.Type = &botType
 			}
 		}
+		userName := ""
+		userInfo, _ := l.svcCtx.DB.WxCardUser.Query().Where(wxcarduser.ID(v.UserID)).First(l.ctx)
+		if userInfo != nil {
+			userName = userInfo.Nickname
+		} else {
+			userName = fmt.Sprintf("用户_%d", v.UserID)
+		}
 		resp.Data.Data = append(resp.Data.Data,
 			types.WxCardVisitInfo{
 				BaseIDInfo: types.BaseIDInfo{
@@ -88,6 +112,7 @@ func (l *GetWxCardVisitListLogic) GetWxCardVisitList(req *types.WxCardVisitListR
 					UpdatedAt: pointy.GetPointer(v.UpdatedAt.UnixMilli()),
 				},
 				UserId:   &v.UserID,
+				UserName: &userName,
 				BotId:    &v.BotID,
 				BotType:  &v.BotType,
 				CardInfo: cardInfo,

+ 23 - 4
internal/types/types.go

@@ -471,6 +471,8 @@ type AgentListReq struct {
 	Background *string `json:"background,optional"`
 	// status | 状态 1-可用 2-不可用
 	Status *int `json:"status,optional"`
+	// 租户id
+	OrganizationId *uint64 `json:"organizationId,optional"`
 }
 
 // Agent information response | Agent信息返回体
@@ -2253,6 +2255,8 @@ type ChatRecordsInfo struct {
 	Content *string `json:"content,optional"`
 	// 内容类型:1-提问 2-回答
 	ContentType *uint8 `json:"contentType,optional"`
+	// 角色类型:1-用户 2-智能体
+	RoleType *string `json:"roleType,optional"`
 	// 会话ID
 	SessionId *uint64 `json:"sessionId,optional"`
 	// 用户ID
@@ -2334,11 +2338,16 @@ type ChatSessionInfo struct {
 	// 名称
 	Name *string `json:"name,optional"`
 	// 用户ID
-	UserId *uint64 `json:"userId,optional"`
+	UserId   *uint64 `json:"userId,optional"`
+	UserName *string `json:"userName,optional"`
 	// 聊天ID
 	BotId *uint64 `json:"botId,optional"`
+	// 主体名称
+	BotName *string `json:"botName,optional"`
 	// 类型:1-微信 2-小程序card 3-智能体
 	BotType *uint8 `json:"botType,optional"`
+	// 类型:1-微信 2-小程序card 3-智能体
+	BotTypeStr *string `json:"botTypeStr,optional"`
 }
 
 // The response data of chat session list | ChatSession列表数据
@@ -2407,7 +2416,7 @@ type WxCardInfo struct {
 	AiInfo *string `json:"aiInfo,optional"`
 	// 个人介绍
 	Intro    *string `json:"intro,optional"`
-	ShowChat *bool   `json:"showChat,optioal"`
+	ShowChat *bool   `json:"showChat,optional"`
 	ShowAi   *bool   `json:"showAi,optional"`
 	IsVip    *bool   `json:"isVip,optional"`
 }
@@ -2419,6 +2428,7 @@ type WxCardSimpleInfo struct {
 	Avatar *string `json:"avatar,optional"`
 	// 名称
 	Name *string `json:"name,optional"`
+	Type *string `json:"type,optional"`
 }
 
 // The response data of wx card list | WxCard列表数据
@@ -2516,6 +2526,8 @@ type WxCardUserListReq struct {
 	Account *string `json:"account,optional"`
 	// 头像
 	Avatar *string `json:"avatar,optional"`
+	// 昵称
+	Nickname *string `json:"nickname,optional"`
 }
 
 // WxCardUser information response | WxCardUser信息返回体
@@ -2532,11 +2544,15 @@ type WxCardVisitInfo struct {
 	BaseIDInfo
 	// user表ID
 	UserId *uint64 `json:"userId,optional"`
+	// user名
+	UserName *string `json:"userName,optional"`
 	// 被访ID
 	BotId *uint64 `json:"botId,optional"`
 	// 类型:1-微信 2-小程序 3-智能体
-	BotType  *uint8           `json:"botType,optional"`
-	CardInfo WxCardSimpleInfo `json:"cardInfo,optional,omitempty"`
+	BotType *uint8 `json:"botType,optional"`
+	// 类型:1-微信 2-小程序 3-智能体
+	BotTypeStr *string          `json:"botTypeStr,optional"`
+	CardInfo   WxCardSimpleInfo `json:"cardInfo,optional,omitempty"`
 }
 
 // swagger:model WxCardVisitReq
@@ -2582,6 +2598,9 @@ type WxCardVisitListInfo struct {
 // swagger:model WxCardVisitListReq
 type WxCardVisitListReq struct {
 	PageInfo
+	BotId   *uint64 `json:"botId,optional"`
+	BotType *uint8  `json:"botType,optional"`
+	BotName *string `json:"botName,optional"`
 }
 
 // WxCardVisit information response | WxCardVisit信息返回体