commit
9fb6d9fd38
|
|
@ -82,6 +82,7 @@ public class PlotChartFn : IFunctionCallback
|
||||||
MessageId = message.MessageId,
|
MessageId = message.MessageId,
|
||||||
CurrentAgentId = message.CurrentAgentId,
|
CurrentAgentId = message.CurrentAgentId,
|
||||||
Content = obj.ReportSummary,
|
Content = obj.ReportSummary,
|
||||||
|
Indication = "Summarizing",
|
||||||
FunctionName = message.FunctionName,
|
FunctionName = message.FunctionName,
|
||||||
FunctionArgs = message.FunctionArgs,
|
FunctionArgs = message.FunctionArgs,
|
||||||
CreatedAt = DateTime.UtcNow
|
CreatedAt = DateTime.UtcNow
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,14 @@ public class ChatHubConversationHook : ConversationHookBase
|
||||||
|
|
||||||
var conv = _services.GetRequiredService<IConversationService>();
|
var conv = _services.GetRequiredService<IConversationService>();
|
||||||
var state = _services.GetRequiredService<IConversationStateService>();
|
var state = _services.GetRequiredService<IConversationStateService>();
|
||||||
|
|
||||||
|
var sender = new UserDto
|
||||||
|
{
|
||||||
|
FirstName = "AI",
|
||||||
|
LastName = "Assistant",
|
||||||
|
Role = AgentRole.Assistant
|
||||||
|
};
|
||||||
|
|
||||||
var data = new ChatResponseDto()
|
var data = new ChatResponseDto()
|
||||||
{
|
{
|
||||||
ConversationId = conv.ConversationId,
|
ConversationId = conv.ConversationId,
|
||||||
|
|
@ -105,12 +113,7 @@ public class ChatHubConversationHook : ConversationHookBase
|
||||||
Data = message.Data,
|
Data = message.Data,
|
||||||
States = state.GetStates(),
|
States = state.GetStates(),
|
||||||
IsStreaming = message.IsStreaming,
|
IsStreaming = message.IsStreaming,
|
||||||
Sender = new()
|
Sender = sender
|
||||||
{
|
|
||||||
FirstName = "AI",
|
|
||||||
LastName = "Assistant",
|
|
||||||
Role = AgentRole.Assistant
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Send type-off to client
|
// Send type-off to client
|
||||||
|
|
@ -130,6 +133,18 @@ public class ChatHubConversationHook : ConversationHookBase
|
||||||
|
|
||||||
foreach (var item in wrapper.Messages)
|
foreach (var item in wrapper.Messages)
|
||||||
{
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(item.Indication))
|
||||||
|
{
|
||||||
|
data = new ChatResponseDto
|
||||||
|
{
|
||||||
|
ConversationId = conv.ConversationId,
|
||||||
|
MessageId = item.MessageId,
|
||||||
|
Indication = item.Indication,
|
||||||
|
Sender = sender
|
||||||
|
};
|
||||||
|
await SendEvent(ChatEvent.OnIndicationReceived, conv.ConversationId, data);
|
||||||
|
}
|
||||||
|
|
||||||
await Task.Delay(wrapper.SendingInterval);
|
await Task.Delay(wrapper.SendingInterval);
|
||||||
|
|
||||||
data = new ChatResponseDto
|
data = new ChatResponseDto
|
||||||
|
|
@ -142,12 +157,7 @@ public class ChatHubConversationHook : ConversationHookBase
|
||||||
Data = item.Data,
|
Data = item.Data,
|
||||||
States = state.GetStates(),
|
States = state.GetStates(),
|
||||||
IsAppend = true,
|
IsAppend = true,
|
||||||
Sender = new()
|
Sender = sender
|
||||||
{
|
|
||||||
FirstName = "AI",
|
|
||||||
LastName = "Assistant",
|
|
||||||
Role = AgentRole.Assistant
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
await SendEvent(ChatEvent.OnMessageReceivedFromAssistant, conv.ConversationId, data);
|
await SendEvent(ChatEvent.OnMessageReceivedFromAssistant, conv.ConversationId, data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue