Docs: Update benchmark for moonshotai/kimi-k2-thinking

This commit is contained in:
github-actions[bot]
2025-11-15 00:13:33 +00:00
parent da087e9ca0
commit 0d5effb238
10 changed files with 176 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
const cache = new WeakMap();
let ajv;
async function validateJSON(json, schema) {
try {
if (!ajv) {
const { default: Ajv } = await import('https://cdn.jsdelivr.net/npm/ajv@8/dist/ajv.mjs');
ajv = new Ajv({ allErrors: true, strict: false });
}
const validator = cache.get(schema) || (cache.set(schema, ajv.compile(schema)), cache.get(schema));
const valid = validator(json);
return { valid, errors: valid ? [] : validator.errors.map(e => `${e.instancePath} ${e.message}`.trim()) };
} catch (error) {
return { valid: false, errors: [error.message] };
}
}
export default validateJSON;