education-module-ai
Version:
AI Education Module using Agent Framework
164 lines (163 loc) • 5.03 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.EducationalContentResource = exports.EducationConfigService = exports.DEFAULT_SUBJECTS = exports.DEFAULT_EDUCATIONAL_LEVELS = void 0;
const agent_framework_core_1 = require("@defikitdotnet/agent-framework-core");
/**
* Default educational levels - can be overridden by configuration
*/
exports.DEFAULT_EDUCATIONAL_LEVELS = [
"beginner",
"elementary",
"middle_school",
"high_school",
"undergraduate",
"graduate",
"professional"
];
/**
* Default subject areas - can be overridden by configuration
*/
exports.DEFAULT_SUBJECTS = [
"mathematics",
"science",
"history",
"language_arts",
"computer_science",
"physics",
"chemistry",
"biology"
];
/**
* Education module configuration service
*/
class EducationConfigService {
constructor() {
this._levels = [...exports.DEFAULT_EDUCATIONAL_LEVELS];
this._subjects = [...exports.DEFAULT_SUBJECTS];
}
static getInstance() {
if (!EducationConfigService.instance) {
EducationConfigService.instance = new EducationConfigService();
}
return EducationConfigService.instance;
}
/**
* Configure the education module
*/
configure(config) {
if (config.levels) {
this._levels = config.levels;
}
if (config.subjects) {
this._subjects = config.subjects;
}
}
/**
* Get configured educational levels
*/
get levels() {
return this._levels;
}
/**
* Get configured subjects
*/
get subjects() {
return this._subjects;
}
/**
* Check if a level is valid
*/
isValidLevel(level) {
return this._levels.includes(level);
}
/**
* Check if a subject is valid
*/
isValidSubject(subject) {
return this._subjects.includes(subject);
}
}
exports.EducationConfigService = EducationConfigService;
/**
* Educational content resource model
*/
let EducationalContentResource = class EducationalContentResource {
};
exports.EducationalContentResource = EducationalContentResource;
__decorate([
(0, agent_framework_core_1.Field)({
type: "string",
primary: true,
}),
__metadata("design:type", String)
], EducationalContentResource.prototype, "id", void 0);
__decorate([
(0, agent_framework_core_1.Field)({
type: "string",
required: true,
}),
__metadata("design:type", String)
], EducationalContentResource.prototype, "title", void 0);
__decorate([
(0, agent_framework_core_1.Field)({
type: "string",
required: true,
}),
__metadata("design:type", String)
], EducationalContentResource.prototype, "content", void 0);
__decorate([
(0, agent_framework_core_1.Field)({
type: "string",
required: true,
}),
__metadata("design:type", String)
], EducationalContentResource.prototype, "type", void 0);
__decorate([
(0, agent_framework_core_1.Field)({
type: "string",
required: true,
}),
__metadata("design:type", String)
], EducationalContentResource.prototype, "subject", void 0);
__decorate([
(0, agent_framework_core_1.Field)({
type: "string",
required: true,
}),
__metadata("design:type", String)
], EducationalContentResource.prototype, "level", void 0);
__decorate([
(0, agent_framework_core_1.Field)({
type: "array",
defaultValue: [],
}),
__metadata("design:type", Array)
], EducationalContentResource.prototype, "keywords", void 0);
__decorate([
(0, agent_framework_core_1.Field)({
type: "date",
required: true,
}),
__metadata("design:type", Date)
], EducationalContentResource.prototype, "createdAt", void 0);
__decorate([
(0, agent_framework_core_1.Field)({
type: "date",
}),
__metadata("design:type", Date)
], EducationalContentResource.prototype, "updatedAt", void 0);
exports.EducationalContentResource = EducationalContentResource = __decorate([
(0, agent_framework_core_1.ResourceDecorator)({
name: "educational-contents",
tableName: "educational_contents",
})
], EducationalContentResource);