fix: include ungrouped conversations in bind/send lists + left-align new-project folder row with wider path
This commit is contained in:
@@ -325,22 +325,33 @@ async function fetchSessionGroups(): Promise<{ groups: { title: string; sessions
|
||||
} catch {}
|
||||
const titleOf = (sid: string) => byId[sid]?.title ?? byId[sid]?.displayTitle ?? sid
|
||||
const mk = (sid: string) => ({ id: sid, title: titleOf(sid), isCurrent: sid === current })
|
||||
// 工作区分组:服务端读宿主 workspace.json(含 archived 排除),按用户面板结构分组
|
||||
// 工作区分组:服务端读宿主 workspace.json(含 archived 排除),按用户面板结构分组;
|
||||
// 不属于任何工作区的会话收进「未分组」组(绑定弹窗/发送到会话都要能看到它们)
|
||||
try {
|
||||
const r = await fetch('/api/worktable/workspaces')
|
||||
const d = await r.json()
|
||||
const order: string[] = Array.isArray(d?.global?.workspaceIds) ? d.global.workspaceIds : []
|
||||
const archived: string[] = Array.isArray(d?.global?.archivedSessionIds) ? d.global.archivedSessionIds : []
|
||||
const table = d?.tables?.workspaces ?? {}
|
||||
const accounted = new Set<string>()
|
||||
const groups = order
|
||||
.map((wid: string) => ({
|
||||
title: (table[wid]?.title ?? wid) as string,
|
||||
sessions: ((table[wid]?.sessionIds ?? []) as string[])
|
||||
.filter((sid) => !archived.includes(sid) && !subKids.has(sid))
|
||||
.map(mk),
|
||||
}))
|
||||
.map((wid: string) => {
|
||||
const sessIds = ((table[wid]?.sessionIds ?? []) as string[])
|
||||
sessIds.forEach((sid) => accounted.add(sid))
|
||||
return {
|
||||
title: (table[wid]?.title ?? wid) as string,
|
||||
sessions: sessIds
|
||||
.filter((sid) => !archived.includes(sid) && !subKids.has(sid))
|
||||
.map(mk),
|
||||
}
|
||||
})
|
||||
.filter((g) => g.sessions.length > 0)
|
||||
if (groups.length > 0) return { groups, current }
|
||||
const allIds: string[] = Array.isArray(snap?.ids) ? snap.ids : []
|
||||
const ungrouped = allIds.filter((sid) => !accounted.has(sid) && !archived.includes(sid) && !subKids.has(sid))
|
||||
const withUngrouped = ungrouped.length > 0
|
||||
? [{ title: '未分组', sessions: ungrouped.map(mk) }, ...groups]
|
||||
: groups
|
||||
if (withUngrouped.length > 0) return { groups: withUngrouped, current }
|
||||
} catch {}
|
||||
// 回退:平铺(排除子代理)
|
||||
const ids: string[] = Array.isArray(snap?.ids) ? snap.ids : []
|
||||
@@ -1534,7 +1545,7 @@ function buildCustomLayoutPrompt(req: string): string {
|
||||
|
||||
{addOpen && <div className="dsh-wt_popBackdrop" onClick={() => setAddOpen(false)} />}
|
||||
{addOpen && (
|
||||
<div className="dsh-wt_menu dsh-wt_add dsh-wt_pop" style={{ position: 'fixed', left: popLeft, top: popTop, width: 320, zIndex: 80 }}>
|
||||
<div className="dsh-wt_menu dsh-wt_add dsh-wt_pop" style={{ position: 'fixed', left: popLeft, top: popTop, width: 360, zIndex: 80 }}>
|
||||
<span className="dsh-wt_menuLabel">{t('add.chooseLayout')}</span>
|
||||
<div className="dsh-wt_presets">
|
||||
{PRESET_DEFS.map((def) => (
|
||||
|
||||
@@ -226,10 +226,10 @@ export const css = [
|
||||
'.dsh-wt_customPathInput{flex:1;min-width:0;box-sizing:border-box;padding:5px 8px;background:var(--dsw-alias-fill-l1,rgba(255,255,255,.03));border:1px solid var(--dsw-alias-border-l1,#262b36);border-radius:6px;color:var(--dsw-alias-label-primary,#e6e8eb);font:inherit;font-size:12px;line-height:18px;outline:none}',
|
||||
'.dsh-wt_customPathInput:focus{border-color:var(--dsw-alias-state-accent-primary,#4f8ef7)}',
|
||||
// 新建项目强制文件夹:两行(父目录/名称)
|
||||
'.dsh-wt_addFolderRow{display:flex;align-items:center;gap:8px;margin-top:6px}',
|
||||
'.dsh-wt_addFolderRow{display:flex;align-items:center;gap:8px;margin-top:6px;padding:0 2px}',
|
||||
'.dsh-wt_addFolderPath{flex:1;min-width:0;padding:4px 8px;border:1px solid var(--dsw-alias-border-l1,#262b36);border-radius:6px;background:var(--dsw-alias-fill-l1,rgba(255,255,255,.03));font-size:11.5px;line-height:17px;color:var(--dsw-alias-label-primary,#e6e8eb);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
|
||||
'.dsh-wt_addFolderPathNone{color:var(--dsw-alias-label-tertiary,#6b7280);border-style:dashed}',
|
||||
'.dsh-wt_addFolderRow .dsh-wt_customLabel{width:86px;text-align:right}',
|
||||
'.dsh-wt_addFolderRow .dsh-wt_customLabel{flex:none;width:auto;text-align:left}',
|
||||
// 绑定弹窗内的项目文件夹区
|
||||
'.dsh-wt_bindFolderBox{margin-top:8px;padding:6px 8px;background:var(--dsw-alias-fill-l1,rgba(255,255,255,.03));border:1px solid var(--dsw-alias-border-l1,#262b36);border-radius:8px}',
|
||||
'.dsh-wt_bindFolderRow{display:flex;align-items:center;justify-content:space-between}',
|
||||
|
||||
@@ -914,6 +914,20 @@
|
||||
ERROR_COUNT: 0。
|
||||
- 备注:纯客户端改动,F5 即生效。
|
||||
|
||||
## 补记(未分组会话入列表 + 新建面板文件夹行左对齐)
|
||||
|
||||
- 用户反馈:① 新建布局面板「项目文件夹」行左侧有空隙、地址栏太短;② 绑定对话与发送到会话
|
||||
的列表里都没有「未分组」的对话。
|
||||
- 处理:① 文件夹行标签去掉 86px 右对齐固定宽(width:auto/text-align:left,与名称输入框左缘
|
||||
对齐),地址显示条 flex:1 拉长,面板 320 → 360 宽;② fetchSessionGroups 增「未分组」组——
|
||||
收集所有工作区已归属会话后,把 snap.ids 中不属于任何工作区(且非 archived/子代理)的会话
|
||||
归入「📁 未分组」组,排在列表最前。绑定弹窗与发送到会话共用该函数,一处修复两处生效。
|
||||
- 验证(probe-batch9.cjs):期望未分组 5 个 → 组标题 [📁 未分组, 📁 Projects, 📁 DeepseekHarness]、
|
||||
列表 19 项(14+5)✓;文件夹行 text-align=left、标签左缘 304 ≈ 行左缘 302、与名称输入框对齐 ✓;
|
||||
functional-diag 全 20 STEP(groupHeaders 3 / itemCount 19)ERROR_COUNT: 0。
|
||||
- 备注:纯客户端改动,F5 即生效。
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
// probe-batch9.cjs — 未分组会话进入列表 + 新建面板文件夹行左对齐
|
||||
const http = require('http');
|
||||
const { spawn } = require('child_process');
|
||||
const WebSocket = require('ws');
|
||||
const PORT = 9353;
|
||||
const proc = spawn('C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe', [
|
||||
'--headless=new', '--disable-gpu', '--no-first-run', '--no-default-browser-check',
|
||||
'--window-size=1440,900', '--force-device-scale-factor=1',
|
||||
'--remote-debugging-port=' + PORT,
|
||||
'--user-data-dir=C:\\Users\\SJL\\AppData\\Local\\Temp\\wt-chrome-batch9',
|
||||
'about:blank',
|
||||
], { stdio: 'ignore' });
|
||||
const getJSON = (p) => new Promise((res, rej) => {
|
||||
http.get({ host: '127.0.0.1', port: PORT, path: p }, (r) => { let d=''; r.on('data',c=>d+=c); r.on('end',()=>{try{res(JSON.parse(d))}catch(e){rej(e)}}) }).on('error', rej);
|
||||
});
|
||||
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||
(async () => {
|
||||
let list = null;
|
||||
for (let i = 0; i < 40; i++) { try { list = await getJSON('/json/list'); if (list && list.length) break; } catch {} await sleep(500); }
|
||||
const target = list.find((t) => t.type === 'page') || list[0];
|
||||
const ws = new WebSocket(target.webSocketDebuggerUrl);
|
||||
let id = 0; const pending = new Map();
|
||||
const send = (method, params) => new Promise((res) => { const mid = ++id; pending.set(mid, res); ws.send(JSON.stringify({ id: mid, method, params })); });
|
||||
ws.on('message', (raw) => { const m = JSON.parse(String(raw)); if (m.id && pending.has(m.id)) { pending.get(m.id)(m); pending.delete(m.id); } });
|
||||
await new Promise((r) => ws.on('open', r));
|
||||
await send('Runtime.enable');
|
||||
await send('Page.enable');
|
||||
await send('Page.addScriptToEvaluateOnNewDocument', {
|
||||
source: "try{ if(window===window.top && location.origin==='http://127.0.0.1:3080'){ localStorage.setItem('dsh.worktable.projects.v1', JSON.stringify({order:[],lastUsed:{},hidden:[],nameOverrides:{},shortcuts:[],layouts:[{id:'t-layout',title:'L',top:null,left:null,main:[{id:'p1',title:'W',min:200,content:null}],chatWidth:{default:320,min:240,max:600},chatSide:'right',chatFullHeight:false}],bindings:{},folders:{}})); } }catch(e){}",
|
||||
});
|
||||
await send('Page.navigate', { url: 'http://127.0.0.1:3080/' });
|
||||
const evaluate = async (expr) => {
|
||||
const r = await send('Runtime.evaluate', { expression: expr, returnByValue: true, awaitPromise: true });
|
||||
if (r.result && r.result.exceptionDetails) return { __error: (r.result.exceptionDetails.exception || {}).description || r.result.exceptionDetails.text };
|
||||
return r.result && r.result.result ? r.result.result.value : undefined;
|
||||
};
|
||||
let ready = null;
|
||||
for (let i = 0; i < 30; i++) { await sleep(1000); ready = await evaluate("!!window.__dshWorktable && !!window.__dshSessions"); if (ready === true) break; }
|
||||
await sleep(1500);
|
||||
const step = await evaluate(`(async function(){
|
||||
var out = {};
|
||||
var sleep = function(ms){ return new Promise(function(r){ setTimeout(r, ms); }); };
|
||||
var vis = function(sel){ return [].slice.call(document.querySelectorAll(sel)).find(function(el){ return (getComputedStyle(el).visibility!=='hidden'&&el.getBoundingClientRect().height>0); }); };
|
||||
try {
|
||||
// 期望的未分组会话集合(与 fetchSessionGroups 同逻辑)
|
||||
var snap = window.__dshSessions.list.getSnapshot();
|
||||
var ws = await (await fetch('/api/worktable/workspaces')).json();
|
||||
var accounted = {};
|
||||
var order = ws.global.workspaceIds || [];
|
||||
order.forEach(function(wid){ (ws.tables.workspaces[wid].sessionIds||[]).forEach(function(s){ accounted[s]=true; }); });
|
||||
var archived = (ws.global.archivedSessionIds||[]).slice();
|
||||
var expectedUngrouped = (snap.ids||[]).filter(function(s){ return !accounted[s] && archived.indexOf(s) < 0; });
|
||||
out.expectedUngroupedCount = expectedUngrouped.length;
|
||||
// 打开绑定弹窗(第一个布局卡)
|
||||
var card = document.querySelector('.dsh-wt_layout');
|
||||
var bbtn = card && card.querySelector('.dsh-wt_bindBtn');
|
||||
if (bbtn) { bbtn.click(); }
|
||||
await sleep(900);
|
||||
var groups = [].slice.call(document.querySelectorAll('.dsh-wt_bindList .dsh-wt_selectGroup'));
|
||||
out.groupTitles = groups.map(function(g){ return String(g.textContent).trim(); });
|
||||
out.hasUngroupedHeader = groups.some(function(g){ return String(g.textContent).indexOf('未分组') >= 0; });
|
||||
var allItems = [].slice.call(document.querySelectorAll('.dsh-wt_bindList .dsh-wt_selectItem'));
|
||||
out.listItemCount = allItems.length;
|
||||
out.expectedAllIn = expectedUngrouped.every(function(sid){
|
||||
return allItems.length > 0;
|
||||
});
|
||||
var bd = [].slice.call(document.querySelectorAll('.dsh-wt_popBackdrop')).find(function(el){ return (getComputedStyle(el).visibility!=='hidden'&&el.getBoundingClientRect().height>0); });
|
||||
if (bd) { bd.click(); }
|
||||
await sleep(300);
|
||||
// 新建面板文件夹行:标签左对齐 + 地址条宽度
|
||||
document.querySelectorAll('.dsh-wt_actions .dsh-wt_iconBtn')[2].click();
|
||||
await sleep(350);
|
||||
var label = vis('.dsh-wt_addFolderRow .dsh-wt_customLabel');
|
||||
var path = vis('.dsh-wt_addFolderPath');
|
||||
out.folderLabelAlign = label ? getComputedStyle(label).textAlign : null;
|
||||
out.folderLabelWidth = label ? label.getBoundingClientRect().width : null;
|
||||
out.folderPathWidth = path ? Math.round(path.getBoundingClientRect().width) : null;
|
||||
var rowRect = vis('.dsh-wt_addFolderRow').getBoundingClientRect();
|
||||
var nameInput = document.querySelector('.dsh-wt_addForm input');
|
||||
out.nameLeft = nameInput ? Math.round(nameInput.getBoundingClientRect().left) : null;
|
||||
out.rowLeft = Math.round(rowRect.left);
|
||||
out.labelLeft = label ? Math.round(label.getBoundingClientRect().left) : null;
|
||||
} catch(e) { out.err = String(e); }
|
||||
return JSON.stringify(out);
|
||||
})()`);
|
||||
console.log('BATCH9:', JSON.stringify(step));
|
||||
ws.close(); proc.kill(); process.exit(0);
|
||||
})().catch((e) => { console.error('FATAL', e && e.stack || e); try { proc.kill(); } catch {} process.exit(1); });
|
||||
Reference in New Issue
Block a user