From bcf0906963bcfb9c6422cc180e4f33eac81b666e Mon Sep 17 00:00:00 2001 From: tikikun Date: Sun, 3 Dec 2023 15:57:32 +0700 Subject: [PATCH] better role structure --- controllers/llamaCPP.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/controllers/llamaCPP.cc b/controllers/llamaCPP.cc index 92771d498..eaff6dd17 100644 --- a/controllers/llamaCPP.cc +++ b/controllers/llamaCPP.cc @@ -186,15 +186,22 @@ void llamaCPP::chatCompletion( std::string role; if (input_role == "user") { role = user_prompt; + std::string content = message["content"].asString(); + formatted_output += role + content; } else if (input_role == "assistant") { role = ai_prompt; + std::string content = message["content"].asString(); + formatted_output += role + content; } else if (input_role == "system") { role = system_prompt; + std::string content = message["content"].asString(); + formatted_output = role + content + formatted_output; + } else { role = input_role; + std::string content = message["content"].asString(); + formatted_output += role + content; } - std::string content = message["content"].asString(); - formatted_output += role + content; } formatted_output += ai_prompt;