mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Do not append empty joiners
This commit is contained in:
@@ -158,7 +158,7 @@ class WorldInfoBuffer {
|
|||||||
/**
|
/**
|
||||||
* @type {WIGlobalScanData} Chat independent data to be scanned, such as persona and character descriptions
|
* @type {WIGlobalScanData} Chat independent data to be scanned, such as persona and character descriptions
|
||||||
*/
|
*/
|
||||||
#globalScanDataBuffer = null;
|
#globalScanData = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {string[]} Array of messages sorted by ascending depth
|
* @type {string[]} Array of messages sorted by ascending depth
|
||||||
@@ -192,7 +192,7 @@ class WorldInfoBuffer {
|
|||||||
*/
|
*/
|
||||||
constructor(messages, globalScanData) {
|
constructor(messages, globalScanData) {
|
||||||
this.#initDepthBuffer(messages);
|
this.#initDepthBuffer(messages);
|
||||||
this.#globalScanDataBuffer = globalScanData;
|
this.#globalScanData = globalScanData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -249,23 +249,23 @@ class WorldInfoBuffer {
|
|||||||
const JOINER = '\n' + MATCHER;
|
const JOINER = '\n' + MATCHER;
|
||||||
let result = MATCHER + this.#depthBuffer.slice(this.#startDepth, depth).join(JOINER);
|
let result = MATCHER + this.#depthBuffer.slice(this.#startDepth, depth).join(JOINER);
|
||||||
|
|
||||||
if (entry.matchPersonaDescription) {
|
if (entry.matchPersonaDescription && this.#globalScanData.personaDescription) {
|
||||||
result += JOINER + this.#globalScanDataBuffer.personaDescription;
|
result += JOINER + this.#globalScanData.personaDescription;
|
||||||
}
|
}
|
||||||
if (entry.matchCharacterDescription) {
|
if (entry.matchCharacterDescription && this.#globalScanData.characterDescription) {
|
||||||
result += JOINER + this.#globalScanDataBuffer.characterDescription;
|
result += JOINER + this.#globalScanData.characterDescription;
|
||||||
}
|
}
|
||||||
if (entry.matchCharacterPersonality) {
|
if (entry.matchCharacterPersonality && this.#globalScanData.characterPersonality) {
|
||||||
result += JOINER + this.#globalScanDataBuffer.characterPersonality;
|
result += JOINER + this.#globalScanData.characterPersonality;
|
||||||
}
|
}
|
||||||
if (entry.matchCharacterDepthPrompt) {
|
if (entry.matchCharacterDepthPrompt && this.#globalScanData.characterDepthPrompt) {
|
||||||
result += JOINER + this.#globalScanDataBuffer.characterDepthPrompt;
|
result += JOINER + this.#globalScanData.characterDepthPrompt;
|
||||||
}
|
}
|
||||||
if (entry.matchScenario) {
|
if (entry.matchScenario && this.#globalScanData.scenario) {
|
||||||
result += JOINER + this.#globalScanDataBuffer.scenario;
|
result += JOINER + this.#globalScanData.scenario;
|
||||||
}
|
}
|
||||||
if (entry.matchCreatorNotes) {
|
if (entry.matchCreatorNotes && this.#globalScanData.creatorNotes) {
|
||||||
result += JOINER + this.#globalScanDataBuffer.creatorNotes;
|
result += JOINER + this.#globalScanData.creatorNotes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.#injectBuffer.length > 0) {
|
if (this.#injectBuffer.length > 0) {
|
||||||
|
Reference in New Issue
Block a user