Do not append empty joiners

421c924c229df846e74b88b83a2194b814b2c922

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +14 -14Ignore whitespace
public/scripts/world-info.js+14 -14
@@ -158,7 +158,7 @@ class WorldInfoBuffer {
158 /**158 /**
159 * @type {WIGlobalScanData} Chat independent data to be scanned, such as persona and character descriptions159 * @type {WIGlobalScanData} Chat independent data to be scanned, such as persona and character descriptions
160 */160 */
161 #globalScanDataBuffer = null;161 #globalScanData = null;
162162
163 /**163 /**
164 * @type {string[]} Array of messages sorted by ascending depth164 * @type {string[]} Array of messages sorted by ascending depth
@@ -192,7 +192,7 @@ class WorldInfoBuffer {
192 */192 */
193 constructor(messages, globalScanData) {193 constructor(messages, globalScanData) {
194 this.#initDepthBuffer(messages);194 this.#initDepthBuffer(messages);
195 this.#globalScanDataBuffer = globalScanData;195 this.#globalScanData = globalScanData;
196 }196 }
197197
198 /**198 /**
@@ -249,23 +249,23 @@ class WorldInfoBuffer {
249 const JOINER = '\n' + MATCHER;249 const JOINER = '\n' + MATCHER;
250 let result = MATCHER + this.#depthBuffer.slice(this.#startDepth, depth).join(JOINER);250 let result = MATCHER + this.#depthBuffer.slice(this.#startDepth, depth).join(JOINER);
251251
252 if (entry.matchPersonaDescription) {252 if (entry.matchPersonaDescription && this.#globalScanData.personaDescription) {
253 result += JOINER + this.#globalScanDataBuffer.personaDescription;253 result += JOINER + this.#globalScanData.personaDescription;
254 }254 }
255 if (entry.matchCharacterDescription) {255 if (entry.matchCharacterDescription && this.#globalScanData.characterDescription) {
256 result += JOINER + this.#globalScanDataBuffer.characterDescription;256 result += JOINER + this.#globalScanData.characterDescription;
257 }257 }
258 if (entry.matchCharacterPersonality) {258 if (entry.matchCharacterPersonality && this.#globalScanData.characterPersonality) {
259 result += JOINER + this.#globalScanDataBuffer.characterPersonality;259 result += JOINER + this.#globalScanData.characterPersonality;
260 }260 }
261 if (entry.matchCharacterDepthPrompt) {261 if (entry.matchCharacterDepthPrompt && this.#globalScanData.characterDepthPrompt) {
262 result += JOINER + this.#globalScanDataBuffer.characterDepthPrompt;262 result += JOINER + this.#globalScanData.characterDepthPrompt;
263 }263 }
264 if (entry.matchScenario) {264 if (entry.matchScenario && this.#globalScanData.scenario) {
265 result += JOINER + this.#globalScanDataBuffer.scenario;265 result += JOINER + this.#globalScanData.scenario;
266 }266 }
267 if (entry.matchCreatorNotes) {267 if (entry.matchCreatorNotes && this.#globalScanData.creatorNotes) {
268 result += JOINER + this.#globalScanDataBuffer.creatorNotes;268 result += JOINER + this.#globalScanData.creatorNotes;
269 }269 }
270270
271 if (this.#injectBuffer.length > 0) {271 if (this.#injectBuffer.length > 0) {