mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
add VSC MARK comments to vital script.js funcs
This commit is contained in:
@ -453,6 +453,7 @@ DOMPurify.addHook('uponSanitizeElement', (node, _, config) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Event source init
|
// Event source init
|
||||||
|
//MARK: event_types
|
||||||
export const event_types = {
|
export const event_types = {
|
||||||
APP_READY: 'app_ready',
|
APP_READY: 'app_ready',
|
||||||
EXTRAS_CONNECTED: 'extras_connected',
|
EXTRAS_CONNECTED: 'extras_connected',
|
||||||
@ -960,6 +961,7 @@ export async function pingServer() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//MARK: firstLoadInit
|
||||||
async function firstLoadInit() {
|
async function firstLoadInit() {
|
||||||
try {
|
try {
|
||||||
const tokenResponse = await fetch('/csrf-token');
|
const tokenResponse = await fetch('/csrf-token');
|
||||||
@ -3861,6 +3863,7 @@ function removeLastMessage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* MARK:Generate()
|
||||||
* Runs a generation using the current chat context.
|
* Runs a generation using the current chat context.
|
||||||
* @param {string} type Generation type
|
* @param {string} type Generation type
|
||||||
* @param {GenerateOptions} options Generation options
|
* @param {GenerateOptions} options Generation options
|
||||||
@ -4183,7 +4186,6 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
|||||||
|
|
||||||
console.log(`Core/all messages: ${coreChat.length}/${chat.length}`);
|
console.log(`Core/all messages: ${coreChat.length}/${chat.length}`);
|
||||||
|
|
||||||
// kingbri MARK: - Make sure the prompt bias isn't the same as the user bias
|
|
||||||
if ((promptBias && !isUserPromptBias) || power_user.always_force_name2 || main_api == 'novel') {
|
if ((promptBias && !isUserPromptBias) || power_user.always_force_name2 || main_api == 'novel') {
|
||||||
force_name2 = true;
|
force_name2 = true;
|
||||||
}
|
}
|
||||||
@ -5166,6 +5168,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
|||||||
throw exception;
|
throw exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//MARK: Generate() ends
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stops the generation and any streaming if it is currently running.
|
* Stops the generation and any streaming if it is currently running.
|
||||||
@ -7477,7 +7480,7 @@ function reloadLoop() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//***************SETTINGS****************//
|
//MARK: getSettings()
|
||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
export async function getSettings() {
|
export async function getSettings() {
|
||||||
const response = await fetch('/api/settings/get', {
|
const response = await fetch('/api/settings/get', {
|
||||||
@ -7673,6 +7676,7 @@ function selectKoboldGuiPreset() {
|
|||||||
.trigger('change');
|
.trigger('change');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//MARK: saveSettings()
|
||||||
export async function saveSettings(loopCounter = 0) {
|
export async function saveSettings(loopCounter = 0) {
|
||||||
if (!settingsReady) {
|
if (!settingsReady) {
|
||||||
console.warn('Settings not ready, scheduling another save');
|
console.warn('Settings not ready, scheduling another save');
|
||||||
@ -9340,6 +9344,7 @@ export function swipe_left(_event, { source, repeated } = {}) {
|
|||||||
* @param {string} [params.source] The source of the swipe event.
|
* @param {string} [params.source] The source of the swipe event.
|
||||||
* @param {boolean} [params.repeated] Is the swipe event repeated.
|
* @param {boolean} [params.repeated] Is the swipe event repeated.
|
||||||
*/
|
*/
|
||||||
|
//MARK: swipe_right
|
||||||
export function swipe_right(_event, { source, repeated } = {}) {
|
export function swipe_right(_event, { source, repeated } = {}) {
|
||||||
if (chat.length - 1 === Number(this_edit_mes_id)) {
|
if (chat.length - 1 === Number(this_edit_mes_id)) {
|
||||||
closeMessageEditor();
|
closeMessageEditor();
|
||||||
@ -10357,6 +10362,8 @@ API Settings: ${JSON.stringify(getSettingsContents[getSettingsContents.main_api
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// MARK: DOM Handlers Start
|
||||||
jQuery(async function () {
|
jQuery(async function () {
|
||||||
async function doForceSave() {
|
async function doForceSave() {
|
||||||
await saveSettings();
|
await saveSettings();
|
||||||
|
Reference in New Issue
Block a user