mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
WorldInfo can now be routed into Author's Note
This commit is contained in:
@@ -2902,6 +2902,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="world_entry_form_control world_entry_form_radios wi-enter-footer-text ">
|
<div class="world_entry_form_control world_entry_form_radios wi-enter-footer-text ">
|
||||||
|
<small>Placement</small>
|
||||||
<div>
|
<div>
|
||||||
<label><input type="radio" name="position" value="0">
|
<label><input type="radio" name="position" value="0">
|
||||||
<span data-i18n="Before Char">Before Char</span>
|
<span data-i18n="Before Char">Before Char</span>
|
||||||
@@ -2912,6 +2913,11 @@
|
|||||||
<span data-i18n="After Char">After Char</span>
|
<span data-i18n="After Char">After Char</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<label><input type="radio" name="position" value="2">
|
||||||
|
<span data-i18n="Author's Note">Author's Note</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="world_entry_form_control wi-enter-footer-text flex-container flexNoGap ">
|
<div class="world_entry_form_control wi-enter-footer-text flex-container flexNoGap ">
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import { saveSettings, callPopup, substituteParams, getTokenCount, getRequestHeaders } from "../script.js";
|
import { saveSettings, callPopup, substituteParams, getTokenCount, getRequestHeaders } from "../script.js";
|
||||||
import { download, debounce, delay, initScrollHeight, resetScrollHeight } from "./utils.js";
|
import { download, debounce, delay, initScrollHeight, resetScrollHeight } from "./utils.js";
|
||||||
|
import { getContext } from "./extensions.js";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
world_info,
|
world_info,
|
||||||
@@ -34,6 +35,7 @@ const saveSettingsDebounced = debounce(() => saveSettings(), 1000);
|
|||||||
const world_info_position = {
|
const world_info_position = {
|
||||||
before: 0,
|
before: 0,
|
||||||
after: 1,
|
after: 1,
|
||||||
|
authorsnote: 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
function getWorldInfoPrompt(chat2) {
|
function getWorldInfoPrompt(chat2) {
|
||||||
@@ -216,7 +218,7 @@ function appendWorldEntry(entry) {
|
|||||||
commentToggle.on("input", function () {
|
commentToggle.on("input", function () {
|
||||||
const uid = $(this).data("uid");
|
const uid = $(this).data("uid");
|
||||||
const value = $(this).prop("checked");
|
const value = $(this).prop("checked");
|
||||||
console.log(value)
|
//console.log(value)
|
||||||
const commentContainer = $(this)
|
const commentContainer = $(this)
|
||||||
.closest(".world_entry")
|
.closest(".world_entry")
|
||||||
.find(".commentContainer");
|
.find(".commentContainer");
|
||||||
@@ -533,6 +535,7 @@ function checkWorldInfo(chat) {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const context = getContext();
|
||||||
const messagesToLookBack = world_info_depth * 2;
|
const messagesToLookBack = world_info_depth * 2;
|
||||||
let textToScan = transformString(chat.slice(0, messagesToLookBack).join(""));
|
let textToScan = transformString(chat.slice(0, messagesToLookBack).join(""));
|
||||||
let worldInfoBefore = "";
|
let worldInfoBefore = "";
|
||||||
@@ -595,10 +598,14 @@ function checkWorldInfo(chat) {
|
|||||||
worldInfoAfter = `${substituteParams(
|
worldInfoAfter = `${substituteParams(
|
||||||
entry.content
|
entry.content
|
||||||
)}\n${worldInfoAfter}`;
|
)}\n${worldInfoAfter}`;
|
||||||
} else {
|
} else if (entry.position === world_info_position.before) {
|
||||||
worldInfoBefore = `${substituteParams(
|
worldInfoBefore = `${substituteParams(
|
||||||
entry.content
|
entry.content
|
||||||
)}\n${worldInfoBefore}`;
|
)}\n${worldInfoBefore}`;
|
||||||
|
} else {
|
||||||
|
let originalAN = context.extensionPrompts['2_floating_prompt'].value;
|
||||||
|
let ANWithWI = originalAN + "\n" + entry.content;
|
||||||
|
context.extensionPrompts['2_floating_prompt'].value = ANWithWI;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
Reference in New Issue
Block a user