mirror of
https://github.com/bal-spec/sillytavern-character-memory.git
synced 2026-04-28 03:39:44 +00:00
feat(extraction): track primary-LLM generation state via ST events
This commit is contained in:
parent
c4254f1488
commit
e82a879bd7
1 changed files with 18 additions and 0 deletions
18
index.js
18
index.js
|
|
@ -82,6 +82,8 @@ let consolidationBackup = null;
|
|||
let reformatBackup = null;
|
||||
// convertPreviewResult removed — conversion state now lives in the dialog closure
|
||||
let lastExtractionTime = 0; // session-only, resets on page load
|
||||
let isGenerating = false;
|
||||
let pendingExtraction = false;
|
||||
|
||||
// ============ Activity Log ============
|
||||
|
||||
|
|
@ -8987,6 +8989,22 @@ jQuery(async function () {
|
|||
// Event hooks
|
||||
eventSource.on(event_types.CHARACTER_MESSAGE_RENDERED, onCharacterMessageRendered);
|
||||
eventSource.on(event_types.CHAT_CHANGED, onChatChanged);
|
||||
eventSource.on(event_types.GENERATION_STARTED, () => {
|
||||
isGenerating = true;
|
||||
});
|
||||
eventSource.on(event_types.GENERATION_ENDED, () => {
|
||||
isGenerating = false;
|
||||
if (pendingExtraction) {
|
||||
pendingExtraction = false;
|
||||
logActivity('Running deferred extraction now that generation ended');
|
||||
extractMemories({ force: false });
|
||||
}
|
||||
});
|
||||
eventSource.on(event_types.GENERATION_STOPPED, () => {
|
||||
isGenerating = false;
|
||||
// Don't auto-run deferred extraction after user abort — they may want to edit and retry.
|
||||
pendingExtraction = false;
|
||||
});
|
||||
|
||||
// Per-message buttons and indicators
|
||||
eventSource.on(event_types.CHARACTER_MESSAGE_RENDERED, onMessageRenderedAddButtons);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue