Deduplicate code for substitution in the story and the first message

This commit is contained in:
Grzegorz Gidel
2023-04-29 00:59:31 +02:00
parent 087274db9b
commit a71b8967ac
2 changed files with 6 additions and 18 deletions

View File

@ -148,10 +148,6 @@ function setOpenAIMessages(chat) {
// clean openai msgs
openai_msgs = [];
for (let i = chat.length - 1; i >= 0; i--) {
// first greeting message
if (j == 0) {
chat[j]['mes'] = substituteParams(chat[j]['mes']);
}
let role = chat[j]['is_user'] ? 'user' : 'assistant';
let content = chat[j]['mes'];