Files
unai/scripts/testChatbot.ts
T
2025-07-14 10:14:20 +04:00

27 lines
806 B
TypeScript

import dotenv from 'dotenv';
// Load environment variables from .env.local
dotenv.config({ path: '.env.local' });
import UTASChatBot from '../src/lib/chatbot';
async function runTests() {
const apiKey = process.env.OPENROUTER_API_KEY;
if (!apiKey) {
console.error('Missing OPENROUTER_API_KEY in environment');
process.exit(1);
}
const bot = new UTASChatBot(apiKey);
console.log('=== English Test ===');
const engResponse = await bot.generateResponse('Hello, what scholarships do you offer?');
console.log(engResponse);
console.log('\n=== Arabic Test ===');
const arResponse = await bot.generateResponse('ما هي المنح المتاحة؟');
console.log(arResponse);
}
runTests().catch(err => {
console.error('Error during chatbot tests:', err);
process.exit(1);
});