UNPKG

@autobe/agent

Version:

AI backend server code generator

35 lines (33 loc) 1.45 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.validateEmptyCode = void 0; const utils_1 = require("@autobe/utils"); const validateEmptyCode = (props) => { const errors = []; if (props.draft.includes(props.functionName) === false) errors.push({ path: "$input.request.draft", expected: `string (including function named '${props.functionName}')`, value: props.draft, description: description(props.functionName), }); if (props.revise.final !== null && props.revise.final.includes(props.functionName) === false) errors.push({ path: "$input.request.revise.final", expected: `string (including function named '${props.functionName}')`, value: props.revise.final, description: description(props.functionName), }); return errors; }; exports.validateEmptyCode = validateEmptyCode; const description = (func) => utils_1.StringUtil.trim ` The function ${func} does not exist in the provided code snippet. The first reason of the non-existence is that the code snippet is empty, and the second reason is that AI has written different function name by mistake. Please make sure that the code snippet includes the function ${func}. Note that, you never have to write empty code or different function name. `; //# sourceMappingURL=validateEmptyCode.js.map