UNPKG

skailan-ai

Version:

Servicio de IA y procesamiento de lenguaje natural para Skailan

18 lines 912 B
import { LLMConfig } from '../../domain/entities/LLMConfig'; import { v4 as uuidv4 } from 'uuid'; export class CreateLLMConfig { llmConfigRepository; constructor(llmConfigRepository) { this.llmConfigRepository = llmConfigRepository; } async execute(request) { const { organizationId, name, provider, model, apiKey, parameters, isActive } = request; const existingConfig = await this.llmConfigRepository.findByName(name, organizationId); if (existingConfig) { throw new Error('LLM configuration with this name already exists for this organization.'); } const newConfig = new LLMConfig(uuidv4(), organizationId, name, provider, model, apiKey, parameters || null, isActive !== undefined ? isActive : true, new Date(), new Date()); return this.llmConfigRepository.save(newConfig); } } //# sourceMappingURL=CreateLLMConfig.js.map