feat: 集成 SearXNG 元搜索引擎,支持 JSON API 搜索替代四引擎 HTML 解析

- 新增 SearXNG 配置模态框,支持 API 地址、引擎列表、语言、安全搜索等参数
- 顶部添加独立 🔍 搜索按钮,带启用状态小绿点
- 启用后 web_search 走 SearXNG JSON API(70+ 引擎聚合)
- 禁用时回退原有 Bing+百度+搜狗+360 四引擎 HTML 解析方案
- 认证 Key 通过 HTTP Header Authorization: Bearer 传递,非必填
- 配置持久化到 SQLite settings 表
This commit is contained in:
thzxx
2026-06-12 12:44:41 +08:00
parent fe6de8e30e
commit 7030e69234
5 changed files with 386 additions and 0 deletions
+4
View File
@@ -30,6 +30,7 @@ import { initToolConfirmModal } from './components/tool-confirm-modal.js';
import { initWorkspacePanel, clearToolCardsExternal, clearTerminalExternal, switchToTab } from './components/workspace-panel.js';
import { initLogPanel, addLog } from './services/log-service.js';
import { logInfo, logSuccess, logError, logDebug, logInit, logWarn } from './services/log-service.js';
import { initSearxngModal, closeSearxngModal, loadSearxngConfig } from './components/searxng-modal.js';
import type { ChatSession } from './types.js';
// ─── v4.0 数据迁移:IndexedDB → SQLite ───
@@ -337,12 +338,14 @@ async function init(): Promise<void> {
initTokenDashboard();
initWorkspacePanel();
setupDesktopIntegration();
initSearxngModal();
bindGlobalEvents();
await checkConnection();
await loadModels();
await initMemoryManager();
await loadSearxngConfig(db);
logInit('所有组件已就绪');
const savedModel = await db.getSetting('selectedModel', '');
@@ -458,6 +461,7 @@ function bindGlobalEvents(): void {
closeLightbox();
closeToolsModal();
closeTokenDashboard();
closeSearxngModal();
(document.querySelector('#helpModal') as HTMLElement).style.display = 'none';
(document.querySelector('#memoryModal') as HTMLElement).style.display = 'none';
}