From 6da3453efc61b5748c93b6672fbaafe6d410725f Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 14 Aug 2023 11:52:58 +0300 Subject: [PATCH] Fix example dialogue syntax --- public/scripts/openai.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/scripts/openai.js b/public/scripts/openai.js index 0ac751555..108f4ba56 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -517,11 +517,12 @@ function populateDialogueExamples(prompts, chatCompletion) { [...openai_msgs_example].forEach((dialogue, dialogueIndex) => { dialogue.forEach((prompt, promptIndex) => { - const role = prompt.name === 'example_assistant' ? 'assistant' : 'user'; + const role = 'system'; const content = prompt.content || ''; const identifier = `dialogueExamples ${dialogueIndex}-${promptIndex}`; const chatMessage = new Message(role, content, identifier); + chatMessage.setName(prompt.name); if (chatCompletion.canAfford(chatMessage)) { chatCompletion.insert(chatMessage, 'dialogueExamples'); } @@ -1402,6 +1403,10 @@ class Message { } } + setName(name) { + this.name = name; + } + /** * Create a new Message instance from a prompt. * @static