fix: string format skills
This commit is contained in:
@@ -10,7 +10,8 @@ import {
|
|||||||
lastGeneratedData,
|
lastGeneratedData,
|
||||||
committedTrackerData,
|
committedTrackerData,
|
||||||
isGenerating,
|
isGenerating,
|
||||||
setIsGenerating
|
setIsGenerating,
|
||||||
|
setLastActionWasSwipe
|
||||||
} from '../../core/state.js';
|
} from '../../core/state.js';
|
||||||
import { saveChatData } from '../../core/persistence.js';
|
import { saveChatData } from '../../core/persistence.js';
|
||||||
import { generateSeparateUpdatePrompt } from './promptBuilder.js';
|
import { generateSeparateUpdatePrompt } from './promptBuilder.js';
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ import {
|
|||||||
extensionSettings,
|
extensionSettings,
|
||||||
committedTrackerData,
|
committedTrackerData,
|
||||||
lastGeneratedData,
|
lastGeneratedData,
|
||||||
isGenerating
|
isGenerating,
|
||||||
|
lastActionWasSwipe
|
||||||
} from '../../core/state.js';
|
} from '../../core/state.js';
|
||||||
import { evaluateSuppression } from './suppression.js';
|
import { evaluateSuppression } from './suppression.js';
|
||||||
import { parseUserStats } from './parser.js';
|
import { parseUserStats } from './parser.js';
|
||||||
|
|||||||
@@ -279,6 +279,12 @@ export function parseJSONTrackerData(jsonData) {
|
|||||||
debugLog('[RPG Parser] Status fields (filtered):', filteredValues);
|
debugLog('[RPG Parser] Status fields (filtered):', filteredValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parse skills (string)
|
||||||
|
if (jsonData.skills && typeof jsonData.skills === 'string') {
|
||||||
|
extensionSettings.userStats.skills = jsonData.skills;
|
||||||
|
debugLog('[RPG Parser] Skills (string format) extracted from status:', jsonData.skills);
|
||||||
|
}
|
||||||
|
|
||||||
// Parse infoBox - normalize values and filter out null
|
// Parse infoBox - normalize values and filter out null
|
||||||
if (jsonData.infoBox) {
|
if (jsonData.infoBox) {
|
||||||
|
|||||||
@@ -246,6 +246,12 @@ export function generateJSONTrackerInstructions(includeHtmlPrompt = true, includ
|
|||||||
statusJson += '\n }';
|
statusJson += '\n }';
|
||||||
sections.push(statusJson);
|
sections.push(statusJson);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skills section
|
||||||
|
const skillsSectionEnabled = trackerConfig?.userStats?.skillsSection?.enabled || false;
|
||||||
|
if (skillsSectionEnabled && !extensionSettings.showSkills) {
|
||||||
|
sections.push(` "skills": "Skill1, Skill2, Skill3"`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes section (if RPG attributes are enabled and should be included)
|
// Attributes section (if RPG attributes are enabled and should be included)
|
||||||
@@ -536,6 +542,12 @@ export function generateContextualSummary() {
|
|||||||
currentState.status.fields[field] = extensionSettings.userStats.conditions || 'None';
|
currentState.status.fields[field] = extensionSettings.userStats.conditions || 'None';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skills section
|
||||||
|
const skillsSectionEnabled = trackerConfig?.userStats?.skillsSection?.enabled || false;
|
||||||
|
if (skillsSectionEnabled && !extensionSettings.showSkills) {
|
||||||
|
currentState.skills = extensionSettings.userStats?.skills || 'None';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// InfoBox
|
// InfoBox
|
||||||
@@ -676,6 +688,7 @@ export function generateContextualSummary() {
|
|||||||
* @returns {string} Full prompt text for separate tracker generation
|
* @returns {string} Full prompt text for separate tracker generation
|
||||||
*/
|
*/
|
||||||
export function generateRPGPromptText() {
|
export function generateRPGPromptText() {
|
||||||
|
const trackerConfig = extensionSettings.trackerConfig;
|
||||||
let promptText = '';
|
let promptText = '';
|
||||||
|
|
||||||
promptText += `Here are the previous trackers in JSON format that you should consider when responding:\n`;
|
promptText += `Here are the previous trackers in JSON format that you should consider when responding:\n`;
|
||||||
@@ -706,6 +719,12 @@ export function generateRPGPromptText() {
|
|||||||
previousState.status.fields[field] = extensionSettings.userStats.conditions || 'None';
|
previousState.status.fields[field] = extensionSettings.userStats.conditions || 'None';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skills
|
||||||
|
const skillsSectionEnabled = trackerConfig?.userStats?.skillsSection?.enabled || false;
|
||||||
|
if (skillsSectionEnabled && !extensionSettings.showSkills) {
|
||||||
|
previousState.skills = extensionSettings.userStats.skills;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// InfoBox
|
// InfoBox
|
||||||
@@ -759,7 +778,6 @@ export function generateRPGPromptText() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Attributes and level (if RPG attributes are enabled and should be included)
|
// Attributes and level (if RPG attributes are enabled and should be included)
|
||||||
const trackerConfig = extensionSettings.trackerConfig;
|
|
||||||
const showRPGAttributes = trackerConfig?.userStats?.showRPGAttributes;
|
const showRPGAttributes = trackerConfig?.userStats?.showRPGAttributes;
|
||||||
const alwaysSendAttributes = trackerConfig?.userStats?.alwaysSendAttributes;
|
const alwaysSendAttributes = trackerConfig?.userStats?.alwaysSendAttributes;
|
||||||
const shouldSendAttributes = alwaysSendAttributes || extensionSettings.lastDiceRoll;
|
const shouldSendAttributes = alwaysSendAttributes || extensionSettings.lastDiceRoll;
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ export function buildUserStatsText() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add skills if enabled AND not shown in separate tab
|
// Add skills if enabled AND not shown in separate tab
|
||||||
if (config.skillsSection.enabled && stats.skills && !extensionSettings.showSkills) {
|
if (config.skillsSection.enabled && !extensionSettings.showSkills) {
|
||||||
text += `\n${config.skillsSection.label}: ${stats.skills}`;
|
text += `\n${config.skillsSection.label}: ${extensionSettings.userStats?.skills || 'None'}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return text.trim();
|
return text.trim();
|
||||||
|
|||||||
@@ -301,8 +301,8 @@ export function validateTrackerData(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate skills structure if present
|
// Validate skills structure if present
|
||||||
if (data.skills && typeof data.skills !== 'object') {
|
if (data.skills && typeof data.skills !== 'object' && typeof data.skills !== 'string') {
|
||||||
errors.push('skills must be an object');
|
errors.push('skills must be an object or a string');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate quests structure if present
|
// Validate quests structure if present
|
||||||
|
|||||||
Reference in New Issue
Block a user