Add optional AI reply via DeepSeek
Some checks failed
CI/CD Pipeline / build-and-deploy (push) Failing after 3s

Viewers can check a box on the send page to get a short AI-generated
reply to their message, voiced with a distinct TTS voice and queued
on the overlay after the original message. The system prompt lives
in ai-prompt.txt (editable without touching code) instead of being
hardcoded. TTS for both viewer messages and AI replies now announces
who it's from ("Сообщение от X." / "Ответ от ИИ.") before the text.
No-ops entirely if DEEPSEEK_API_KEY isn't set.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-07-01 17:23:41 +00:00
parent 03a3a4c4af
commit 2799dfdf42
6 changed files with 108 additions and 5 deletions

View file

@ -5,6 +5,7 @@ const userName = document.getElementById('user-name');
const logoutBtn = document.getElementById('logout');
const displayNameInput = document.getElementById('display-name');
const messageInput = document.getElementById('message');
const aiReplyCheckbox = document.getElementById('ai-reply');
const sendBtn = document.getElementById('send');
const statusEl = document.getElementById('status');
@ -74,7 +75,8 @@ sendBtn.addEventListener('click', () => {
const text = messageInput.value.trim();
if (!text) return;
const name = displayNameInput.value.trim();
socket.emit('send_message', { token, text, name });
const aiReply = aiReplyCheckbox.checked;
socket.emit('send_message', { token, text, name, aiReply });
messageInput.value = '';
statusEl.textContent = 'Отправлено';
setTimeout(() => { statusEl.textContent = ''; }, 1500);