Clean up debug logging in history injection
This commit is contained in:
@@ -103,12 +103,12 @@ function buildHistoricalContextMap() {
|
|||||||
// 2. message.swipe_info[swipeId].extra.rpg_companion_swipes (loaded from file)
|
// 2. message.swipe_info[swipeId].extra.rpg_companion_swipes (loaded from file)
|
||||||
const currentSwipeId = message.swipe_id || 0;
|
const currentSwipeId = message.swipe_id || 0;
|
||||||
let swipeData = message.extra?.rpg_companion_swipes;
|
let swipeData = message.extra?.rpg_companion_swipes;
|
||||||
|
|
||||||
// If not in message.extra, check swipe_info
|
// If not in message.extra, check swipe_info
|
||||||
if (!swipeData && message.swipe_info && message.swipe_info[currentSwipeId]) {
|
if (!swipeData && message.swipe_info && message.swipe_info[currentSwipeId]) {
|
||||||
swipeData = message.swipe_info[currentSwipeId].extra?.rpg_companion_swipes;
|
swipeData = message.swipe_info[currentSwipeId].extra?.rpg_companion_swipes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!swipeData) {
|
if (!swipeData) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -169,30 +169,30 @@ function buildHistoricalContextMap() {
|
|||||||
function injectHistoricalContextIntoChat() {
|
function injectHistoricalContextIntoChat() {
|
||||||
const historyPersistence = extensionSettings.historyPersistence;
|
const historyPersistence = extensionSettings.historyPersistence;
|
||||||
if (!historyPersistence || !historyPersistence.enabled) {
|
if (!historyPersistence || !historyPersistence.enabled) {
|
||||||
console.log('[RPG Companion] History persistence not enabled, skipping injection');
|
// console.log('[RPG Companion] History persistence not enabled, skipping injection');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentSuppressionState || !extensionSettings.enabled) {
|
if (currentSuppressionState || !extensionSettings.enabled) {
|
||||||
console.log('[RPG Companion] Skipping history injection: suppressed or disabled');
|
// console.log('[RPG Companion] Skipping history injection: suppressed or disabled');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const context = getContext();
|
const context = getContext();
|
||||||
const chat = context.chat;
|
const chat = context.chat;
|
||||||
if (!chat || chat.length < 2) {
|
if (!chat || chat.length < 2) {
|
||||||
console.log('[RPG Companion] Chat too short, skipping history injection');
|
// console.log('[RPG Companion] Chat too short, skipping history injection');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the context map
|
// Build the context map
|
||||||
const contextMap = buildHistoricalContextMap();
|
const contextMap = buildHistoricalContextMap();
|
||||||
if (contextMap.size === 0) {
|
if (contextMap.size === 0) {
|
||||||
console.log('[RPG Companion] No historical context to inject');
|
// console.log('[RPG Companion] No historical context to inject');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`[RPG Companion] Injecting historical context into ${contextMap.size} messages`);
|
// console.log(`[RPG Companion] Injecting historical context into ${contextMap.size} messages`);
|
||||||
|
|
||||||
// Clear any previous stored content
|
// Clear any previous stored content
|
||||||
originalMessageContent.clear();
|
originalMessageContent.clear();
|
||||||
@@ -210,10 +210,10 @@ function injectHistoricalContextIntoChat() {
|
|||||||
// Modify the message in-place
|
// Modify the message in-place
|
||||||
message.mes = message.mes + ctxContent;
|
message.mes = message.mes + ctxContent;
|
||||||
injectedCount++;
|
injectedCount++;
|
||||||
console.log(`[RPG Companion] Injected context into message ${msgIdx}`);
|
// console.log(`[RPG Companion] Injected context into message ${msgIdx}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`[RPG Companion] Successfully injected historical context into ${injectedCount} messages`);
|
// console.log(`[RPG Companion] Successfully injected historical context into ${injectedCount} messages`);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -228,7 +228,7 @@ function restoreOriginalMessageContent() {
|
|||||||
const context = getContext();
|
const context = getContext();
|
||||||
const chat = context.chat;
|
const chat = context.chat;
|
||||||
|
|
||||||
console.log(`[RPG Companion] Restoring ${originalMessageContent.size} messages to original content`);
|
// console.log(`[RPG Companion] Restoring ${originalMessageContent.size} messages to original content`);
|
||||||
|
|
||||||
for (const [msgIdx, originalContent] of originalMessageContent) {
|
for (const [msgIdx, originalContent] of originalMessageContent) {
|
||||||
if (chat[msgIdx]) {
|
if (chat[msgIdx]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user