feat: add ChannelID to conversation model and update related services and responses
This commit is contained in:
@@ -99,7 +99,7 @@ func (s *conversationService) getLatestNotFinished(externalInfo openidentity.Ext
|
||||
return s.FindOne(cnd)
|
||||
}
|
||||
|
||||
func (s *conversationService) Create(externalInfo openidentity.ExternalInfo, aiAgentID int64) (*models.Conversation, error) {
|
||||
func (s *conversationService) Create(externalInfo openidentity.ExternalInfo, channelID, aiAgentID int64) (*models.Conversation, error) {
|
||||
subject := s.buildDefaultSubject(externalInfo)
|
||||
|
||||
// 会话存在,直接返回
|
||||
@@ -114,6 +114,7 @@ func (s *conversationService) Create(externalInfo openidentity.ExternalInfo, aiA
|
||||
|
||||
conversation := &models.Conversation{
|
||||
AIAgentID: aiAgentID,
|
||||
ChannelID: channelID,
|
||||
ExternalSource: externalInfo.ExternalSource,
|
||||
Subject: subject,
|
||||
Status: s.resolveInitialStatus(aiAgent.ServiceMode),
|
||||
|
||||
@@ -389,7 +389,7 @@ func (s *wxWorkKFInboundService) ensureConversation(base syncmsg.BaseMessage, pr
|
||||
Desc("id"))
|
||||
|
||||
if conversation == nil {
|
||||
conversation, err = ConversationService.Create(external, channel.AIAgentID)
|
||||
conversation, err = ConversationService.Create(external, channel.ID, channel.AIAgentID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user