fix: hide shell access and plan mode buttons in chat mode (#3417)

When in chat mode, the shell access and plan mode buttons should not be
visible. These buttons are only relevant in agent mode where the AI can
use shell commands and planning features.

Changes:
- Modified applyModeToToggles() to hide bash-toggle-btn and plan-toggle-btn
  when mode is 'chat'
- Added immediate hiding on page load to prevent flash of buttons
- Buttons are shown again when switching to agent mode

Fixes #3411

Co-authored-by: michaelxer <michaelxer@users.noreply.github.com>
This commit is contained in:
michaelxer
2026-06-08 16:32:37 +07:00
committed by GitHub
parent 1e0d9b92af
commit 233390546c
+17 -1
View File
@@ -1591,7 +1591,15 @@ function initializeEventListeners() {
function applyModeToToggles(mode) {
MODE_TOOLS.forEach(({ btnId, checkboxId, stateKey }) => {
const btn = el(btnId);
if (!btn || btn.style.display === 'none') return;
if (!btn) return;
// Hide bash and plan buttons in chat mode
if (mode === 'chat' && (stateKey === 'bash' || stateKey === 'plan')) {
btn.style.display = 'none';
return;
}
// Show buttons in agent mode (or for web toggle in any mode)
btn.style.display = '';
if (btn.style.display === 'none') return;
const on = loadToolPref(stateKey, mode);
btn.classList.toggle('active', on);
if (checkboxId) { const chk = el(checkboxId); if (chk) chk.checked = on; }
@@ -1606,6 +1614,14 @@ function initializeEventListeners() {
const state = loadToggleState();
let currentMode = state.mode || 'chat';
// Immediately hide bash/plan buttons in chat mode on page load
if (currentMode === 'chat') {
const bashBtn = el('bash-toggle-btn');
const planBtn = el('plan-toggle-btn');
if (bashBtn) bashBtn.style.display = 'none';
if (planBtn) planBtn.style.display = 'none';
}
function setMode(mode) {
currentMode = mode;
const st = loadToggleState();