adpa-enterprise-framework-automation
Version:
Modular, standards-compliant Node.js/TypeScript automation framework for enterprise requirements, project, and data management. Provides CLI and API for BABOK v3, PMBOK 7th Edition, and DMBOK 2.0 (in progress). Production-ready Express.js API with TypeSpe
38 lines • 1.45 kB
JavaScript
/**
* Migration Helper Processor
* Utility class to handle common AI operations in the migration layer
*/
import { AIProcessor } from "./AIProcessor.js";
export class MigrationHelperProcessor {
/**
* Creates standard message array for AI calls
*
* @param {string} systemPrompt - System prompt defining the AI's role
* @param {string} userPrompt - The main prompt content to send
* @returns {ChatMessage[]} Formatted chat message array
*/
static createMessages(systemPrompt, userPrompt) {
return [
{ role: 'system', content: systemPrompt },
{ role: 'user', content: userPrompt }
];
}
/**
* Generic handler for AI function calls with proper error handling
*
* @param {Function} operation - Async function that makes the actual AI call
* @param {string} operationName - Name of the operation for logging and metrics
* @returns {Promise<string|null>} AI-generated content or null if operation fails
*/
static async handleAICall(operation, operationName) {
try {
const aiProcessor = AIProcessor.getInstance();
return await aiProcessor.processAIRequest(operation, operationName);
}
catch (error) {
console.error(`Migration AI operation failed: ${operationName}`, error.message);
return null;
}
}
}
//# sourceMappingURL=MigrationHelperProcessor.js.map