Fix {{summary}} with experimental engine

c705cbe6980fd90d72d0e421e675553e04c5523e

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +10 -11Ignore whitespace
public/scripts/extensions/memory/index.js+10 -0
@@ -349,6 +349,11 @@ function onMaxMessagesPerRequestInput() {
349 saveSettingsDebounced();349 saveSettingsDebounced();
350}350}
351351
352/**
353 * Get the latest memory summary from the chat.
354 * @param {ChatMessage[]} chat Chat messages
355 * @returns {string} Latest memory summary or empty string
356 */
352function getLatestMemoryFromChat(chat) {357function getLatestMemoryFromChat(chat) {
353 if (!Array.isArray(chat) || !chat.length) {358 if (!Array.isArray(chat) || !chat.length) {
354 return '';359 return '';
@@ -365,6 +370,11 @@ function getLatestMemoryFromChat(chat) {
365 return '';370 return '';
366}371}
367372
373/**
374 * Get the index of the latest memory summary from the chat.
375 * @param {ChatMessage[]} chat Chat messages
376 * @returns {number} Index of the latest memory summary or -1 if not found
377 */
368function getIndexOfLatestChatSummary(chat) {378function getIndexOfLatestChatSummary(chat) {
369 if (!Array.isArray(chat) || !chat.length) {379 if (!Array.isArray(chat) || !chat.length) {
370 return -1;380 return -1;
public/scripts/macros/definitions/env-macros.js+0 -11
@@ -160,17 +160,6 @@ export function registerEnvMacros() {
160 handler: ({ env }) => env.system.model,160 handler: ({ env }) => env.system.model,
161 });161 });
162162
163 // TODO: Move this to the summary extension, where it belongs
164 MacroRegistry.registerMacro('summary', {
165 category: MacroCategory.CHAT,
166 description: 'Latest chat summary from the "Summarize" extension (when available).',
167 returns: 'Latest chat summary.',
168 handler: ({ env }) => {
169 const value = /** @type {any} */ (env.extra).summary;
170 return value == null ? '' : String(value);
171 },
172 });
173
174 MacroRegistry.registerMacro('original', {163 MacroRegistry.registerMacro('original', {
175 category: MacroCategory.CHARACTER,164 category: MacroCategory.CHARACTER,
176 description: 'Original message content for {{original}} substitution in in character prompt overrides.',165 description: 'Original message content for {{original}} substitution in in character prompt overrides.',