From 7490d483c26f55b3ac02b86769f91ec84332761e Mon Sep 17 00:00:00 2001 From: Meleki Date: Sun, 1 Mar 2026 16:04:00 +0100 Subject: [PATCH] feat: Tool-Call-Anzeige in Settings konfigurierbar (alle/modifikationen/verstecken) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Neue Chat-Section in Settings mit Dropdown für Tool-Call-Sichtbarkeit - Default: Nur Modifikationen (write_file, edit_file, delete_file, memory_write) - isToolVisible() filtert beim Streaming, History und Archiv-Rendering - Reset-Button setzt auch Tool-Call-Einstellung zurück --- TODO.md | 2 +- wwwroot/index.html | 16 ++++++++++++++++ wwwroot/js/chat.js | 10 ++++++++-- wwwroot/js/history.js | 5 ++++- wwwroot/js/pages/settings-page.js | 12 +++++++++++- wwwroot/js/ui.js | 12 ++++++++++++ 6 files changed, 52 insertions(+), 5 deletions(-) diff --git a/TODO.md b/TODO.md index a6e16d8..bad062e 100644 --- a/TODO.md +++ b/TODO.md @@ -20,4 +20,4 @@ - [x] Chat: Es scrollt beim Laden nicht ganz nach unten, ich denke weil im DOM noch etwas nachgeladen wird (ich denke es ist die Schriftart), und die Höhe sich beim Laden nochmal verändert - [x] Chat: User-Nachrichten mit dem Tag [Datei: pfat/zur/datei.xyz:1-10] wird nicht als HTML geparsed - [x] Chat: Wird zwar erkannt und ist klickbar, aber es öffnet sich einfach nur der File Explorer, ohne dass sich die Datei öffnet und die Darstellung in Monospace ist auch nicht schön -- [ ] Chat: Es werden momentan alle Tool-Calls angezeigt - die Anzeige soll individuell in den Einstellungen gemacht werden können. Auswahl aus drei Stufen: "Alle anzeigen" / "Nur Modifikationen" (file änderungen, memory änderungen, etc.) / "Verstecken" +- [x] Chat: Es werden momentan alle Tool-Calls angezeigt - die Anzeige soll individuell in den Einstellungen gemacht werden können. Auswahl aus drei Stufen: "Alle anzeigen" / "Nur Modifikationen" (file änderungen, memory änderungen, etc.) / "Verstecken" diff --git a/wwwroot/index.html b/wwwroot/index.html index 3b67e12..d3e87e1 100644 --- a/wwwroot/index.html +++ b/wwwroot/index.html @@ -208,6 +208,22 @@ +
+

Chat

+
+
+ + Welche Tool-Aufrufe im Chat angezeigt werden +
+
+ +
+
+

Daten

diff --git a/wwwroot/js/chat.js b/wwwroot/js/chat.js index 8860c9d..d3bb3df 100644 --- a/wwwroot/js/chat.js +++ b/wwwroot/js/chat.js @@ -156,11 +156,17 @@ async function sendMessage() { case 'tool_start': endStreamBubble(); - currentToolBox = addToolBoxLoading(data.name); + if (isToolVisible(data.name)) { + currentToolBox = addToolBoxLoading(data.name); + } else { + currentToolBox = null; + } break; case 'tool_end': - finishToolBox(currentToolBox, data); + if (currentToolBox) { + finishToolBox(currentToolBox, data); + } currentToolBox = null; break; diff --git a/wwwroot/js/history.js b/wwwroot/js/history.js index 55aa223..998bc90 100644 --- a/wwwroot/js/history.js +++ b/wwwroot/js/history.js @@ -53,7 +53,9 @@ function renderMessages(msgs, addToConversation) { break; case 'tool_use': - addToolBoxStatic(msg.toolName, msg.content, null, false); + if (isToolVisible(msg.toolName)) { + addToolBoxStatic(msg.toolName, msg.content, null, false); + } break; case 'tool_result': @@ -141,6 +143,7 @@ async function loadLatestArchive() { } break; case 'tool_use': + if (!isToolVisible(msg.toolName)) continue; div.className = 'tool-box archived'; renderToolBoxContent(div, msg.toolName, msg.content, null, false); break; diff --git a/wwwroot/js/pages/settings-page.js b/wwwroot/js/pages/settings-page.js index 06b823e..3964cad 100644 --- a/wwwroot/js/pages/settings-page.js +++ b/wwwroot/js/pages/settings-page.js @@ -3,7 +3,8 @@ const SETTINGS_KEY = 'settings'; const SETTINGS_DEFAULTS = { - pageWidth: 900 + pageWidth: 900, + toolCallDisplay: 'modifications' // 'all' | 'modifications' | 'hidden' }; function loadSettings() { @@ -34,11 +35,13 @@ registerPage('settings', { init() { const slider = document.getElementById('settingPageWidth'); const display = document.getElementById('settingPageWidthValue'); + const toolCallSelect = document.getElementById('settingToolCallDisplay'); const resetBtn = document.getElementById('settingsResetBtn'); const s = loadSettings(); slider.value = s.pageWidth; display.textContent = s.pageWidth + 'px'; + toolCallSelect.value = s.toolCallDisplay; slider.addEventListener('input', () => { display.textContent = slider.value + 'px'; @@ -51,6 +54,12 @@ registerPage('settings', { applySettings(); }); + toolCallSelect.addEventListener('change', () => { + const s = loadSettings(); + s.toolCallDisplay = toolCallSelect.value; + saveSettings(s); + }); + const backupBtn = document.getElementById('settingsBackupBtn'); if (backupBtn) backupBtn.addEventListener('click', async () => { backupBtn.disabled = true; @@ -72,6 +81,7 @@ registerPage('settings', { // Update UI slider.value = SETTINGS_DEFAULTS.pageWidth; display.textContent = SETTINGS_DEFAULTS.pageWidth + 'px'; + toolCallSelect.value = SETTINGS_DEFAULTS.toolCallDisplay; }); }, destroy() {} diff --git a/wwwroot/js/ui.js b/wwwroot/js/ui.js index 76f76f6..dfd4bef 100644 --- a/wwwroot/js/ui.js +++ b/wwwroot/js/ui.js @@ -245,6 +245,18 @@ function endStreamBubble() { _streamText = ''; } +// ── Tool Call Visibility ── + +const MODIFICATION_TOOLS = ['write_file', 'edit_file', 'delete_file', 'memory_write']; + +function isToolVisible(toolName) { + const mode = loadSettings().toolCallDisplay; + if (mode === 'all') return true; + if (mode === 'hidden') return false; + // 'modifications' – nur modifizierende Tools anzeigen + return MODIFICATION_TOOLS.includes(toolName); +} + // ── Tool Boxes ── function addToolBoxLoading(name) {