mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-06-28 04:12:13 +00:00
Docs: Update benchmark for moonshotai/kimi-k2.7-code
This commit is contained in:
21
tests/8_json_validator/outputs/moonshotai_kimi-k2.7-code.js
Normal file
21
tests/8_json_validator/outputs/moonshotai_kimi-k2.7-code.js
Normal file
@@ -0,0 +1,21 @@
|
||||
let ajv;
|
||||
|
||||
const validateJSON = async (data, schema) => {
|
||||
try {
|
||||
if (!ajv) {
|
||||
const Ajv = (await import('https://esm.sh/ajv@8.17.1')).default;
|
||||
ajv = new Ajv({ allErrors: true, strict: false });
|
||||
}
|
||||
const validate = ajv.compile(schema);
|
||||
const valid = validate(data);
|
||||
return {
|
||||
valid,
|
||||
errors: valid ? [] : validate.errors.map(e => `${e.instancePath || '/'}: ${e.message}`)
|
||||
};
|
||||
} catch (err) {
|
||||
return { valid: false, errors: [err.message] };
|
||||
}
|
||||
};
|
||||
export default validateJSON;
|
||||
// Generation time: 45.178s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user