diff --git a/public/js/chat.js b/public/js/chat.js
index c2db31f..b75f256 100644
--- a/public/js/chat.js
+++ b/public/js/chat.js
@@ -258,6 +258,12 @@
if (typing) typing.remove();
addMessage('assistant', ev.content || '(keine Antwort)');
}
+ // Live-update the auto-generated thread title in the sidebar.
+ if (ev.titel && activeId) {
+ const li = threadList && threadList.querySelector('li[data-thread-li="' + activeId + '"]');
+ const titleEl = li && li.querySelector('.threadLink .font-medium');
+ if (titleEl && ev.titel && ev.titel !== titleEl.textContent) titleEl.textContent = ev.titel;
+ }
scrollBottom();
} else if (ev.type === 'error') {
if (typing) typing.remove();
diff --git a/server.js b/server.js
index c4511e9..fdf0af3 100644
--- a/server.js
+++ b/server.js
@@ -2546,7 +2546,8 @@ initializeDatabase().then(() => {
[threadId, 'assistant', saved]
);
await dbRun('UPDATE chat_threads SET updated_at = CURRENT_TIMESTAMP WHERE id = ?', [threadId]);
- send({ type: 'done', messageId: lastID, content: saved });
+ const threadRow = await dbGet('SELECT titel FROM chat_threads WHERE id = ?', [threadId]);
+ send({ type: 'done', messageId: lastID, content: saved, titel: threadRow && threadRow.titel });
} catch (error) {
send({ type: 'error', message: 'Antwort konnte nicht gespeichert werden.' });
}
diff --git a/views/partials/footer.ejs b/views/partials/footer.ejs
index ff3187c..e81a1ff 100644
--- a/views/partials/footer.ejs
+++ b/views/partials/footer.ejs
@@ -12,7 +12,7 @@
class="fixed bottom-5 right-5 z-40 flex items-center gap-2 rounded-full bg-blue-600 hover:bg-blue-700 text-white shadow-lg px-4 py-3 text-sm font-medium transition-colors"
title="KI-Bewerbungs-Assistent öffnen">
KI-Chat