add VSC MARK comments to vital script.js funcs
| @@ -453,6 +453,7 @@ DOMPurify.addHook('uponSanitizeElement', (node, _, config) => { | |||
| 453 | }); | 453 | }); |
| 454 | 454 | ||
| 455 | // Event source init | 455 | // Event source init |
| 456 | //MARK: event_types | ||
| 456 | export const event_types = { | 457 | export const event_types = { |
| 457 | APP_READY: 'app_ready', | 458 | APP_READY: 'app_ready', |
| 458 | EXTRAS_CONNECTED: 'extras_connected', | 459 | EXTRAS_CONNECTED: 'extras_connected', |
| @@ -960,6 +961,7 @@ export async function pingServer() { | |||
| 960 | } | 961 | } |
| 961 | } | 962 | } |
| 962 | 963 | ||
| 964 | //MARK: firstLoadInit | ||
| 963 | async function firstLoadInit() { | 965 | async function firstLoadInit() { |
| 964 | try { | 966 | try { |
| 965 | const tokenResponse = await fetch('/csrf-token'); | 967 | const tokenResponse = await fetch('/csrf-token'); |
| @@ -3861,6 +3863,7 @@ function removeLastMessage() { | |||
| 3861 | } | 3863 | } |
| 3862 | 3864 | ||
| 3863 | /** | 3865 | /** |
| 3866 | * MARK:Generate() | ||
| 3864 | * Runs a generation using the current chat context. | 3867 | * Runs a generation using the current chat context. |
| 3865 | * @param {string} type Generation type | 3868 | * @param {string} type Generation type |
| 3866 | * @param {GenerateOptions} options Generation options | 3869 | * @param {GenerateOptions} options Generation options |
| @@ -4183,7 +4186,6 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | |||
| 4183 | 4186 | ||
| 4184 | console.log(`Core/all messages: ${coreChat.length}/${chat.length}`); | 4187 | console.log(`Core/all messages: ${coreChat.length}/${chat.length}`); |
| 4185 | 4188 | ||
| 4186 | // kingbri MARK: - Make sure the prompt bias isn't the same as the user bias | ||
| 4187 | if ((promptBias && !isUserPromptBias) || power_user.always_force_name2 || main_api == 'novel') { | 4189 | if ((promptBias && !isUserPromptBias) || power_user.always_force_name2 || main_api == 'novel') { |
| 4188 | force_name2 = true; | 4190 | force_name2 = true; |
| 4189 | } | 4191 | } |
| @@ -5166,6 +5168,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | |||
| 5166 | throw exception; | 5168 | throw exception; |
| 5167 | } | 5169 | } |
| 5168 | } | 5170 | } |
| 5171 | //MARK: Generate() ends | ||
| 5169 | 5172 | ||
| 5170 | /** | 5173 | /** |
| 5171 | * Stops the generation and any streaming if it is currently running. | 5174 | * Stops the generation and any streaming if it is currently running. |
| @@ -7477,7 +7480,7 @@ function reloadLoop() { | |||
| 7477 | } | 7480 | } |
| 7478 | } | 7481 | } |
| 7479 | 7482 | ||
| 7480 | //***************SETTINGS****************// | 7483 | //MARK: getSettings() |
| 7481 | /////////////////////////////////////////// | 7484 | /////////////////////////////////////////// |
| 7482 | export async function getSettings() { | 7485 | export async function getSettings() { |
| 7483 | const response = await fetch('/api/settings/get', { | 7486 | const response = await fetch('/api/settings/get', { |
| @@ -7673,6 +7676,7 @@ function selectKoboldGuiPreset() { | |||
| 7673 | .trigger('change'); | 7676 | .trigger('change'); |
| 7674 | } | 7677 | } |
| 7675 | 7678 | ||
| 7679 | //MARK: saveSettings() | ||
| 7676 | export async function saveSettings(loopCounter = 0) { | 7680 | export async function saveSettings(loopCounter = 0) { |
| 7677 | if (!settingsReady) { | 7681 | if (!settingsReady) { |
| 7678 | console.warn('Settings not ready, scheduling another save'); | 7682 | console.warn('Settings not ready, scheduling another save'); |
| @@ -9340,6 +9344,7 @@ export function swipe_left(_event, { source, repeated } = {}) { | |||
| 9340 | * @param {string} [params.source] The source of the swipe event. | 9344 | * @param {string} [params.source] The source of the swipe event. |
| 9341 | * @param {boolean} [params.repeated] Is the swipe event repeated. | 9345 | * @param {boolean} [params.repeated] Is the swipe event repeated. |
| 9342 | */ | 9346 | */ |
| 9347 | //MARK: swipe_right | ||
| 9343 | export function swipe_right(_event, { source, repeated } = {}) { | 9348 | export function swipe_right(_event, { source, repeated } = {}) { |
| 9344 | if (chat.length - 1 === Number(this_edit_mes_id)) { | 9349 | if (chat.length - 1 === Number(this_edit_mes_id)) { |
| 9345 | closeMessageEditor(); | 9350 | closeMessageEditor(); |
| @@ -10357,6 +10362,8 @@ API Settings: ${JSON.stringify(getSettingsContents[getSettingsContents.main_api | |||
| 10357 | }); | 10362 | }); |
| 10358 | } | 10363 | } |
| 10359 | 10364 | ||
| 10365 | |||
| 10366 | // MARK: DOM Handlers Start | ||
| 10360 | jQuery(async function () { | 10367 | jQuery(async function () { |
| 10361 | async function doForceSave() { | 10368 | async function doForceSave() { |
| 10362 | await saveSettings(); | 10369 | await saveSettings(); |