From ec6d8c4cfe5d89a0d939c5275216bbbd968ec1d8 Mon Sep 17 00:00:00 2001 From: vrubelroman Date: Wed, 8 Jul 2026 17:28:36 +0000 Subject: [PATCH] Let streamers name their AI assistant; fix overlay TTS audio overlap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Streamer dashboard gains an editable AI assistant name (default "Альтушка Ирина"), stored per-streamer and used for the overlay label, TTS intro, and DeepSeek system prompt. Also fixes a bug where a long message's TTS audio could still be playing when the next queued message started its own audio — the overlay queue now waits for the current audio to actually finish (not just the configured display duration) before advancing. --- db.js | 9 +++++++++ public/dashboard.html | 24 ++++++++++++++++++++---- public/overlay.js | 43 ++++++++++++++++++++++++++++++++++++------- public/send.html | 2 +- public/send.js | 10 ++++++++++ server.js | 40 ++++++++++++++++++++++++++++++---------- 6 files changed, 106 insertions(+), 22 deletions(-) diff --git a/db.js b/db.js index 66b9320..8cf088b 100644 --- a/db.js +++ b/db.js @@ -19,6 +19,7 @@ db.exec(` sender_token TEXT UNIQUE NOT NULL, tts_voice TEXT NOT NULL DEFAULT 'ru-RU-DmitryNeural', display_duration_seconds INTEGER NOT NULL DEFAULT 10, + ai_name TEXT NOT NULL DEFAULT 'Альтушка Ирина', created_at INTEGER NOT NULL ); @@ -36,6 +37,9 @@ const existingColumns = db.prepare('PRAGMA table_info(streamers)').all().map((c) if (!existingColumns.includes('display_duration_seconds')) { db.exec('ALTER TABLE streamers ADD COLUMN display_duration_seconds INTEGER NOT NULL DEFAULT 10'); } +if (!existingColumns.includes('ai_name')) { + db.exec("ALTER TABLE streamers ADD COLUMN ai_name TEXT NOT NULL DEFAULT 'Альтушка Ирина'"); +} function generateToken() { return crypto.randomBytes(16).toString('hex'); @@ -86,6 +90,10 @@ function updateDisplayDuration(streamerId, seconds) { db.prepare('UPDATE streamers SET display_duration_seconds = ? WHERE id = ?').run(seconds, streamerId); } +function updateAiName(streamerId, aiName) { + db.prepare('UPDATE streamers SET ai_name = ? WHERE id = ?').run(aiName, streamerId); +} + module.exports = { findStreamerByOverlayToken, findStreamerBySenderToken, @@ -93,4 +101,5 @@ module.exports = { getViewerName, setViewerName, updateDisplayDuration, + updateAiName, }; diff --git a/public/dashboard.html b/public/dashboard.html index a79e50b..795a6c9 100644 --- a/public/dashboard.html +++ b/public/dashboard.html @@ -61,6 +61,9 @@ border: 1px solid #ccc; border-radius: 6px; } + .settings-row input#ai-name { + width: 220px; + } .settings-row button { padding: 8px 16px; cursor: pointer; @@ -101,11 +104,22 @@
сек. -
-
+
+

Имя ИИ-помощника

+

Как зовут вашего ИИ-помощника, который отвечает зрителям (по умолчанию «Альтушка Ирина»).

+
+ +
+
+ +
+ +
+
+

выйти