修复上下文编排问题、优化子agent消息队列展示UI

This commit is contained in:
minorQAQ committed 2026-08-28 11:32:04 +08:00
1 parent 0ce72f74f1
commit 99f90c2ee8
16 files changed
+369 -481

No files matched your search

+20 -3
View File
@@ -331,6 +331,21 @@ function stopFastAPI() {
}
// ==================== 窗口管理 ====================
// 缓存清理标记:仅首次运行清一次(应用页资源经 FastAPI no-cache 头加载,
// 后续启动无需反复清磁盘缓存,省掉每次启动的等待)
const CACHE_CLEARED_FLAG = () => path.join(app.getPath('userData'), '.cache-cleared');
/** 返回 true 表示本次应清理缓存(首次运行且已写标记);标记写入失败时保持旧行为 */
function ensureInitialCacheClear() {
try {
if (fs.existsSync(CACHE_CLEARED_FLAG())) return false;
fs.writeFileSync(CACHE_CLEARED_FLAG(), String(Date.now()), 'utf-8');
return true;
} catch {
return true;
}
}
async function createMainWindow(themeMode) {
themeMode = themeMode || getThemeMode();
@@ -350,9 +365,11 @@ async function createMainWindow(themeMode) {
show: false,
});
// 清除缓存后再加载,确保获取最新 JS/CSS
await mainWindow.webContents.session.clearCache();
await mainWindow.webContents.session.clearStorageData({ storages: ['caches', 'serviceworkers'] });
// 仅首次运行清除缓存(本地文件与应用页资源不走 HTTP 缓存,无需每次清理)
if (ensureInitialCacheClear()) {
await mainWindow.webContents.session.clearCache();
await mainWindow.webContents.session.clearStorageData({ storages: ['caches', 'serviceworkers'] });
}
// 先显示本地过渡页:毛玻璃 + 中央图标(无任何按钮),主题随 theme_config.json 变化;
// FastAPI 就绪后再切到应用页;应用页自带的同款玻璃覆盖层会无缝接手