mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2024-12-13 18:07:20 +01:00
Fix example dialogue syntax
This commit is contained in:
parent
bd9f49d975
commit
6da3453efc
@ -517,11 +517,12 @@ function populateDialogueExamples(prompts, chatCompletion) {
|
|||||||
|
|
||||||
[...openai_msgs_example].forEach((dialogue, dialogueIndex) => {
|
[...openai_msgs_example].forEach((dialogue, dialogueIndex) => {
|
||||||
dialogue.forEach((prompt, promptIndex) => {
|
dialogue.forEach((prompt, promptIndex) => {
|
||||||
const role = prompt.name === 'example_assistant' ? 'assistant' : 'user';
|
const role = 'system';
|
||||||
const content = prompt.content || '';
|
const content = prompt.content || '';
|
||||||
const identifier = `dialogueExamples ${dialogueIndex}-${promptIndex}`;
|
const identifier = `dialogueExamples ${dialogueIndex}-${promptIndex}`;
|
||||||
|
|
||||||
const chatMessage = new Message(role, content, identifier);
|
const chatMessage = new Message(role, content, identifier);
|
||||||
|
chatMessage.setName(prompt.name);
|
||||||
if (chatCompletion.canAfford(chatMessage)) {
|
if (chatCompletion.canAfford(chatMessage)) {
|
||||||
chatCompletion.insert(chatMessage, 'dialogueExamples');
|
chatCompletion.insert(chatMessage, 'dialogueExamples');
|
||||||
}
|
}
|
||||||
@ -1402,6 +1403,10 @@ class Message {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setName(name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Message instance from a prompt.
|
* Create a new Message instance from a prompt.
|
||||||
* @static
|
* @static
|
||||||
|
Loading…
Reference in New Issue
Block a user