jcrewai
Version:
Multi-agent automation framework written in TypeScript. Patterned after CrewAI.
33 lines (32 loc) • 1.38 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseTask = void 0;
const I18N_1 = require("../utilities/I18N");
const stringUtils_1 = require("../utilities/stringUtils");
class BaseTask {
constructor(options) {
this.config = options.config;
this.description = options.description ?? this.config?.description;
this.expectedOutput = options.expectedOutput ?? this.config?.expected_output;
this.outputFile = options.outputFile ?? this.config?.output_file;
this.agent = options.agent ?? this.config?.agent;
this.i18n = new I18N_1.I18N({});
}
interpolateInputs(inputs) {
if (!this.originalDescription) {
this.originalDescription = this.description ?? '';
}
if (!this.originalExpectedOutput) {
this.originalExpectedOutput = this.expectedOutput ?? '';
}
if (!this.originalOutputFile) {
this.originalOutputFile = this.outputFile ?? '';
}
if (inputs) {
this.description = (0, stringUtils_1.interpolate)(this.originalDescription, inputs);
this.expectedOutput = (0, stringUtils_1.interpolate)(this.originalExpectedOutput, inputs);
this.outputFile = (0, stringUtils_1.interpolate)(this.originalOutputFile, inputs);
}
}
}
exports.BaseTask = BaseTask;