Added speaker hinting

This commit is contained in:
Samuele Lorefice
2024-12-26 16:51:18 +01:00
parent 50e5ea6533
commit 0fe19ce04f
2 changed files with 12 additions and 12 deletions

View File

@@ -96,16 +96,16 @@ async Task AnswerChat(long chatId, string input) {
if (!oaiChats.ContainsKey(chatId))
AddChatToDictionary(chatId);
string text = input;
//Limit the message to 1024 characters to avoid out of context jump
string text = input;
if (input.Length > 1024) text = input.Substring(0, 1024);
//Add the current message to the chat
//oaiChats[chatId].Add(new UserChatMessage(text));
ChatMessageRotate(chatId, new UserChatMessage(text));
//fetch existing messages history
//fetch existing messages history, append hint of the speaker to the message:
var messages = oaiChats[chatId];
messages.Add(new AssistantChatMessage("Nemesis: "));
//Fetch the response from the model
var result = chatClient.CompleteChat(messages).Value.Content[0].Text;