Merge pull request #433 from iceljc/features/sync-function-indication

add chat indication
This commit is contained in:
C. Oceania 2024-05-01 10:47:52 -05:00 committed by GitHub
commit 2574523844
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 0 deletions

View file

@ -6,6 +6,10 @@ public class ConversationSenderActionModel
{
[JsonPropertyName("conversation_id")]
public string ConversationId { get; set; }
[JsonPropertyName("sender_action")]
public SenderActionEnum SenderAction { get; set; }
[JsonPropertyName("indication")]
public string? Indication { get; set; }
}

View file

@ -59,6 +59,20 @@ public class ChatHubConversationHook : ConversationHookBase
await base.OnMessageReceived(message);
}
public override async Task OnFunctionExecuting(RoleDialogModel message)
{
var conv = _services.GetRequiredService<IConversationService>();
await _chatHub.Clients.User(_user.Id).SendAsync("OnSenderActionGenerated", new ConversationSenderActionModel
{
ConversationId = conv.ConversationId,
SenderAction = SenderActionEnum.TypingOn,
Indication = message.Indication
});
await base.OnFunctionExecuting(message);
}
public override async Task OnPostbackMessageReceived(RoleDialogModel message, PostbackMessageModel replyMsg)
{
await this.OnMessageReceived(message);