Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,13 @@ public static RoleDialogModel From(RoleDialogModel source,
MetaData = source.MetaData != null ? new(source.MetaData) : null
};
}

public void ClearMessage()
{
this.Payload = null;
this.Content = string.Empty;
this.RichContent = null;
this.SecondaryContent = null;
this.SecondaryRichContent = null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public override async Task OnMessageReceived(RoleDialogModel message)
if (charCount > rateLimit.MaxInputLengthPerRequest)
{
await storage.Append(convId, message);
message.ClearMessage();
message.Content = $"The number of characters in your message exceeds the system maximum of {rateLimit.MaxInputLengthPerRequest}";
message.StopCompletion = true;
ClearMessage(message);
return;
}

Expand All @@ -55,9 +55,9 @@ public override async Task OnMessageReceived(RoleDialogModel message)
if (seconds < rateLimit.MinTimeSecondsBetweenMessages)
{
await storage.Append(convId, message);
message.ClearMessage();
message.Content = "Your message sending frequency exceeds the frequency specified by the system. Please try again later.";
message.StopCompletion = true;
ClearMessage(message);
return;
}
}
Expand All @@ -76,18 +76,11 @@ public override async Task OnMessageReceived(RoleDialogModel message)
if (results.Count > rateLimit.MaxConversationPerDay)
{
await storage.Append(convId, message);
message.ClearMessage();
message.Content = $"The number of conversations you have exceeds the system maximum of {rateLimit.MaxConversationPerDay}";
message.StopCompletion = true;
ClearMessage(message);
return;
}
}
}

private void ClearMessage(RoleDialogModel message)
{
message.SecondaryContent = null;
message.RichContent = null;
message.SecondaryRichContent = null;
}
}
Loading