Merge pull request #698 from yileicn/master · SciSharp/BotSharp@e3da73b · GitHub
Skip to content

Commit e3da73b

Browse files
authored
Merge pull request #698 from yileicn/master
Add a ChannelId column to the ConversationDocument
2 parents 8813403 + f635bbc commit e3da73b

6 files changed

Lines changed: 11 additions & 1 deletion

File tree

‎src/Infrastructure/BotSharp.Abstraction/Conversations/Models/Conversation.cs‎

Lines changed: 5 additions & 0 deletions

‎src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.cs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,12 @@ public async Task<Conversation> GetConversationRecordOrCreateNew(string agentId)
172172
{
173173
var state = _services.GetRequiredService<IConversationStateService>();
174174
var channel = state.GetState("channel");
175+
var channelId = state.GetState("channel_id");
175176
var sess = new Conversation
176177
{
177178
Id = _conversationId,
178179
Channel = channel,
180+
ChannelId = channelId,
179181
AgentId = agentId
180182
};
181183
converation = await NewConversation(sess);

‎src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.Conversation.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public void CreateNewConversation(Conversation conversation)
1010
var utcNow = DateTime.UtcNow;
1111
conversation.CreatedTime = utcNow;
1212
conversation.UpdatedTime = utcNow;
13-
conversation.Tags = conversation.Tags ?? new();
13+
conversation.Tags ??= new();
1414

1515
var dir = Path.Combine(_dbSettings.FileRepository, _conversationSettings.DataDir, conversation.Id);
1616
if (!Directory.Exists(dir))

‎src/Plugins/BotSharp.Plugin.MongoStorage/Collections/ConversationDocument.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ public class ConversationDocument : MongoBase
77
public string? TaskId { get; set; }
88
public string Title { get; set; }
99
public string Channel { get; set; }
10+
public string ChannelId { get; set; }
1011
public string Status { get; set; }
1112
public int DialogCount { get; set; }
1213
public List<string> Tags { get; set; }

‎src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.Conversation.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public void CreateNewConversation(Conversation conversation)
1717
UserId = !string.IsNullOrEmpty(conversation.UserId) ? conversation.UserId : string.Empty,
1818
Title = conversation.Title,
1919
Channel = conversation.Channel,
20+
ChannelId = conversation.ChannelId,
2021
TaskId = conversation.TaskId,
2122
Status = conversation.Status,
2223
Tags = conversation.Tags ?? new(),

‎src/Plugins/BotSharp.Plugin.Twilio/Services/TwilioMessageQueueService.cs‎

Lines changed: 1 addition & 0 deletions

0 commit comments

Comments
 (0)