Filter null messages in array and context line appearing unprompted
This commit is contained in:
parent
706be4390d
commit
2afac5aeb1
|
@ -2911,7 +2911,9 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||||
parseTokenCounts(counts, thisPromptBits);
|
parseTokenCounts(counts, thisPromptBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
setInContextMessages(openai_messages_count, type);
|
if (!dryRun) {
|
||||||
|
setInContextMessages(openai_messages_count, type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (true === dryRun) return onSuccess({error: 'dryRun'});
|
if (true === dryRun) return onSuccess({error: 'dryRun'});
|
||||||
|
@ -3336,7 +3338,7 @@ function parseTokenCounts(counts, thisPromptBits) {
|
||||||
function addChatsPreamble(mesSendString) {
|
function addChatsPreamble(mesSendString) {
|
||||||
return main_api === 'novel'
|
return main_api === 'novel'
|
||||||
? nai_settings.preamble + '\n' + mesSendString
|
? nai_settings.preamble + '\n' + mesSendString
|
||||||
: mesSendString;
|
: mesSendString;
|
||||||
}
|
}
|
||||||
|
|
||||||
function addChatsSeparator(mesSendString) {
|
function addChatsSeparator(mesSendString) {
|
||||||
|
|
|
@ -1036,6 +1036,13 @@ async function sendOpenAIRequest(type, openai_msgs_tosend, signal) {
|
||||||
signal = new AbortController().signal;
|
signal = new AbortController().signal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HACK: Filter out null and non-object messages
|
||||||
|
if (!Array.isArray(openai_msgs_tosend)) {
|
||||||
|
throw new Error('openai_msgs_tosend must be an array');
|
||||||
|
}
|
||||||
|
|
||||||
|
openai_msgs_tosend = openai_msgs_tosend.filter(msg => msg && typeof msg === 'object');
|
||||||
|
|
||||||
let logit_bias = {};
|
let logit_bias = {};
|
||||||
const isClaude = oai_settings.chat_completion_source == chat_completion_sources.CLAUDE;
|
const isClaude = oai_settings.chat_completion_source == chat_completion_sources.CLAUDE;
|
||||||
const isOpenRouter = oai_settings.chat_completion_source == chat_completion_sources.OPENROUTER;
|
const isOpenRouter = oai_settings.chat_completion_source == chat_completion_sources.OPENROUTER;
|
||||||
|
|
Loading…
Reference in New Issue