MTayyaBH
Refactor code structure for improved readability and maintainability
d714fad
Raw
History Blame Contribute Delete
5.71 kB
"use strict";
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.Agent = exports.GroqModel = void 0;
const typeorm_1 = require("typeorm");
const tenant_entity_1 = require("./tenant.entity");
const db_connection_entity_1 = require("./db-connection.entity");
const api_key_entity_1 = require("./api-key.entity");
const knowledge_item_entity_1 = require("./knowledge-item.entity");
const conversation_entity_1 = require("./conversation.entity");
var GroqModel;
(function (GroqModel) {
GroqModel["LLAMA33_70B"] = "llama-3.3-70b-versatile";
GroqModel["LLAMA31_8B"] = "llama-3.1-8b-instant";
GroqModel["LLAMA3_8B"] = "llama3-8b-8192";
GroqModel["GEMMA2_9B"] = "gemma2-9b-it";
GroqModel["LLAMA31_70B"] = "llama-3.1-70b-versatile";
})(GroqModel || (exports.GroqModel = GroqModel = {}));
let Agent = class Agent {
};
exports.Agent = Agent;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], Agent.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)(),
__metadata("design:type", String)
], Agent.prototype, "tenant_id", void 0);
__decorate([
(0, typeorm_1.Column)(),
__metadata("design:type", String)
], Agent.prototype, "name", void 0);
__decorate([
(0, typeorm_1.Column)({ nullable: true }),
__metadata("design:type", String)
], Agent.prototype, "description", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'character varying', length: 100, default: 'llama-3.3-70b-versatile' }),
__metadata("design:type", String)
], Agent.prototype, "model", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'character varying', length: 50, default: 'groq' }),
__metadata("design:type", String)
], Agent.prototype, "ai_provider", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", String)
], Agent.prototype, "ai_api_key_encrypted", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", String)
], Agent.prototype, "system_prompt", void 0);
__decorate([
(0, typeorm_1.Column)({ default: true }),
__metadata("design:type", Boolean)
], Agent.prototype, "is_active", void 0);
__decorate([
(0, typeorm_1.Column)({ default: true }),
__metadata("design:type", Boolean)
], Agent.prototype, "multilingual", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'int', default: 10 }),
__metadata("design:type", Number)
], Agent.prototype, "max_history_messages", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'boolean', default: false }),
__metadata("design:type", Boolean)
], Agent.prototype, "use_langgraph", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'boolean', default: false }),
__metadata("design:type", Boolean)
], Agent.prototype, "use_categories", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
__metadata("design:type", Array)
], Agent.prototype, "categories", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", String)
], Agent.prototype, "core_prompt", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", String)
], Agent.prototype, "style_prompt", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
__metadata("design:type", Object)
], Agent.prototype, "widget_config", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)(),
__metadata("design:type", Date)
], Agent.prototype, "created_at", void 0);
__decorate([
(0, typeorm_1.UpdateDateColumn)(),
__metadata("design:type", Date)
], Agent.prototype, "updated_at", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => tenant_entity_1.Tenant, (tenant) => tenant.agents, { onDelete: 'CASCADE' }),
(0, typeorm_1.JoinColumn)({ name: 'tenant_id' }),
__metadata("design:type", tenant_entity_1.Tenant)
], Agent.prototype, "tenant", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => db_connection_entity_1.DbConnection, (db) => db.agent, { cascade: true }),
__metadata("design:type", Array)
], Agent.prototype, "db_connections", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => api_key_entity_1.ApiKey, (key) => key.agent, { cascade: true }),
__metadata("design:type", Array)
], Agent.prototype, "api_keys", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => knowledge_item_entity_1.KnowledgeItem, (item) => item.agent, { cascade: true }),
__metadata("design:type", Array)
], Agent.prototype, "knowledge_items", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => conversation_entity_1.Conversation, (conv) => conv.agent, { cascade: true }),
__metadata("design:type", Array)
], Agent.prototype, "conversations", void 0);
exports.Agent = Agent = __decorate([
(0, typeorm_1.Entity)('agents')
], Agent);
//# sourceMappingURL=agent.entity.js.map