v3.1.0: Add parser error detection and recommended models section
This commit is contained in:
@@ -147,7 +147,7 @@ export async function generateAvatarsForCharacters(characterNames, onStarted = n
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('[RPG Avatar] Starting batch generation for:', needsGeneration);
|
||||
// console.log('[RPG Avatar] Starting batch generation for:', needsGeneration);
|
||||
|
||||
// Mark all as pending IMMEDIATELY (before any async work)
|
||||
for (const name of needsGeneration) {
|
||||
@@ -192,7 +192,7 @@ export async function generateAvatarsForCharacters(characterNames, onStarted = n
|
||||
}
|
||||
}
|
||||
|
||||
console.log('[RPG Avatar] Batch generation complete');
|
||||
// console.log('[RPG Avatar] Batch generation complete');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -204,7 +204,7 @@ export async function generateAvatarsForCharacters(characterNames, onStarted = n
|
||||
* @returns {Promise<string|null>} New avatar URL or null if failed
|
||||
*/
|
||||
export async function regenerateAvatar(characterName) {
|
||||
console.log('[RPG Avatar] Regenerating avatar for:', characterName);
|
||||
// console.log('[RPG Avatar] Regenerating avatar for:', characterName);
|
||||
|
||||
// Mark as pending immediately
|
||||
pendingGenerations.add(characterName);
|
||||
@@ -245,13 +245,13 @@ async function generateAvatarPrompt(characterName) {
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('[RPG Avatar] Generating LLM prompt for:', characterName);
|
||||
// console.log('[RPG Avatar] Generating LLM prompt for:', characterName);
|
||||
|
||||
const promptMessages = await generateAvatarPromptGenerationPrompt(characterName);
|
||||
let response;
|
||||
|
||||
if (extensionSettings.generationMode === 'external') {
|
||||
console.log('[RPG Avatar] Using external API for avatar prompt generation');
|
||||
// console.log('[RPG Avatar] Using external API for avatar prompt generation');
|
||||
response = await generateWithExternalAPI(promptMessages);
|
||||
} else {
|
||||
response = await generateRaw({
|
||||
@@ -262,7 +262,7 @@ async function generateAvatarPrompt(characterName) {
|
||||
|
||||
if (response) {
|
||||
const prompt = response.trim();
|
||||
console.log(`[RPG Avatar] Generated prompt for ${characterName}:`, prompt);
|
||||
// console.log(`[RPG Avatar] Generated prompt for ${characterName}:`, prompt);
|
||||
|
||||
// Store prompt in session storage
|
||||
setSessionAvatarPrompt(characterName, prompt);
|
||||
@@ -313,11 +313,11 @@ async function generateSingleAvatar(characterName, prompt = null) {
|
||||
}
|
||||
|
||||
if (!prompt) {
|
||||
console.log(`[RPG Avatar] No LLM prompt for ${characterName}, using fallback prompt`);
|
||||
// console.log(`[RPG Avatar] No LLM prompt for ${characterName}, using fallback prompt`);
|
||||
prompt = buildFallbackPrompt(characterName);
|
||||
}
|
||||
|
||||
console.log(`[RPG Avatar] Starting image generation for: ${characterName}`);
|
||||
// console.log(`[RPG Avatar] Starting image generation for: ${characterName}`);
|
||||
|
||||
try {
|
||||
// Execute /sd command with quiet=true to suppress chat output
|
||||
@@ -337,7 +337,7 @@ async function generateSingleAvatar(characterName, prompt = null) {
|
||||
extensionSettings.npcAvatars[characterName] = imageUrl;
|
||||
saveSettings();
|
||||
|
||||
console.log(`[RPG Avatar] Successfully generated avatar for: ${characterName}`);
|
||||
// console.log(`[RPG Avatar] Successfully generated avatar for: ${characterName}`);
|
||||
return imageUrl;
|
||||
} else {
|
||||
console.warn(`[RPG Avatar] Failed to extract image URL for ${characterName}:`, result);
|
||||
|
||||
@@ -49,7 +49,7 @@ export async function setChapterCheckpoint(messageId) {
|
||||
if (previousCheckpoint !== null && previousCheckpoint !== undefined && previousCheckpoint !== messageId && currentlyHiddenRange !== null) {
|
||||
const { start, end } = currentlyHiddenRange;
|
||||
await executeSlashCommandsOnChatInput(`/unhide ${start}-${end}`, { quiet: true });
|
||||
console.log(`[RPG Companion] Unhid previous range: ${start}-${end}`);
|
||||
// console.log(`[RPG Companion] Unhid previous range: ${start}-${end}`);
|
||||
}
|
||||
|
||||
// Store in chat metadata (this automatically overrides any previous checkpoint)
|
||||
@@ -61,13 +61,13 @@ export async function setChapterCheckpoint(messageId) {
|
||||
const rangeEnd = messageId - 1;
|
||||
await executeSlashCommandsOnChatInput(`/hide 0-${rangeEnd}`, { quiet: true });
|
||||
currentlyHiddenRange = { start: 0, end: rangeEnd };
|
||||
console.log(`[RPG Companion] Hidden messages 0-${rangeEnd} (checkpoint at ${messageId})`);
|
||||
// console.log(`[RPG Companion] Hidden messages 0-${rangeEnd} (checkpoint at ${messageId})`);
|
||||
}
|
||||
|
||||
if (previousCheckpoint !== null && previousCheckpoint !== undefined && previousCheckpoint !== messageId) {
|
||||
console.log(`[RPG Companion] Chapter checkpoint moved from message ${previousCheckpoint} to ${messageId}`);
|
||||
// console.log(`[RPG Companion] Chapter checkpoint moved from message ${previousCheckpoint} to ${messageId}`);
|
||||
} else {
|
||||
console.log('[RPG Companion] Chapter checkpoint set at message', messageId);
|
||||
// console.log('[RPG Companion] Chapter checkpoint set at message', messageId);
|
||||
}
|
||||
|
||||
// Emit event for UI updates
|
||||
@@ -91,14 +91,14 @@ export async function clearChapterCheckpoint() {
|
||||
if (currentlyHiddenRange !== null) {
|
||||
const { start, end } = currentlyHiddenRange;
|
||||
await executeSlashCommandsOnChatInput(`/unhide ${start}-${end}`, { quiet: true });
|
||||
console.log(`[RPG Companion] Unhid messages ${start}-${end}`);
|
||||
// console.log(`[RPG Companion] Unhid messages ${start}-${end}`);
|
||||
currentlyHiddenRange = null;
|
||||
}
|
||||
|
||||
delete chat_metadata.rpg_companion_chapter_checkpoint;
|
||||
saveChatDebounced();
|
||||
|
||||
console.log('[RPG Companion] Chapter checkpoint cleared');
|
||||
// console.log('[RPG Companion] Chapter checkpoint cleared');
|
||||
|
||||
// Emit event for UI updates
|
||||
if (typeof document !== 'undefined') {
|
||||
@@ -173,7 +173,7 @@ export async function restoreCheckpointOnLoad() {
|
||||
if (needsRestore) {
|
||||
await executeSlashCommandsOnChatInput(`/hide 0-${rangeEnd}`, { quiet: true });
|
||||
currentlyHiddenRange = { start: 0, end: rangeEnd };
|
||||
console.log(`[RPG Companion] Restored checkpoint: Hidden messages 0-${rangeEnd}`);
|
||||
// console.log(`[RPG Companion] Restored checkpoint: Hidden messages 0-${rangeEnd}`);
|
||||
} else {
|
||||
currentlyHiddenRange = { start: 0, end: rangeEnd };
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ export async function ensureHtmlCleaningRegex(st_extension_settings, saveSetting
|
||||
);
|
||||
|
||||
if (alreadyExists) {
|
||||
console.log('[RPG Companion] HTML cleaning regex already exists, skipping import');
|
||||
// console.log('[RPG Companion] HTML cleaning regex already exists, skipping import');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ export async function ensureHtmlCleaningRegex(st_extension_settings, saveSetting
|
||||
console.warn('[RPG Companion] saveSettingsDebounced is not a function, cannot save HTML regex');
|
||||
}
|
||||
|
||||
console.log('[RPG Companion] ✅ HTML cleaning regex imported successfully');
|
||||
// console.log('[RPG Companion] ✅ HTML cleaning regex imported successfully');
|
||||
} catch (error) {
|
||||
console.error('[RPG Companion] Failed to import HTML cleaning regex:', error);
|
||||
console.error('[RPG Companion] Error details:', error.message, error.stack);
|
||||
@@ -145,7 +145,7 @@ export async function ensureTrackerCleaningRegex(st_extension_settings, saveSett
|
||||
);
|
||||
|
||||
if (alreadyExists) {
|
||||
console.log('[RPG Companion] Tracker cleaning regex already exists, skipping import');
|
||||
// console.log('[RPG Companion] Tracker cleaning regex already exists, skipping import');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ export async function ensureTrackerCleaningRegex(st_extension_settings, saveSett
|
||||
console.warn('[RPG Companion] saveSettingsDebounced is not a function, cannot save tracker cleaning regex');
|
||||
}
|
||||
|
||||
console.log('[RPG Companion] ✅ Tracker cleaning regex imported successfully');
|
||||
// console.log('[RPG Companion] ✅ Tracker cleaning regex imported successfully');
|
||||
} catch (error) {
|
||||
console.error('[RPG Companion] Failed to import tracker cleaning regex:', error);
|
||||
console.error('[RPG Companion] Error details:', error.message, error.stack);
|
||||
|
||||
@@ -32,11 +32,11 @@ export async function ensureJsonCleaningRegex(st_extension_settings, saveSetting
|
||||
);
|
||||
|
||||
if (alreadyExists) {
|
||||
console.log('[RPG Companion] JSON cleaning regex already exists, skipping import');
|
||||
// console.log('[RPG Companion] JSON cleaning regex already exists, skipping import');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('[RPG Companion] Importing JSON cleaning regex for Together mode...');
|
||||
// console.log('[RPG Companion] Importing JSON cleaning regex for Together mode...');
|
||||
|
||||
// Generate a UUID for the script
|
||||
const uuidv4 = () => {
|
||||
@@ -82,8 +82,8 @@ export async function ensureJsonCleaningRegex(st_extension_settings, saveSetting
|
||||
console.warn('[RPG Companion] saveSettingsDebounced is not a function, cannot save JSON cleaning regex');
|
||||
}
|
||||
|
||||
console.log('[RPG Companion] ✅ JSON cleaning regex imported successfully');
|
||||
console.log('[RPG Companion] This regex will automatically remove tracker JSON from Together mode messages');
|
||||
// console.log('[RPG Companion] ✅ JSON cleaning regex imported successfully');
|
||||
// console.log('[RPG Companion] This regex will automatically remove tracker JSON from Together mode messages');
|
||||
} catch (error) {
|
||||
console.error('[RPG Companion] Failed to import JSON cleaning regex:', error);
|
||||
console.error('[RPG Companion] Error details:', error.message, error.stack);
|
||||
@@ -111,7 +111,7 @@ export function removeJsonCleaningRegex(st_extension_settings, saveSettingsDebou
|
||||
);
|
||||
|
||||
if (st_extension_settings.regex.length < initialLength) {
|
||||
console.log('[RPG Companion] Removed JSON cleaning regex');
|
||||
// console.log('[RPG Companion] Removed JSON cleaning regex');
|
||||
if (typeof saveSettingsDebounced === 'function') {
|
||||
saveSettingsDebounced();
|
||||
}
|
||||
|
||||
@@ -52,11 +52,11 @@ export function parseAndStoreSpotifyUrl(responseText) {
|
||||
if (!extensionSettings.enableSpotifyMusic) return false;
|
||||
|
||||
const songData = extractSpotifyUrl(responseText);
|
||||
console.log('[RPG Companion] Spotify Parser: Found song:', songData);
|
||||
// console.log('[RPG Companion] Spotify Parser: Found song:', songData);
|
||||
if (songData) {
|
||||
// Store in committed tracker data
|
||||
committedTrackerData.spotifyUrl = songData;
|
||||
console.log('[RPG Companion] Spotify Parser: Stored song in committedTrackerData:', committedTrackerData.spotifyUrl);
|
||||
// console.log('[RPG Companion] Spotify Parser: Stored song in committedTrackerData:', committedTrackerData.spotifyUrl);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user