29 lines
744 B
JavaScript
29 lines
744 B
JavaScript
// ── App Init ──
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
// System Prompt Toggle
|
|
$('#showSystem').addEventListener('change', () => {
|
|
$('#systemPrompt').classList.toggle('visible', $('#showSystem').checked);
|
|
});
|
|
|
|
// Send Button
|
|
$('#send').addEventListener('click', sendMessage);
|
|
|
|
// Ctrl+Enter
|
|
$('#input').addEventListener('keydown', (e) => {
|
|
if (e.ctrlKey && e.key === 'Enter') sendMessage();
|
|
});
|
|
|
|
// Auto-Resize Textarea
|
|
$('#input').addEventListener('input', function () {
|
|
this.style.height = 'auto';
|
|
this.style.height = Math.min(this.scrollHeight, 150) + 'px';
|
|
});
|
|
|
|
// Clear Button
|
|
$('#clearBtn').addEventListener('click', clearChat);
|
|
|
|
// History laden
|
|
loadHistory();
|
|
});
|