Fix {{summary}} with experimental engine
| @@ -349,6 +349,11 @@ function onMaxMessagesPerRequestInput() { | ||
| 349 | 349 | saveSettingsDebounced(); |
| 350 | 350 | } |
| 351 | 351 | |
| 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 | + */ | |
| 352 | 357 | function getLatestMemoryFromChat(chat) { |
| 353 | 358 | if (!Array.isArray(chat) || !chat.length) { |
| 354 | 359 | return ''; |
| @@ -365,6 +370,11 @@ function getLatestMemoryFromChat(chat) { | ||
| 365 | 370 | return ''; |
| 366 | 371 | } |
| 367 | 372 | |
| 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 | + */ | |
| 368 | 378 | function getIndexOfLatestChatSummary(chat) { |
| 369 | 379 | if (!Array.isArray(chat) || !chat.length) { |
| 370 | 380 | return -1; |
| @@ -160,17 +160,6 @@ export function registerEnvMacros() { | ||
| 160 | 160 | handler: ({ env }) => env.system.model, |
| 161 | 161 | }); |
| 162 | 162 | |
| 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 | 163 | MacroRegistry.registerMacro('original', { |
| 175 | 164 | category: MacroCategory.CHARACTER, |
| 176 | 165 | description: 'Original message content for {{original}} substitution in in character prompt overrides.', |