skailan-ai
Version:
Servicio de IA y procesamiento de lenguaje natural para Skailan
28 lines • 1.17 kB
JavaScript
export class UpdateLLMConfig {
llmConfigRepository;
constructor(llmConfigRepository) {
this.llmConfigRepository = llmConfigRepository;
}
async execute(request) {
const { id, organizationId, ...updates } = request;
const existingConfig = await this.llmConfigRepository.findById(id, organizationId);
if (!existingConfig) {
throw new Error('LLMConfig not found.');
}
if (updates.name !== undefined)
existingConfig.name = updates.name;
if (updates.provider !== undefined)
existingConfig.provider = updates.provider;
if (updates.model !== undefined)
existingConfig.model = updates.model;
if (updates.apiKey !== undefined)
existingConfig.apiKey = updates.apiKey;
if (updates.parameters !== undefined)
existingConfig.parameters = updates.parameters;
if (updates.isActive !== undefined)
existingConfig.isActive = updates.isActive;
existingConfig.updatedAt = new Date();
return this.llmConfigRepository.save(existingConfig);
}
}
//# sourceMappingURL=UpdateLLMConfig.js.map