refactor: remove Agent preset system, fix run_command enable bug

- Delete preset-manager.ts and preset-bar.ts
- Clean up all preset references from main.ts, types.d.ts, state.ts
- Remove preset modal HTML and CSS, rename temp-slider/modal-actions classes
- Fix run_command tool not being enabled (missing setToolEnabled call)
This commit is contained in:
thzxx
2026-04-06 15:44:27 +08:00
parent 9e6fce2c3f
commit 18a24a2a59
9 changed files with 15 additions and 559 deletions
+2 -7
View File
@@ -20,10 +20,9 @@ import { initInputArea } from './components/input-area.js';
import { initSettingsModal, closeSettingsModal } from './components/settings-modal.js';
import { initHistoryModal, closeHistoryModal } from './components/history-modal.js';
import { initKBModal } from './components/kb-modal.js';
import { initPresetBar, initPresetModal } from './components/preset-bar.js';
import { initPresetManager } from './services/preset-manager.js';
import { initVectorStore } from './services/rag.js';
import { initMemoryManager } from './services/memory-manager.js';
import { setToolEnabled } from './services/tool-registry.js';
import { initToolConfirmModal } from './components/tool-confirm-modal.js';
import { initMemoryPanel } from './components/memory-panel.js';
import type { ChatSession } from './types.js';
@@ -155,8 +154,6 @@ async function init(): Promise<void> {
initSettingsModal();
initHistoryModal();
initKBModal();
initPresetBar();
initPresetModal();
initHelpModal();
initToolConfirmModal();
initMemoryPanel();
@@ -167,7 +164,6 @@ async function init(): Promise<void> {
await checkConnection();
await loadModels();
await initVectorStore();
await initPresetManager();
await initMemoryManager();
const savedModel = await db.getSetting('selectedModel', '');
@@ -199,6 +195,7 @@ async function init(): Promise<void> {
const runCommandEnabled = await db.getSetting('runCommandEnabled', false);
state.set('toolCallingEnabled', toolCallingEnabled);
state.set('runCommandEnabled', runCommandEnabled);
if (runCommandEnabled) setToolEnabled('run_command', true);
const toggleTC = document.querySelector<HTMLInputElement>('#toggleToolCalling');
if (toggleTC) toggleTC.checked = toolCallingEnabled;
const toggleRC = document.querySelector<HTMLInputElement>('#toggleRunCommand');
@@ -227,8 +224,6 @@ async function init(): Promise<void> {
initInputArea();
initSettingsModal();
initHistoryModal();
initPresetBar();
initPresetModal();
setupDesktopIntegration();
checkConnection().then(loadModels);
}