using symbols instead
| @@ -174,7 +174,7 @@ import { | ||
| 174 | 174 | saveBase64AsFile, |
| 175 | 175 | uuidv4, |
| 176 | 176 | } from './scripts/utils.js'; |
| 177 | 177 | import { debounce_timeout, IGNORE_SYMBOL } from './scripts/constants.js'; |
| 178 | 178 | |
| 179 | 179 | import { doDailyExtensionUpdatesCheck, extension_settings, initExtensions, loadExtensionSettings, runGenerationInterceptors, saveMetadataDebounced } from './scripts/extensions.js'; |
| 180 | 180 | 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) { | ||
| 5295 | 5295 | * @param {boolean} isInstruct Whether instruct mode is enabled. |
| 5296 | 5296 | * @param {boolean|number} forceOutputSequence Whether to force the first/last output sequence for instruct mode. |
| 5297 | 5297 | */ |
| 5298 | + | |
| 5298 | 5299 | function formatMessageHistoryItem(chatItem, isInstruct, forceOutputSequence) { |
| 5299 | 5300 | const isNarratorType = chatItem?.extra?.type === system_message_types.NARRATOR; |
| 5300 | 5301 | const characterName = chatItem?.name ? chatItem.name : name2; |
| @@ -5303,7 +5304,7 @@ function formatMessageHistoryItem(chatItem, isInstruct, forceOutputSequence) { | ||
| 5303 | 5304 | |
| 5304 | 5305 | // If this flag is set, completely ignore the message. |
| 5305 | 5306 | // This can be used to hide messages without affecting the number of messages in the chat. |
| 5306 | 5307 | if (chatItem.extra?.ignore[IGNORE_SYMBOL]) { |
| 5307 | 5308 | return ''; |
| 5308 | 5309 | } |
| 5309 | 5310 | |
| @@ -14,3 +14,9 @@ export const debounce_timeout = { | ||
| 14 | 14 | /** [5 sec] For delayed tasks, like auto-saving or completing batch operations that need a significant pause. */ |
| 15 | 15 | extended: 5000, |
| 16 | 16 | }; |
| 17 | + | |
| 18 | +/* | |
| 19 | +Used as an ephemeral key in message extra metadata. | |
| 20 | +When set, the message will be excluded from context. | |
| 21 | + */ | |
| 22 | +export const IGNORE_SYMBOL = Symbol.for('ignore'); | |
| @@ -75,6 +75,7 @@ import { Popup, POPUP_RESULT } from './popup.js'; | ||
| 75 | 75 | import { t } from './i18n.js'; |
| 76 | 76 | import { ToolManager } from './tool-calling.js'; |
| 77 | 77 | import { accountStorage } from './util/AccountStorage.js'; |
| 78 | +import {IGNORE_SYMBOL} from "./constants.js"; | |
| 78 | 79 | |
| 79 | 80 | export { |
| 80 | 81 | openai_messages_count, |
| @@ -528,7 +529,7 @@ function setOpenAIMessages(chat) { | ||
| 528 | 529 | let content = chat[j]['mes']; |
| 529 | 530 | |
| 530 | 531 | // If this flag is set, completely ignore the message |
| 531 | 532 | if (chat[j].extra?.ignore[IGNORE_SYMBOL]) { |
| 532 | 533 | j++; |
| 533 | 534 | continue; |
| 534 | 535 | } |