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
|
// Insert nsfw avoidance prompt into main, if no nsfw prompt is present
|
||||||
if (false === chatCompletion.has('nsfw') && oai_settings.nsfw_avoidance_prompt)
|
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
|
// Insert quiet prompt into main
|
||||||
if (quietPrompt) {
|
if (quietPrompt) {
|
||||||
@ -1349,12 +1349,14 @@ class ChatCompletion {
|
|||||||
// Move validation to its own method for readability
|
// Move validation to its own method for readability
|
||||||
validateMessageCollection(collection) {
|
validateMessageCollection(collection) {
|
||||||
if (!(collection instanceof MessageCollection)) {
|
if (!(collection instanceof MessageCollection)) {
|
||||||
|
console.log(collection);
|
||||||
throw new Error('Argument must be an instance of MessageCollection');
|
throw new Error('Argument must be an instance of MessageCollection');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
validateMessage(message) {
|
validateMessage(message) {
|
||||||
if (!(message instanceof Message)) {
|
if (!(message instanceof Message)) {
|
||||||
|
console.log(message);
|
||||||
throw new Error('Argument must be an instance of Message');
|
throw new Error('Argument must be an instance of Message');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user