// lib/ai-helper.js const axios = require('axios'); const config = require('../config.json'); async function chatWithAI(message, overrides = {}) { const settings = { ...config.ai, ...overrides }; const prompt = `You are ${config.bot.name}, ${config.bot.persona}. Keep your responses around ${config.ai.responseLength} words. Respond to: ${message}`; try { const response = await axios.post(settings.ollamaUrl, { model: settings.model, prompt, stream: false }); return response.data.response?.trim() || '...'; } catch (err) { console.error('[AI] Request failed:', err.message); return 'Im confused.'; } } module.exports = { chatWithAI };