mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Declare prepareOpenAIMessages as synchronous
As there is no need for the function o be async anymore.
This commit is contained in:
@ -207,17 +207,17 @@ PromptManagerModule.prototype.init = function (moduleConfiguration, serviceSetti
|
|||||||
// Apply character specific overrides for prompts
|
// Apply character specific overrides for prompts
|
||||||
eventSource.on(event_types.OAI_BEFORE_CHATCOMPLETION, (prompts) => {
|
eventSource.on(event_types.OAI_BEFORE_CHATCOMPLETION, (prompts) => {
|
||||||
const systemPromptOverride = this.activeCharacter.data.system_prompt ?? null;
|
const systemPromptOverride = this.activeCharacter.data.system_prompt ?? null;
|
||||||
|
const systemPrompt = prompts.get('main') ?? null;
|
||||||
if (systemPromptOverride) {
|
if (systemPromptOverride) {
|
||||||
const override = prompts.get('main');
|
systemPrompt.content = systemPromptOverride;
|
||||||
override.content = systemPromptOverride;
|
prompts.set(systemPrompt, prompts.index('main'));
|
||||||
prompts.set(override, prompts.index('main'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const jailbreakPromptOverride = this.activeCharacter.data.system_prompt ?? null;
|
const jailbreakPromptOverride = this.activeCharacter.data.system_prompt ?? null;
|
||||||
if (jailbreakPromptOverride) {
|
const jailbreakPrompt = prompts.get('jailbreak') ?? null;
|
||||||
const override = prompts.get('jailbreak');
|
if (jailbreakPromptOverride && jailbreakPrompt) {
|
||||||
override.content = jailbreakPromptOverride;
|
jailbreakPrompt.content = jailbreakPromptOverride;
|
||||||
prompts.set(override, prompts.index('jailbreak'));
|
prompts.set(jailbreakPrompt, prompts.index('jailbreak'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -584,7 +584,7 @@ PromptManagerModule.prototype.getPromptCollection = function () {
|
|||||||
const promptCollection = new PromptCollection();
|
const promptCollection = new PromptCollection();
|
||||||
promptList.forEach(entry => {
|
promptList.forEach(entry => {
|
||||||
if (true === entry.enabled) promptCollection.add(this.preparePrompt(this.getPromptById(entry.identifier)));
|
if (true === entry.enabled) promptCollection.add(this.preparePrompt(this.getPromptById(entry.identifier)));
|
||||||
})
|
});
|
||||||
|
|
||||||
return promptCollection
|
return promptCollection
|
||||||
}
|
}
|
||||||
|
@ -571,7 +571,7 @@ function prepareOpenAIMessages({
|
|||||||
if (authorsNote && authorsNote.content) mappedPrompts.push({role: 'system', content: authorsNote.content, identifier: 'authorsNote'});
|
if (authorsNote && authorsNote.content) mappedPrompts.push({role: 'system', content: authorsNote.content, identifier: 'authorsNote'});
|
||||||
|
|
||||||
// Create prompt objects and substitute markers
|
// Create prompt objects and substitute markers
|
||||||
mappedPrompts.forEach((prompt) => {
|
mappedPrompts.forEach(prompt => {
|
||||||
const newPrompt = promptManager.preparePrompt(prompt);
|
const newPrompt = promptManager.preparePrompt(prompt);
|
||||||
const markerIndex = prompts.index(prompt.identifier);
|
const markerIndex = prompts.index(prompt.identifier);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user