mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Pass nsfwAvoidance message instead of prompt
Fixing invalid argument exception being thrown
This commit is contained in:
@ -486,7 +486,7 @@ function populateChatCompletion (prompts, chatCompletion, {bias, quietPrompt, ty
|
||||
|
||||
// Insert nsfw avoidance prompt into main, if no nsfw prompt is present
|
||||
if (false === chatCompletion.has('nsfw') && oai_settings.nsfw_avoidance_prompt)
|
||||
if (prompts.has('nsfwAvoidance')) chatCompletion.insert(prompts.get('nsfwAvoidance'), 'main');
|
||||
if (prompts.has('nsfwAvoidance')) chatCompletion.insert(Message.fromPrompt(prompts.get('nsfwAvoidance')), 'main');
|
||||
|
||||
// Insert quiet prompt into main
|
||||
if (quietPrompt) {
|
||||
@ -1349,12 +1349,14 @@ class ChatCompletion {
|
||||
// Move validation to its own method for readability
|
||||
validateMessageCollection(collection) {
|
||||
if (!(collection instanceof MessageCollection)) {
|
||||
console.log(collection);
|
||||
throw new Error('Argument must be an instance of MessageCollection');
|
||||
}
|
||||
}
|
||||
|
||||
validateMessage(message) {
|
||||
if (!(message instanceof Message)) {
|
||||
console.log(message);
|
||||
throw new Error('Argument must be an instance of Message');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user