feat: Tool-Call-Anzeige in Settings konfigurierbar (alle/modifikationen/verstecken)
- 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
This commit is contained in:
1 parent
0b842357a3
commit
7490d483c2
6 files changed
+52
-5
No files matched your search
+8
-2
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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() {}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user