mirror of
https://github.com/bal-spec/sillytavern-character-memory.git
synced 2026-05-05 23:50:08 +00:00
Previously only reset the active chat's metadata, so batch extraction still saw other chats as fully processed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
227 lines
16 KiB
HTML
227 lines
16 KiB
HTML
<div class="charMemory_settings">
|
|
<div class="inline-drawer">
|
|
<div class="inline-drawer-toggle inline-drawer-header">
|
|
<b>Character Memory</b>
|
|
<div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
|
|
</div>
|
|
<div class="inline-drawer-content">
|
|
|
|
<!-- Stats bar — always visible -->
|
|
<div class="charMemory_statsBar">
|
|
<div class="charMemory_statItem" title="The Data Bank file where memories are stored for this character">
|
|
<i class="fa-solid fa-file-lines fa-sm"></i>
|
|
<span id="charMemory_statFile">No character</span>
|
|
</div>
|
|
<div class="charMemory_statItem" title="Total number of individual memory bullets stored">
|
|
<i class="fa-solid fa-brain fa-sm"></i>
|
|
<span id="charMemory_statCount">0 memories</span>
|
|
</div>
|
|
<div class="charMemory_statItem" title="New messages since last extraction / auto-extraction threshold. When this fills up, extraction triggers automatically.">
|
|
<i class="fa-solid fa-arrows-rotate fa-sm"></i>
|
|
<span id="charMemory_statProgress">0/10 msgs</span>
|
|
</div>
|
|
<div class="charMemory_statItem" title="Time remaining before the next auto-extraction is allowed. Manual extractions bypass this.">
|
|
<i class="fa-solid fa-clock fa-sm"></i>
|
|
<span id="charMemory_statCooldown">Ready</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="charMemory_statusRow">
|
|
<label class="checkbox_label" for="charMemory_enabled" title="When enabled, memories are extracted automatically after a set number of new messages">
|
|
<input type="checkbox" id="charMemory_enabled" />
|
|
<span>Enable automatic extraction</span>
|
|
</label>
|
|
</div>
|
|
|
|
<div class="charMemory_buttonRow">
|
|
<input type="button" id="charMemory_extractNow" class="menu_button" value="Extract Now" title="Extract memories from unprocessed messages. If all messages have been processed, use 'Reset Extraction State' first to re-read from the beginning." />
|
|
<input type="button" id="charMemory_manageMemories" class="menu_button" value="View / Edit" title="Browse, edit, and delete individual stored memories" />
|
|
<input type="button" id="charMemory_consolidate" class="menu_button" value="Consolidate" title="Use the LLM to merge duplicate and related memories into fewer, cleaner entries" />
|
|
<input type="button" id="charMemory_undoConsolidate" class="menu_button" value="Undo Consolidation" title="Restore memories from before the last consolidation (session only)" disabled />
|
|
</div>
|
|
|
|
<!-- Settings (default closed) -->
|
|
<div class="inline-drawer">
|
|
<div class="inline-drawer-toggle inline-drawer-header">
|
|
<b>Settings</b>
|
|
<div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
|
|
</div>
|
|
<div class="inline-drawer-content">
|
|
|
|
<!-- Section 1: LLM Provider -->
|
|
<div class="charMemory_statusRow">
|
|
<label for="charMemory_source" title="Which LLM provider to use for memory extraction and consolidation">
|
|
<small>LLM Provider</small>
|
|
</label>
|
|
<select id="charMemory_source" class="text_pole">
|
|
<option value="main_llm">Main LLM</option>
|
|
<option value="webllm">WebLLM (browser-local)</option>
|
|
<option value="nanogpt">NanoGPT (direct API)</option>
|
|
</select>
|
|
|
|
<div id="charMemory_nanogptSettings" style="display:none;">
|
|
<div class="charMemory_statusRow">
|
|
<label><small>NanoGPT API Key</small></label>
|
|
<div style="display:flex;gap:5px;align-items:center;">
|
|
<input type="password" id="charMemory_nanogptApiKey" class="text_pole" placeholder="Enter API key" style="flex:1;" />
|
|
<input type="button" id="charMemory_nanogptTest" class="menu_button" value="Test" title="Send a minimal request to verify your API key works" />
|
|
</div>
|
|
</div>
|
|
<div class="charMemory_statusRow">
|
|
<label><small>Model</small></label>
|
|
<div class="charMemory_filterRow" style="display:flex;flex-wrap:wrap;gap:8px;margin-bottom:4px;">
|
|
<label class="checkbox_label"><input type="checkbox" id="charMemory_nanogptFilterSub" /> <small>Subscription</small></label>
|
|
<label class="checkbox_label"><input type="checkbox" id="charMemory_nanogptFilterOS" /> <small>Open Source</small></label>
|
|
<label class="checkbox_label"><input type="checkbox" id="charMemory_nanogptFilterRP" /> <small>Roleplay</small></label>
|
|
<label class="checkbox_label"><input type="checkbox" id="charMemory_nanogptFilterReasoning" /> <small>Reasoning</small></label>
|
|
</div>
|
|
<select id="charMemory_nanogptModel" class="text_pole">
|
|
<option value="">-- Select model --</option>
|
|
</select>
|
|
<small id="charMemory_nanogptModelInfo" class="charMemory_helperText"></small>
|
|
</div>
|
|
<div class="charMemory_statusRow">
|
|
<label><small>System prompt (optional)</small></label>
|
|
<textarea id="charMemory_nanogptSystemPrompt" class="text_pole" rows="3" placeholder="Override the default system prompt. Leave blank for default."></textarea>
|
|
<small class="charMemory_helperText">Prepended to extraction/consolidation calls. Use for jailbreaks or custom instructions.</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Section 2: Auto-Extraction -->
|
|
<hr class="charMemory_separator" />
|
|
<small><b>Auto-Extraction</b></small>
|
|
|
|
<div class="charMemory_sliderRow">
|
|
<label for="charMemory_interval" title="How many new messages trigger an automatic extraction. Only counts messages received after the last extraction.">
|
|
<small>Extract after every <span id="charMemory_intervalValue">10</span> messages</small>
|
|
</label>
|
|
<input type="range" id="charMemory_interval" min="3" max="50" step="1" value="10" />
|
|
</div>
|
|
|
|
<div class="charMemory_sliderRow">
|
|
<label for="charMemory_minCooldown" title="Minimum time between auto-extractions, even if the message threshold is met. Prevents rapid-fire extractions. Manual 'Extract Now' bypasses this.">
|
|
<small>Minimum wait between extractions: <span id="charMemory_minCooldownValue">10</span> min</small>
|
|
</label>
|
|
<input type="range" id="charMemory_minCooldown" min="0" max="30" step="1" value="10" />
|
|
</div>
|
|
|
|
<small class="charMemory_helperText">These settings only affect automatic extraction. Manual extraction and batch extraction ignore them.</small>
|
|
|
|
<!-- Section 3: Extraction Settings -->
|
|
<hr class="charMemory_separator" />
|
|
<small><b>Extraction Settings</b></small>
|
|
|
|
<div class="charMemory_sliderRow">
|
|
<label for="charMemory_maxMessages" title="How many messages to include in each LLM call. The system loops through all unprocessed messages in chunks of this size.">
|
|
<small>Messages per LLM call: <span id="charMemory_maxMessagesValue">20</span></small>
|
|
</label>
|
|
<input type="range" id="charMemory_maxMessages" min="5" max="50" step="1" value="20" />
|
|
</div>
|
|
|
|
<div class="charMemory_sliderRow">
|
|
<label for="charMemory_responseLength" title="Maximum tokens the LLM can use for its response. Increase if extractions seem truncated.">
|
|
<small>Max response length: <span id="charMemory_responseLengthValue">500</span></small>
|
|
</label>
|
|
<input type="range" id="charMemory_responseLength" min="100" max="2000" step="50" value="500" />
|
|
</div>
|
|
|
|
<!-- Section 4: Storage -->
|
|
<hr class="charMemory_separator" />
|
|
|
|
<div class="charMemory_statusRow">
|
|
<label class="checkbox_label" for="charMemory_perChat" title="When enabled, each chat gets its own memory file. When disabled, all chats for a character share one file.">
|
|
<input type="checkbox" id="charMemory_perChat" />
|
|
<span>Separate memories per chat</span>
|
|
</label>
|
|
<small class="charMemory_helperText">Each conversation gets its own memory file instead of sharing one per character.</small>
|
|
</div>
|
|
|
|
<div class="charMemory_statusRow">
|
|
<label for="charMemory_fileName" title="Override the auto-generated file name. Leave blank to use the default (based on character name).">
|
|
<small>File name override</small>
|
|
</label>
|
|
<input type="text" id="charMemory_fileName" class="text_pole" placeholder="(auto-generated from character name)" />
|
|
<small class="charMemory_helperText">Leave blank for auto-naming. Set a custom name to override.</small>
|
|
</div>
|
|
|
|
<!-- Section 5: Advanced -->
|
|
<hr class="charMemory_separator" />
|
|
|
|
<div class="charMemory_promptSection">
|
|
<label for="charMemory_extractionPrompt" title="The prompt sent to the LLM for memory extraction. Uses {{charName}}, {{existingMemories}}, {{recentMessages}}, {{char}}, and {{user}} placeholders.">
|
|
<small>Extraction prompt</small>
|
|
</label>
|
|
<textarea id="charMemory_extractionPrompt" class="text_pole textarea_compact" rows="8" placeholder="Enter extraction prompt..."></textarea>
|
|
<input type="button" id="charMemory_restorePrompt" class="menu_button" value="Restore Default Prompt" title="Replace the current prompt with the built-in default" />
|
|
</div>
|
|
|
|
<hr class="charMemory_separator" />
|
|
|
|
<div class="charMemory_statusRow">
|
|
<input type="button" id="charMemory_resetTracking" class="menu_button" value="Reset Extraction State" title="Reset extraction tracking for all of this character's chats so all messages can be re-processed. Does not delete any memories." />
|
|
<small class="charMemory_helperText">Resets extraction tracking for all chats (active + batch). Use before 'Extract Now' or 'Batch Extract' to re-process from the beginning.</small>
|
|
<input type="button" id="charMemory_resetExtraction" class="menu_button charMemory_dangerBtn" value="Clear All Memories" title="Delete the memory file and reset extraction state for all chats. This cannot be undone." />
|
|
<small class="charMemory_helperText">Deletes the memory file and resets extraction tracking for all chats. This cannot be undone.</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Tools & Diagnostics (tabbed, default closed) -->
|
|
<div class="inline-drawer">
|
|
<div class="inline-drawer-toggle inline-drawer-header">
|
|
<b>Tools & Diagnostics</b>
|
|
<div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
|
|
</div>
|
|
<div class="inline-drawer-content">
|
|
<div class="charMemory_tabs">
|
|
<button class="charMemory_tab" data-tab="batch">Batch Extract</button>
|
|
<button class="charMemory_tab active" data-tab="log">Activity Log</button>
|
|
<button class="charMemory_tab" data-tab="diag">Diagnostics</button>
|
|
</div>
|
|
<div class="charMemory_tabContent" id="charMemory_tabBatch" style="display:none;">
|
|
<div class="charMemory_buttonRow">
|
|
<input type="button" id="charMemory_batchRefresh" class="menu_button" value="Refresh" title="Load chat list for this character" />
|
|
<input type="button" id="charMemory_batchExtract" class="menu_button" value="Extract Selected" title="Run extraction on all selected chats" disabled />
|
|
<input type="button" id="charMemory_batchStop" class="menu_button" value="Stop" title="Cancel batch extraction" style="display:none;" />
|
|
</div>
|
|
<div class="charMemory_batchSelectRow">
|
|
<label class="checkbox_label">
|
|
<input type="checkbox" id="charMemory_batchSelectAll" />
|
|
<small>Select all</small>
|
|
</label>
|
|
</div>
|
|
<div id="charMemory_batchProgress" class="charMemory_batchProgress" style="display:none;">
|
|
<div class="charMemory_batchProgressText"></div>
|
|
<div class="charMemory_batchProgressBar"><div class="charMemory_batchProgressFill"></div></div>
|
|
</div>
|
|
<div id="charMemory_batchChatList" class="charMemory_batchChatList">
|
|
<div class="charMemory_diagEmpty">Click "Refresh" to load chats.</div>
|
|
</div>
|
|
</div>
|
|
<div class="charMemory_tabContent" id="charMemory_tabLog">
|
|
<div class="charMemory_buttonRow">
|
|
<input type="button" id="charMemory_clearLog" class="menu_button" value="Clear" title="Clear the activity log" />
|
|
<label class="checkbox_label" for="charMemory_verboseLog" title="Show full LLM prompts and responses in the activity log">
|
|
<input type="checkbox" id="charMemory_verboseLog" />
|
|
<small>Verbose</small>
|
|
</label>
|
|
</div>
|
|
<div id="charMemory_activityLog" class="charMemory_activityLog" style="max-height:300px;overflow-y:auto;font-size:0.85em;font-family:monospace;">
|
|
<div class="charMemory_diagEmpty">No activity yet.</div>
|
|
</div>
|
|
</div>
|
|
<div class="charMemory_tabContent" id="charMemory_tabDiag" style="display:none;">
|
|
<div class="charMemory_buttonRow">
|
|
<input type="button" id="charMemory_refreshDiag" class="menu_button" value="Refresh" title="Capture current diagnostics (lorebook entries, extension prompts, memory file status)" />
|
|
</div>
|
|
<div id="charMemory_diagnosticsContent" class="charMemory_diagnosticsContent">
|
|
<div class="charMemory_diagEmpty">Click "Refresh" after a generation to see diagnostics.</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|