main #11
File diff suppressed because one or more lines are too long
228590
data/embeddings.json
228590
data/embeddings.json
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -128,7 +128,9 @@ async function loadRawData(): Promise<ToolsData> {
|
||||
const rawData = load(yamlContent);
|
||||
|
||||
try {
|
||||
console.log('Attempting to validate YAML structure...');
|
||||
cachedData = ToolsDataSchema.parse(rawData);
|
||||
console.log('Validation successful!');
|
||||
|
||||
if (!cachedData.skill_levels || Object.keys(cachedData.skill_levels).length === 0) {
|
||||
cachedData.skill_levels = {
|
||||
@ -144,8 +146,18 @@ async function loadRawData(): Promise<ToolsData> {
|
||||
console.log(`[DATA SERVICE] Loaded enhanced data version: ${dataVersion}`);
|
||||
|
||||
} catch (error) {
|
||||
console.error('YAML validation failed:', error);
|
||||
throw new Error('Invalid tools.yaml structure');
|
||||
if (error instanceof z.ZodError) {
|
||||
console.error('ToolsDataSchema validation errors:');
|
||||
error.errors.forEach((err, index) => {
|
||||
console.error(`${index + 1}. Path: ${err.path.join('.')}, Error: ${err.message}`);
|
||||
if (err.input !== undefined) {
|
||||
console.error(` Received:`, typeof err.input === 'object' ? JSON.stringify(err.input, null, 2) : err.input);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error('Non-Zod validation error:', error);
|
||||
}
|
||||
throw new Error(`Invalid tools.yaml structure: ${error}`);
|
||||
}
|
||||
}
|
||||
return cachedData;
|
||||
|
Loading…
x
Reference in New Issue
Block a user