jcrewai
Version:
Multi-agent automation framework written in TypeScript. Patterned after CrewAI.
34 lines (33 loc) • 953 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.I18N = void 0;
const lodash_1 = require("lodash");
const en_json_1 = __importDefault(require("../translations/en.json"));
class I18N {
constructor(customPrompts) {
if (customPrompts) {
this.prompts = (0, lodash_1.merge)(en_json_1.default, customPrompts);
}
}
retrieve(kind, key) {
try {
return this.prompts[kind][key];
}
catch (error) {
throw new Error(`Prompt for '${kind}':'${key}' not found.`);
}
}
slice(key) {
return this.retrieve('slices', key);
}
errors(key) {
return this.retrieve('errors', key);
}
tools(key) {
return this.retrieve('tools', key);
}
}
exports.I18N = I18N;