Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14616e1606 | ||
|
|
cf43206c98 | ||
|
|
0922045a38 | ||
|
|
351662d18c |
@@ -208,7 +208,11 @@
|
||||
function renderHeader() {
|
||||
const c = $('header-center');
|
||||
// welcome(含刚 newChat)一律清空:newChat 会停在 welcome,不重刷会残留旧会话标题
|
||||
if (state.view !== 'chat' || !state.sessionId) { c.innerHTML = ''; return; }
|
||||
if (state.view !== 'chat' || !state.sessionId) {
|
||||
c.innerHTML = '';
|
||||
document.title = 'Agent 任务台'; // 回欢迎页/新建会话时标签页恢复默认
|
||||
return;
|
||||
}
|
||||
// 顶部只显标题;助手类型 icon 早已退位(会话阶段徽标随 advising 一并移除)
|
||||
const title = document.createElement('div');
|
||||
title.className = 'header-title';
|
||||
@@ -218,6 +222,8 @@
|
||||
title.addEventListener('click', renameSession); // 点标题重命名(同步 index)
|
||||
c.innerHTML = '';
|
||||
c.appendChild(title);
|
||||
// 标签页标题跟着会话走:切会话/重命名/自动生成标题都会走到这里
|
||||
document.title = state.sessionTitle || 'Agent 任务台';
|
||||
}
|
||||
|
||||
// ---------- 模式切换已移除:新建会话固定用 state.mode(secretary),助手类型不再占顶部 icon
|
||||
|
||||
@@ -452,6 +452,7 @@
|
||||
// 侧栏底部「文件树」图标 → 切到这个面板(由 files.js 的 setDrawerPane 调用)。
|
||||
window.showFileTree = function () {
|
||||
ensureShell();
|
||||
invalidate(true); // 切回面板一律重拉已展开的目录,不拿上次的缓存糊弄(后台只标脏的也在这里补上)
|
||||
renderBody();
|
||||
};
|
||||
|
||||
@@ -462,6 +463,23 @@
|
||||
if (drawer && drawer.classList.contains('drawer-mode-files')) renderBody();
|
||||
};
|
||||
|
||||
// 按需刷新(一轮跑完 / 回前台 / 断线重连):保留展开与勾选,只重拉已展开的目录。
|
||||
// 不在文件树面板时只标脏不渲染,等切回来由 showFileTree 重新拉。
|
||||
let reloadTimer = 0, reloadAt = 0, reloading = false;
|
||||
window.reloadFileTree = function () {
|
||||
clearTimeout(reloadTimer);
|
||||
reloadTimer = setTimeout(async function () {
|
||||
if (Date.now() - reloadAt < 1000) return; // 刚刷过:多路触发(done/visibility/focus/resync)合并掉
|
||||
if (reloading) return; // 上一轮还在渲,跳过(它读到的就是刚清过的缓存)
|
||||
reloadAt = Date.now();
|
||||
invalidate(true);
|
||||
const drawer = $('drawer');
|
||||
if (!drawer || !drawer.classList.contains('drawer-mode-files')) return;
|
||||
reloading = true;
|
||||
try { await renderBody(); } finally { reloading = false; }
|
||||
}, 250);
|
||||
};
|
||||
|
||||
(function init() {
|
||||
if (!$('drawer-actions') || !$('files-tree')) return;
|
||||
req('GET', '/api/local/info').then(function (info) {
|
||||
|
||||
@@ -910,8 +910,9 @@
|
||||
// 全部成功不再弹提示(卡片已完成态即反馈);有失败才提醒
|
||||
if (errCount) toast('已上传 ' + done + ' 个,失败 ' + errCount + ' 个');
|
||||
loadFiles();
|
||||
// 桌面端左栏文件树是新的浏览入口,上传后要同步(旧面板只在手机端用)
|
||||
if (typeof window.refreshFileTree === 'function') window.refreshFileTree();
|
||||
// 桌面端左栏文件树是新的浏览入口,上传后要同步(旧面板只在手机端用);
|
||||
// 用 reloadFileTree 保留展开与勾选,refreshFileTree 会把用户展开的目录全收起来
|
||||
if (typeof window.reloadFileTree === 'function') window.reloadFileTree();
|
||||
// 1.2s 后收起进度条(还有别的批次在传就不收)
|
||||
setTimeout(() => {
|
||||
if (uploadBatches.size) return;
|
||||
|
||||
@@ -124,6 +124,8 @@
|
||||
}).catch(() => {}).then(() => {
|
||||
sseResyncing = false;
|
||||
if (state.sessionId === id && state.view === 'chat' && !state.es) connectStream();
|
||||
// 断点期间的文件变动看不到任何 SSE,补拉完顺手重刷一次文件树
|
||||
if (typeof window.reloadFileTree === 'function') window.reloadFileTree();
|
||||
});
|
||||
}
|
||||
setInterval(() => {
|
||||
|
||||
@@ -473,6 +473,9 @@
|
||||
state.toolCallStreaming = {}; // 流式参数早卡映射随会话/回合重置
|
||||
updateScrollBottomBtn();
|
||||
loadSessionList();
|
||||
// 一轮完整跑完(agent 循环退出才发 done):工具/技能产物可能新增或改名,文件树就地刷新;
|
||||
// 不在文件树面板时 reloadFileTree 只标脏,等切回去再重拉
|
||||
if (typeof window.reloadFileTree === 'function') window.reloadFileTree();
|
||||
});
|
||||
// 服务端首次交互后自动生成的标题(finalize 后约 1s 到达):即时刷新顶栏 + 重拉会话列表(PC 常驻侧边栏/移动抽屉)
|
||||
es.addEventListener('title', ev => {
|
||||
|
||||
Reference in New Issue
Block a user