fix: 修复三个启动相关 Bug
Bug 1: prompt()/confirm() 在 Electron contextIsolation 下不可用 - 新增 prompt-modal.ts 自定义弹窗组件 - 替换 memory-panel.ts、kb-modal.ts、settings-modal.ts、history-modal.ts 中所有 prompt()/confirm() 调用 Bug 2: 日志面板重启后无日志 - log-service.ts 新增 earlyBuffer 缓冲 initLogPanel() 之前的日志 - initLogPanel() 初始化时 flush earlyBuffer 到 DOM - main.ts 中 initLogPanel() 移至最先初始化 Bug 3: 首次启动输入框可能被禁用 - main.ts init() 中防御性重置 IS_STREAMING/IS_HISTORY_VIEW/toolCallingEnabled 等状态 - catch 块也重置关键状态并初始化日志面板
This commit is contained in:
@@ -11,6 +11,7 @@ import { logSetting, logInfo, logWarn, logError, logSuccess } from '../services/
|
||||
import { updateConnectionInfo, updateRunningModels } from './header.js';
|
||||
import { loadModels } from './model-bar.js';
|
||||
import { showToast } from './toast.js';
|
||||
import { showConfirm } from './prompt-modal.js';
|
||||
import { OllamaAPI } from '../api/ollama.js';
|
||||
import { ChatDB } from '../db/chat-db.js';
|
||||
import type { ChatSession } from '../types.js';
|
||||
@@ -96,7 +97,7 @@ export function initSettingsModal(): void {
|
||||
|
||||
document.querySelector('#btnClearAllHistory')!.addEventListener('click', async () => {
|
||||
const db = state.get<ChatDB | null>(KEYS.DB);
|
||||
if (confirm('确定清空所有历史记录?此操作不可恢复!')) {
|
||||
if (await showConfirm('确定清空所有历史记录?此操作不可恢复!', '清空历史')) {
|
||||
logWarn('清空所有历史记录');
|
||||
await db!.clearAll();
|
||||
(document.querySelector('#btnNewChat') as HTMLElement).click();
|
||||
|
||||
Reference in New Issue
Block a user