fixed auto updating with external api mode
This commit is contained in:
@@ -78,11 +78,11 @@ export async function onGenerationStarted(type, data) {
|
||||
|
||||
const lastMessage = chat && chat.length > 0 ? chat[chat.length - 1] : null;
|
||||
|
||||
// For SEPARATE mode only: Check if we need to commit extension data
|
||||
// For SEPARATE/EXTERNAL mode: Check if we need to commit extension data
|
||||
// BUT: Only do this for the MAIN generation, not the tracker update generation
|
||||
// If isGenerating is true, this is the tracker update generation (second call), so skip flag logic
|
||||
// console.log('[RPG Companion DEBUG] Before generating:', lastGeneratedData.characterThoughts, ' , committed - ', committedTrackerData.characterThoughts);
|
||||
if (extensionSettings.generationMode === 'separate' && !isGenerating) {
|
||||
if ((extensionSettings.generationMode === 'separate' || extensionSettings.generationMode === 'external') && !isGenerating) {
|
||||
if (!lastActionWasSwipe) {
|
||||
// User sent a new message - commit lastGeneratedData before generation
|
||||
// console.log('[RPG Companion] 📝 COMMIT: New message - committing lastGeneratedData');
|
||||
@@ -246,8 +246,8 @@ export async function onGenerationStarted(type, data) {
|
||||
// Clear Spotify prompt if disabled
|
||||
setExtensionPrompt('rpg-companion-spotify', '', extension_prompt_types.IN_CHAT, 0, false);
|
||||
}
|
||||
} else if (extensionSettings.generationMode === 'separate') {
|
||||
// In SEPARATE mode, inject the contextual summary for main roleplay generation
|
||||
} else if (extensionSettings.generationMode === 'separate' || extensionSettings.generationMode === 'external') {
|
||||
// In SEPARATE/EXTERNAL mode, inject the contextual summary for main roleplay generation
|
||||
const contextSummary = generateContextualSummary();
|
||||
|
||||
if (contextSummary) {
|
||||
|
||||
@@ -89,8 +89,8 @@ export function onMessageSent() {
|
||||
setLastActionWasSwipe(false);
|
||||
// console.log('[RPG Companion] 🟢 EVENT: onMessageSent - lastActionWasSwipe =', lastActionWasSwipe);
|
||||
|
||||
// In separate mode with auto-update disabled, commit displayed tracker when user sends a message
|
||||
if (extensionSettings.generationMode === 'separate' && !extensionSettings.autoUpdate) {
|
||||
// In separate/external mode with auto-update disabled, commit displayed tracker when user sends a message
|
||||
if ((extensionSettings.generationMode === 'separate' || extensionSettings.generationMode === 'external') && !extensionSettings.autoUpdate) {
|
||||
// Commit whatever is currently displayed in lastGeneratedData
|
||||
if (lastGeneratedData.userStats || lastGeneratedData.infoBox || lastGeneratedData.characterThoughts) {
|
||||
committedTrackerData.userStats = lastGeneratedData.userStats;
|
||||
@@ -209,8 +209,8 @@ export async function onMessageReceived(data) {
|
||||
// Save to chat metadata
|
||||
saveChatData();
|
||||
}
|
||||
} else if (extensionSettings.generationMode === 'separate') {
|
||||
// In separate mode, also parse Spotify URLs from the main roleplay response
|
||||
} else if (extensionSettings.generationMode === 'separate' || extensionSettings.generationMode === 'external') {
|
||||
// In separate/external mode, also parse Spotify URLs from the main roleplay response
|
||||
const lastMessage = chat[chat.length - 1];
|
||||
if (lastMessage && !lastMessage.is_user) {
|
||||
const responseText = lastMessage.mes;
|
||||
|
||||
@@ -385,8 +385,8 @@ export function updateGenerationModeUI() {
|
||||
$('#rpg-manual-update').show();
|
||||
$('#rpg-external-api-settings').slideDown(200);
|
||||
$('#rpg-separate-mode-settings').slideUp(200);
|
||||
// Disable auto-update toggle (not applicable in external mode)
|
||||
$('#rpg-toggle-auto-update').prop('disabled', true);
|
||||
$('#rpg-auto-update-container').css('opacity', '0.5');
|
||||
// Enable auto-update toggle (works in external mode too)
|
||||
$('#rpg-toggle-auto-update').prop('disabled', false);
|
||||
$('#rpg-auto-update-container').css('opacity', '1');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user