access public properties directly
This commit is contained in:
parent
1e974441ff
commit
4489683eeb
|
|
@ -15,45 +15,45 @@ public class EvaluationConversationHook : ConversationHookBase
|
|||
|
||||
public override Task OnMessageReceived(RoleDialogModel message)
|
||||
{
|
||||
if (_conversation != null && _convSettings.EnableExecutionLog)
|
||||
if (Conversation != null && _convSettings.EnableExecutionLog)
|
||||
{
|
||||
_logger.Append(_conversation.Id, $"[{DateTime.Now}] {message.Role}: {message.Content}");
|
||||
_logger.Append(Conversation.Id, $"[{DateTime.Now}] {message.Role}: {message.Content}");
|
||||
}
|
||||
return base.OnMessageReceived(message);
|
||||
}
|
||||
|
||||
public override Task OnFunctionExecuted(RoleDialogModel message)
|
||||
{
|
||||
if (_conversation != null && _convSettings.EnableExecutionLog)
|
||||
if (Conversation != null && _convSettings.EnableExecutionLog)
|
||||
{
|
||||
_logger.Append(_conversation.Id, $"[{DateTime.Now}] {message.Role}: {message.FunctionName}({message.FunctionArgs}) => {message.Content}");
|
||||
_logger.Append(Conversation.Id, $"[{DateTime.Now}] {message.Role}: {message.FunctionName}({message.FunctionArgs}) => {message.Content}");
|
||||
}
|
||||
return base.OnFunctionExecuted(message);
|
||||
}
|
||||
|
||||
public override Task OnResponseGenerated(RoleDialogModel message)
|
||||
{
|
||||
if (_conversation != null && _convSettings.EnableExecutionLog)
|
||||
if (Conversation != null && _convSettings.EnableExecutionLog)
|
||||
{
|
||||
_logger.Append(_conversation.Id, $"[{DateTime.Now}] {message.Role}: {message.Content}");
|
||||
}
|
||||
_logger.Append(Conversation.Id, $"[{DateTime.Now}] {message.Role}: {message.Content}");
|
||||
}
|
||||
return base.OnResponseGenerated(message);
|
||||
}
|
||||
|
||||
public override Task OnHumanInterventionNeeded(RoleDialogModel message)
|
||||
{
|
||||
if (_conversation != null && _convSettings.EnableExecutionLog)
|
||||
if (Conversation != null && _convSettings.EnableExecutionLog)
|
||||
{
|
||||
_logger.Append(_conversation.Id, $"[{DateTime.Now}] {AgentRole.Function}: trigger_event({{\"event\": \"{message.FunctionName}\"}})");
|
||||
_logger.Append(Conversation.Id, $"[{DateTime.Now}] {AgentRole.Function}: trigger_event({{\"event\": \"{message.FunctionName}\"}})");
|
||||
}
|
||||
return base.OnHumanInterventionNeeded(message);
|
||||
}
|
||||
|
||||
public override Task OnConversationEnding(RoleDialogModel message)
|
||||
{
|
||||
if (_conversation != null && _convSettings.EnableExecutionLog)
|
||||
if (Conversation != null && _convSettings.EnableExecutionLog)
|
||||
{
|
||||
_logger.Append(_conversation.Id, $"[{DateTime.Now}] {AgentRole.Function}: trigger_event({{\"event\": \"{message.FunctionName}\"}})");
|
||||
_logger.Append(Conversation.Id, $"[{DateTime.Now}] {AgentRole.Function}: trigger_event({{\"event\": \"{message.FunctionName}\"}})");
|
||||
}
|
||||
return base.OnConversationEnding(message);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class RateLimitConversationHook : ConversationHookBase
|
|||
}
|
||||
|
||||
// Check message sending frequency
|
||||
var userSents = _dialogs.Where(x => x.Role == AgentRole.User)
|
||||
var userSents = Dialogs.Where(x => x.Role == AgentRole.User)
|
||||
.TakeLast(2).ToList();
|
||||
|
||||
if (userSents.Count > 1)
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class RoutingConversationHook: ConversationHookBase
|
|||
|
||||
// Render by template
|
||||
var templateService = _services.GetRequiredService<IResponseTemplateService>();
|
||||
var response = await templateService.RenderIntentResponse(_agent.Id, message);
|
||||
var response = await templateService.RenderIntentResponse(Agent.Id, message);
|
||||
|
||||
if (!string.IsNullOrEmpty(response))
|
||||
{
|
||||
|
|
@ -54,7 +54,7 @@ public class RoutingConversationHook: ConversationHookBase
|
|||
public override async Task OnResponseGenerated(RoleDialogModel message)
|
||||
{
|
||||
var routerSettings = _services.GetRequiredService<RoutingSettings>();
|
||||
bool saveFlag = _agent.Type != AgentType.Routing;
|
||||
bool saveFlag = Agent.Type != AgentType.Routing;
|
||||
|
||||
if (saveFlag)
|
||||
{
|
||||
|
|
@ -63,7 +63,7 @@ public class RoutingConversationHook: ConversationHookBase
|
|||
var rootDataPath = agentService.GetDataDir();
|
||||
|
||||
string rawDataDir = Path.Combine(rootDataPath, "raw_data", $"agent.{message.CurrentAgentId}.txt");
|
||||
var lastThreeDialogs = _dialogs.Where(x => x.Role == AgentRole.User || x.Role == AgentRole.Assistant)
|
||||
var lastThreeDialogs = Dialogs.Where(x => x.Role == AgentRole.User || x.Role == AgentRole.Assistant)
|
||||
.Select(x => x.Content.Replace('\r', ' ').Replace('\n', ' '))
|
||||
.TakeLast(3)
|
||||
.ToArray();
|
||||
|
|
|
|||
Loading…
Reference in a new issue