Internal Communication Optimizer
Analyze your communication patterns and refine your messages for clarity and impact.
Communication Volume by Channel
Sentiment Analysis (Last 30 Days)
Refine Your Message
AI-Powered Suggestions
Suggestions will appear here after analysis.
Your Profile
User ID:
Initializing...
Communication Channels
Analyzing...
`; analyzeBtn.disabled = true; const prompt = `As an expert communication coach, analyze the following internal team message. Provide feedback on its clarity, tone, and engagement potential. Then, provide a revised, improved version of the message. Format your response with ## Feedback, ## Revised Message. \n\nOriginal Message:\n"${message}"`; try { let chatHistory = [{ role: "user", parts: [{ text: prompt }] }]; const payload = { contents: chatHistory }; const apiKey = ""; // Provided by environment const apiUrl = `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-05-20:generateContent?key=${apiKey}`; const response = await fetch(apiUrl, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }); const result = await response.json(); if (result.candidates && result.candidates[0].content.parts[0].text) { const feedbackText = result.candidates[0].content.parts[0].text; // Basic markdown to HTML conversion const formattedFeedback = feedbackText .replace(/## (.*?)\n/g, '$1
') .replace(/\* (.*?)\n/g, ''); feedbackContainer.innerHTML = `
${formattedFeedback}
`;
} else {
throw new Error("Invalid response from API");
}
} catch (error) {
console.error("Error with AI analysis:", error);
feedbackContainer.innerHTML = `Could not get feedback. Please try again.
`; } finally { analyzeBtn.disabled = false; } } // --- SETTINGS UI --- function renderChannelSettings() { const container = document.getElementById('channelSettingsContainer'); container.innerHTML = channels.map((channel, index) => `