Notification
delete_forever
Delete Chat?
This action cannot be undone.
`;
const adBanner = `
`;
if (!chat.messages.length) {
container.innerHTML = `
Vikram Ultimate
Engineered for speed. Powered by Groq LPU™.
${['Code a Python Snake Game', 'Explain Quantum Entanglement', 'Generate a Cyberpunk City', 'Analyze this Image'].map(t =>
``
).join('')}
`;
return;
}
let html = chat.messages.map((msg, i) => {
const isUser = msg.role === 'user';
if (isUser) {
return `
${msg.image ? `

` : ''}
${msg.content}
`;
}
if (msg.loading) {
return `
`;
}
const aiLabel = `Vikram AI bolt
`;
if (msg.type === 'image') {
return `
`;
}
return `
${aiLabel}
${marked.parse(msg.content)}
`;
}).join('');
// Append Ads to the HTML stream
html += adSlide;
html += adBanner;
container.innerHTML = html;
container.querySelectorAll('pre code').forEach(el => hljs.highlightElement(el));
if (window.renderMathInElement) {
renderMathInElement(container, {
delimiters: [{left: '$$', right: '$$', display: true}, {left: '$', right: '$', display: false}],
throwOnError: false
});
}
this.scrollToBottom();
}
scrollToBottom() {
const c = document.getElementById('messages');
if(c) c.scrollTo({ top: c.scrollHeight, behavior: 'smooth' });
}
showToast(msg) {
const t = document.getElementById('toast');
t.innerText = msg;
t.style.opacity = '1';
t.style.transform = 'translate(-50%, 0)';
setTimeout(() => {
t.style.opacity = '0';
t.style.transform = 'translate(-50%, -20px)';
}, 2000);
}
}
const app = new VikramApp();