mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
using symbols instead
This commit is contained in:
@ -174,7 +174,7 @@ import {
|
|||||||
saveBase64AsFile,
|
saveBase64AsFile,
|
||||||
uuidv4,
|
uuidv4,
|
||||||
} from './scripts/utils.js';
|
} from './scripts/utils.js';
|
||||||
import { debounce_timeout } from './scripts/constants.js';
|
import { debounce_timeout, IGNORE_SYMBOL } from './scripts/constants.js';
|
||||||
|
|
||||||
import { doDailyExtensionUpdatesCheck, extension_settings, initExtensions, loadExtensionSettings, runGenerationInterceptors, saveMetadataDebounced } from './scripts/extensions.js';
|
import { doDailyExtensionUpdatesCheck, extension_settings, initExtensions, loadExtensionSettings, runGenerationInterceptors, saveMetadataDebounced } from './scripts/extensions.js';
|
||||||
import { COMMENT_NAME_DEFAULT, executeSlashCommandsOnChatInput, getSlashCommandsHelp, initDefaultSlashCommands, isExecutingCommandsFromChatInput, pauseScriptExecution, processChatSlashCommands, stopScriptExecution } from './scripts/slash-commands.js';
|
import { COMMENT_NAME_DEFAULT, executeSlashCommandsOnChatInput, getSlashCommandsHelp, initDefaultSlashCommands, isExecutingCommandsFromChatInput, pauseScriptExecution, processChatSlashCommands, stopScriptExecution } from './scripts/slash-commands.js';
|
||||||
@ -5295,6 +5295,7 @@ export function getBiasStrings(textareaText, type) {
|
|||||||
* @param {boolean} isInstruct Whether instruct mode is enabled.
|
* @param {boolean} isInstruct Whether instruct mode is enabled.
|
||||||
* @param {boolean|number} forceOutputSequence Whether to force the first/last output sequence for instruct mode.
|
* @param {boolean|number} forceOutputSequence Whether to force the first/last output sequence for instruct mode.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formatMessageHistoryItem(chatItem, isInstruct, forceOutputSequence) {
|
function formatMessageHistoryItem(chatItem, isInstruct, forceOutputSequence) {
|
||||||
const isNarratorType = chatItem?.extra?.type === system_message_types.NARRATOR;
|
const isNarratorType = chatItem?.extra?.type === system_message_types.NARRATOR;
|
||||||
const characterName = chatItem?.name ? chatItem.name : name2;
|
const characterName = chatItem?.name ? chatItem.name : name2;
|
||||||
@ -5303,7 +5304,7 @@ function formatMessageHistoryItem(chatItem, isInstruct, forceOutputSequence) {
|
|||||||
|
|
||||||
// If this flag is set, completely ignore the message.
|
// If this flag is set, completely ignore the message.
|
||||||
// This can be used to hide messages without affecting the number of messages in the chat.
|
// This can be used to hide messages without affecting the number of messages in the chat.
|
||||||
if (chatItem.extra?.ignore) {
|
if (chatItem.extra?.[IGNORE_SYMBOL]) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,3 +14,9 @@ export const debounce_timeout = {
|
|||||||
/** [5 sec] For delayed tasks, like auto-saving or completing batch operations that need a significant pause. */
|
/** [5 sec] For delayed tasks, like auto-saving or completing batch operations that need a significant pause. */
|
||||||
extended: 5000,
|
extended: 5000,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Used as an ephemeral key in message extra metadata.
|
||||||
|
When set, the message will be excluded from context.
|
||||||
|
*/
|
||||||
|
export const IGNORE_SYMBOL = Symbol.for('ignore');
|
||||||
|
@ -75,6 +75,7 @@ import { Popup, POPUP_RESULT } from './popup.js';
|
|||||||
import { t } from './i18n.js';
|
import { t } from './i18n.js';
|
||||||
import { ToolManager } from './tool-calling.js';
|
import { ToolManager } from './tool-calling.js';
|
||||||
import { accountStorage } from './util/AccountStorage.js';
|
import { accountStorage } from './util/AccountStorage.js';
|
||||||
|
import {IGNORE_SYMBOL} from "./constants.js";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
openai_messages_count,
|
openai_messages_count,
|
||||||
@ -528,7 +529,7 @@ function setOpenAIMessages(chat) {
|
|||||||
let content = chat[j]['mes'];
|
let content = chat[j]['mes'];
|
||||||
|
|
||||||
// If this flag is set, completely ignore the message
|
// If this flag is set, completely ignore the message
|
||||||
if (chat[j].extra?.ignore) {
|
if (chat[j].extra?.[IGNORE_SYMBOL]) {
|
||||||
j++;
|
j++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user