fix(workbench): 右栏自适应与任务摘要交互
This commit is contained in:
parent
710c59cea4
commit
d58df84c19
|
|
@ -530,32 +530,16 @@ function renderRichText(text) {
|
|||
if (code !== null) blocks.push((0, import_react.createElement)("pre", { className: "rs-code", key: "code-" + blocks.length }, (0, import_react.createElement)("code", null, code.join("\n"))));
|
||||
return blocks;
|
||||
}
|
||||
function ResultSummary(props) {
|
||||
const [expanded, setExpanded] = (0, import_react.useState)(false);
|
||||
function SummaryBlock(props) {
|
||||
const text = String(props && props.text ? props.text : "").trim();
|
||||
const label = props && props.label ? props.label : "摘要";
|
||||
const empty = props && props.empty ? props.empty : "(暂无内容)";
|
||||
if (!text) {
|
||||
return (0, import_react.createElement)(
|
||||
"div",
|
||||
{ className: "result-summary is-empty" },
|
||||
label ? (0, import_react.createElement)("span", { className: "t-label" }, label) : null,
|
||||
(0, import_react.createElement)("span", { className: "rs-empty" }, empty)
|
||||
);
|
||||
}
|
||||
const parsed = splitResultText(text);
|
||||
const max = props && props.max ? props.max : 120;
|
||||
return (0, import_react.createElement)(
|
||||
"div",
|
||||
{ className: "result-summary" + (expanded ? " is-expanded" : "") },
|
||||
(0, import_react.createElement)(
|
||||
"div",
|
||||
{ className: "rs-line" },
|
||||
label ? (0, import_react.createElement)("span", { className: "t-label" }, label) : null,
|
||||
(0, import_react.createElement)("span", { className: "rs-summary" }, parsed.summary)
|
||||
),
|
||||
parsed.points.length > 0 ? (0, import_react.createElement)("ul", { className: "rs-points" }, parsed.points.map((point, index) => (0, import_react.createElement)("li", { key: index }, point))) : null,
|
||||
parsed.hasMore || parsed.points.length > 0 || text.includes("\n") ? (0, import_react.createElement)("button", { type: "button", className: "rs-toggle", onClick: () => setExpanded((value) => !value), "aria-expanded": expanded ? "true" : "false" }, expanded ? "收起详情" : "展开详情") : null,
|
||||
expanded ? (0, import_react.createElement)("div", { className: "rs-detail" }, renderRichText(text)) : null
|
||||
{ className: "card-summary" + (text ? "" : " is-empty") },
|
||||
label ? (0, import_react.createElement)("span", { className: "t-label" }, label) : null,
|
||||
(0, import_react.createElement)("p", { className: "card-summary-text" }, text ? shortText(text, max) : empty)
|
||||
);
|
||||
}
|
||||
function fileIcon(paths, size) {
|
||||
|
|
@ -612,6 +596,8 @@ function WorkbenchV2(props) {
|
|||
const [selectedTask, setSelectedTask] = (0, import_react.useState)(null);
|
||||
const [reviewPanelOpen, setReviewPanelOpen] = (0, import_react.useState)(false);
|
||||
const [durationPanelOpen, setDurationPanelOpen] = (0, import_react.useState)(false);
|
||||
const [tokenPanelOpen, setTokenPanelOpen] = (0, import_react.useState)(false);
|
||||
const [queuePanelOpen, setQueuePanelOpen] = (0, import_react.useState)(false);
|
||||
const [draft, setDraft] = (0, import_react.useState)({});
|
||||
const [busy, setBusy] = (0, import_react.useState)(false);
|
||||
const [summaryBusy, setSummaryBusy] = (0, import_react.useState)(false);
|
||||
|
|
@ -954,29 +940,6 @@ function WorkbenchV2(props) {
|
|||
...extra || []
|
||||
);
|
||||
}
|
||||
function renderTabs() {
|
||||
const entries = [
|
||||
{ id: "overview", label: "总览", icon: ["M3 3h7v9H3z", "M14 3h7v5h-7z", "M14 12h7v9h-7z", "M3 16h7v5H3z"] },
|
||||
{ id: "queue", label: "派工队列", icon: ["m22 2-7 20-4-9-9-4Z", "M22 2 11 13"] },
|
||||
{ id: "memory", label: "记忆", icon: ["M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"] },
|
||||
{ id: "token", label: "Token 用量", icon: ["M12 2v20", "M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"] },
|
||||
{ id: "settings", label: "设置", icon: ["M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z", "M12 12a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"] }
|
||||
];
|
||||
return (0, import_react.createElement)(
|
||||
"nav",
|
||||
{ className: "tabs", "aria-label": "工作台导航" },
|
||||
entries.map((entry) => (0, import_react.createElement)("a", {
|
||||
key: entry.id,
|
||||
href: "#",
|
||||
className: tab === entry.id ? "on" : "",
|
||||
"aria-current": tab === entry.id ? "page" : void 0,
|
||||
onClick: (event) => {
|
||||
event.preventDefault();
|
||||
setTab(entry.id);
|
||||
}
|
||||
}, fileIcon(entry.icon), entry.label))
|
||||
);
|
||||
}
|
||||
function renderSeatNode(seat) {
|
||||
const tone = toneOfSeat(seat);
|
||||
const latest = latestTaskOf(seat.id);
|
||||
|
|
@ -998,7 +961,7 @@ function WorkbenchV2(props) {
|
|||
const stats = [
|
||||
(0, import_react.createElement)(
|
||||
"button",
|
||||
{ type: "button", className: "stat stat-link", key: "cost", onClick: () => setTab("token") },
|
||||
{ type: "button", className: "stat stat-link", key: "cost", onClick: () => setTokenPanelOpen(true) },
|
||||
(0, import_react.createElement)("div", { className: "label" }, "消耗金额"),
|
||||
(0, import_react.createElement)("div", { className: "big" }, (0, import_react.createElement)("em", null, "—"), (0, import_react.createElement)("span", { className: "unit" }, "元")),
|
||||
(0, import_react.createElement)("div", { className: "foot" }, "Token 统计待接入")
|
||||
|
|
@ -1021,7 +984,7 @@ function WorkbenchV2(props) {
|
|||
"button",
|
||||
{ type: "button", className: "stat stat-link", key: "anomaly", onClick: () => {
|
||||
setQueueSearch("失败");
|
||||
setTab("queue");
|
||||
setQueuePanelOpen(true);
|
||||
} },
|
||||
(0, import_react.createElement)("div", { className: "label" }, "异常 / 失败"),
|
||||
(0, import_react.createElement)("div", { className: "big" }, (0, import_react.createElement)("em", null, String(anomalyTasks.length)), " ", (0, import_react.createElement)("span", { className: "unit" }, "条")),
|
||||
|
|
@ -1054,7 +1017,7 @@ function WorkbenchV2(props) {
|
|||
(0, import_react.createElement)("dt", null, "最近会话"),
|
||||
(0, import_react.createElement)("dd", null, selected.sessionId ? "已绑定 · " + selected.sessionId.slice(0, 8) : "尚未建立")
|
||||
),
|
||||
(0, import_react.createElement)("div", { className: "excerpt" }, (0, import_react.createElement)(ResultSummary, { text: excerpt, label: "最近产出摘录", empty: "(暂无产出)" }))
|
||||
(0, import_react.createElement)("div", { className: "excerpt" }, (0, import_react.createElement)(SummaryBlock, { text: excerpt, label: "最近产出", empty: "(暂无产出)", max: 110 }))
|
||||
);
|
||||
const workspace = (0, import_react.createElement)(
|
||||
"section",
|
||||
|
|
@ -1066,8 +1029,8 @@ function WorkbenchV2(props) {
|
|||
"article",
|
||||
{ className: "review-card", key: task.id },
|
||||
(0, import_react.createElement)("div", { className: "rc-head" }, (0, import_react.createElement)("div", { className: "rc-title" }, task.title), (0, import_react.createElement)("span", { className: "rc-status " + taskTone(task.status) }, (0, import_react.createElement)("i"), taskLabel(task.status))),
|
||||
(0, import_react.createElement)("div", { className: "rc-meta-row" }, (0, import_react.createElement)("span", { className: "rc-from" }, task.id || "—"), (0, import_react.createElement)("span", { className: "rc-meta" }, task.dispatchedAt ? "派发 " + dateText(task.dispatchedAt) : "尚未派发")),
|
||||
(0, import_react.createElement)(ResultSummary, { text: task.goal || task.requirement || "", label: "任务说明", empty: "(无任务说明)" }),
|
||||
(0, import_react.createElement)(SummaryBlock, { text: task.goal || task.requirement || "", label: "任务说明", empty: "(无任务说明)", max: 110 }),
|
||||
(0, import_react.createElement)(SummaryBlock, { text: task.result || taskLabel(task.status), label: "任务完成情况", empty: "(暂无结果)", max: 110 }),
|
||||
(0, import_react.createElement)(
|
||||
"div",
|
||||
{ className: "rc-actions" },
|
||||
|
|
@ -1156,6 +1119,10 @@ function WorkbenchV2(props) {
|
|||
"div",
|
||||
{ className: "page" },
|
||||
renderTopbar("总览", [
|
||||
(0, import_react.createElement)("button", { type: "button", className: "btn", onClick: () => {
|
||||
setQueueSearch("");
|
||||
setQueuePanelOpen(true);
|
||||
} }, "派工队列"),
|
||||
(0, import_react.createElement)("button", { type: "button", className: "btn", onClick: loadProject, disabled: phase === "loading" }, (0, import_react.createElement)(RefreshIcon), "刷新状态"),
|
||||
(0, import_react.createElement)(
|
||||
"button",
|
||||
|
|
@ -1192,7 +1159,8 @@ function WorkbenchV2(props) {
|
|||
(0, import_react.createElement)("p", { className: "foot-note" }, "数据来自当前项目真实会话 · " + (wb.project.boundCount + " / " + wb.project.seatCount + " 席已启用"))
|
||||
);
|
||||
}
|
||||
function renderQueue() {
|
||||
function renderQueuePanel() {
|
||||
if (!queuePanelOpen) return null;
|
||||
const query = queueSearch.trim().toLowerCase();
|
||||
const filtered = tasks.filter((task) => {
|
||||
if (!query) return true;
|
||||
|
|
@ -1200,35 +1168,48 @@ function WorkbenchV2(props) {
|
|||
const haystack = [task.title, seatName, task.id, task.goal, task.requirement, task.result, taskLabel(task.status), task.deliveryState === "failed" ? "投递失败" : ""].filter(Boolean).join(" ").toLowerCase();
|
||||
return haystack.includes(query);
|
||||
});
|
||||
const openTask = (task) => {
|
||||
setQueuePanelOpen(false);
|
||||
setSelectedTask(task);
|
||||
};
|
||||
return (0, import_react.createElement)(
|
||||
"div",
|
||||
{ className: "page" },
|
||||
renderTopbar("派工队列", [
|
||||
(0, import_react.createElement)("button", { type: "button", className: "btn", disabled: summaryBusy || busy, onClick: summarizeByShangshu }, summaryBusy ? "汇总中…" : "尚书汇总"),
|
||||
(0, import_react.createElement)("button", { type: "button", className: "btn", disabled: busy, onClick: reloadTasks }, (0, import_react.createElement)(RefreshIcon), "刷新"),
|
||||
(0, import_react.createElement)("label", { className: "search" }, (0, import_react.createElement)(SearchIcon), (0, import_react.createElement)("input", { type: "search", value: queueSearch, placeholder: "搜索派工记录…", "aria-label": "搜索派工队列", onChange: (event) => setQueueSearch(event.target.value) }))
|
||||
]),
|
||||
{ className: "modal-backdrop", onClick: (event) => {
|
||||
if (event.target === event.currentTarget) setQueuePanelOpen(false);
|
||||
} },
|
||||
(0, import_react.createElement)(
|
||||
"section",
|
||||
{ className: "table-card", "aria-label": "派工队列", style: { marginTop: "18px" } },
|
||||
(0, import_react.createElement)("div", { className: "table-scroll" }, (0, import_react.createElement)(
|
||||
"table",
|
||||
null,
|
||||
(0, import_react.createElement)("thead", null, (0, import_react.createElement)("tr", null, ["任务", "承办席位", "状态", "结果", "耗时", "派发时间"].map((label) => (0, import_react.createElement)("th", { key: label, scope: "col" }, label)))),
|
||||
(0, import_react.createElement)("tbody", null, filtered.map((task) => (0, import_react.createElement)(
|
||||
"tr",
|
||||
{ key: task.id, className: "clickable", tabIndex: 0, onClick: () => setSelectedTask(task), onKeyDown: (event) => {
|
||||
if (event.key === "Enter") setSelectedTask(task);
|
||||
} },
|
||||
(0, import_react.createElement)("td", null, (0, import_react.createElement)("span", { className: "task-name" }, task.title), (0, import_react.createElement)("br"), (0, import_react.createElement)("span", { className: "task-id" }, task.id)),
|
||||
(0, import_react.createElement)("td", null, SEATS[task.ownerSeatId]?.label || task.ownerSeatId || "—"),
|
||||
(0, import_react.createElement)("td", null, (0, import_react.createElement)("span", { className: "pill " + taskTone(task.status) }, (0, import_react.createElement)("i"), taskLabel(task.status)), task.deliveryState === "failed" ? (0, import_react.createElement)("span", { className: "pill fail", style: { marginLeft: "4px" } }, (0, import_react.createElement)("i"), "投递失败") : null),
|
||||
(0, import_react.createElement)("td", { className: "result-cell" }, task.result ? shortText(task.result, 42) : "—"),
|
||||
(0, import_react.createElement)("td", { className: "dur" }, taskDurationMs(task) > 0 ? durationText(taskDurationMs(task)) : "—"),
|
||||
(0, import_react.createElement)("td", { className: "time" }, task.dispatchedAt ? dateText(task.dispatchedAt) : "—")
|
||||
)))
|
||||
)),
|
||||
filtered.length === 0 ? (0, import_react.createElement)("p", { className: "foot-note" }, "没有匹配的派工记录,换个关键词试试。") : null
|
||||
"div",
|
||||
{ className: "modal wide", role: "dialog", "aria-modal": "true", "aria-labelledby": "ssv-queue-title" },
|
||||
(0, import_react.createElement)("div", { className: "modal-head" }, (0, import_react.createElement)("h3", { id: "ssv-queue-title" }, "派工队列"), (0, import_react.createElement)("button", { type: "button", className: "modal-close", "aria-label": "关闭", onClick: () => setQueuePanelOpen(false) }, "✕")),
|
||||
(0, import_react.createElement)(
|
||||
"div",
|
||||
{ className: "modal-toolbar" },
|
||||
(0, import_react.createElement)("label", { className: "search" }, (0, import_react.createElement)(SearchIcon), (0, import_react.createElement)("input", { type: "search", value: queueSearch, placeholder: "搜索派工记录…", "aria-label": "搜索派工队列", onChange: (event) => setQueueSearch(event.target.value) })),
|
||||
(0, import_react.createElement)("button", { type: "button", className: "btn", disabled: summaryBusy || busy, onClick: summarizeByShangshu }, summaryBusy ? "汇总中…" : "尚书汇总"),
|
||||
(0, import_react.createElement)("button", { type: "button", className: "btn", disabled: busy, onClick: reloadTasks }, (0, import_react.createElement)(RefreshIcon), "刷新")
|
||||
),
|
||||
(0, import_react.createElement)(
|
||||
"div",
|
||||
{ className: "queue-table-wrap" },
|
||||
(0, import_react.createElement)("div", { className: "table-scroll" }, (0, import_react.createElement)(
|
||||
"table",
|
||||
null,
|
||||
(0, import_react.createElement)("thead", null, (0, import_react.createElement)("tr", null, ["任务", "承办席位", "状态", "结果", "耗时", "派发时间"].map((label) => (0, import_react.createElement)("th", { key: label, scope: "col" }, label)))),
|
||||
(0, import_react.createElement)("tbody", null, filtered.map((task) => (0, import_react.createElement)(
|
||||
"tr",
|
||||
{ key: task.id, className: "clickable", tabIndex: 0, onClick: () => openTask(task), onKeyDown: (event) => {
|
||||
if (event.key === "Enter") openTask(task);
|
||||
} },
|
||||
(0, import_react.createElement)("td", null, (0, import_react.createElement)("span", { className: "task-name" }, task.title), (0, import_react.createElement)("br"), (0, import_react.createElement)("span", { className: "task-id" }, task.id)),
|
||||
(0, import_react.createElement)("td", null, SEATS[task.ownerSeatId]?.label || task.ownerSeatId || "—"),
|
||||
(0, import_react.createElement)("td", null, (0, import_react.createElement)("span", { className: "pill " + taskTone(task.status) }, (0, import_react.createElement)("i"), taskLabel(task.status)), task.deliveryState === "failed" ? (0, import_react.createElement)("span", { className: "pill fail", style: { marginLeft: "4px" } }, (0, import_react.createElement)("i"), "投递失败") : null),
|
||||
(0, import_react.createElement)("td", { className: "result-cell" }, task.result ? shortText(task.result, 42) : "—"),
|
||||
(0, import_react.createElement)("td", { className: "dur" }, taskDurationMs(task) > 0 ? durationText(taskDurationMs(task)) : "—"),
|
||||
(0, import_react.createElement)("td", { className: "time" }, task.dispatchedAt ? dateText(task.dispatchedAt) : "—")
|
||||
)))
|
||||
)),
|
||||
(0, import_react.createElement)("p", { className: "foot-note" }, filtered.length === 0 ? "没有匹配的派工记录,换个关键词试试。" : "共 " + filtered.length + " 条派工记录。")
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
@ -1246,7 +1227,10 @@ function WorkbenchV2(props) {
|
|||
return (0, import_react.createElement)(
|
||||
"div",
|
||||
{ className: "page" },
|
||||
renderTopbar("记忆", [(0, import_react.createElement)("span", { className: "date" }, (wb.project.name || "项目") + " · 项目共识 v" + (memory?.revision ?? 0))]),
|
||||
renderTopbar("记忆", [
|
||||
(0, import_react.createElement)("button", { type: "button", className: "btn", onClick: () => setTab("overview") }, "← 总览"),
|
||||
(0, import_react.createElement)("span", { className: "date" }, (wb.project.name || "项目") + " · 项目共识 v" + (memory?.revision ?? 0))
|
||||
]),
|
||||
(0, import_react.createElement)(
|
||||
"div",
|
||||
{ className: "settings-stack" },
|
||||
|
|
@ -1291,7 +1275,7 @@ function WorkbenchV2(props) {
|
|||
return (0, import_react.createElement)(
|
||||
"div",
|
||||
{ className: "page" },
|
||||
renderTopbar("设置"),
|
||||
renderTopbar("设置", [(0, import_react.createElement)("button", { type: "button", className: "btn", onClick: () => setTab("overview") }, "← 总览")]),
|
||||
(0, import_react.createElement)(
|
||||
"div",
|
||||
{ className: "settings-stack" },
|
||||
|
|
@ -1364,7 +1348,7 @@ function WorkbenchV2(props) {
|
|||
{ className: "review-card", key: task.id },
|
||||
(0, import_react.createElement)("div", { className: "rc-head" }, (0, import_react.createElement)("div", { className: "rc-title" }, task.title), (0, import_react.createElement)("span", { className: "rc-status " + taskTone(task.status) }, (0, import_react.createElement)("i"), taskLabel(task.status))),
|
||||
(0, import_react.createElement)("div", { className: "rc-meta-row" }, (0, import_react.createElement)("span", { className: "rc-from" }, task.id || "—"), (0, import_react.createElement)("span", { className: "rc-meta" }, task.dispatchedAt ? "派发 " + dateText(task.dispatchedAt) : "尚未派发")),
|
||||
(0, import_react.createElement)(ResultSummary, { text: task.result || task.goal || task.requirement || "", label: "审核材料", empty: "(暂无内容)" }),
|
||||
(0, import_react.createElement)(SummaryBlock, { text: task.result || task.goal || task.requirement || "", label: "审核材料", empty: "(暂无内容)", max: 110 }),
|
||||
(0, import_react.createElement)("div", { className: "rc-actions" }, (0, import_react.createElement)("span", { className: "spacer" }), (0, import_react.createElement)("button", { type: "button", className: "r-open", onClick: () => {
|
||||
setReviewPanelOpen(false);
|
||||
setSelectedTask(task);
|
||||
|
|
@ -1402,22 +1386,29 @@ function WorkbenchV2(props) {
|
|||
)
|
||||
);
|
||||
}
|
||||
function renderToken() {
|
||||
function renderTokenPanel() {
|
||||
if (!tokenPanelOpen) return null;
|
||||
return (0, import_react.createElement)(
|
||||
"div",
|
||||
{ className: "page" },
|
||||
renderTopbar("Token 用量"),
|
||||
{ className: "modal-backdrop", onClick: (event) => {
|
||||
if (event.target === event.currentTarget) setTokenPanelOpen(false);
|
||||
} },
|
||||
(0, import_react.createElement)(
|
||||
"section",
|
||||
{ className: "stats", "aria-label": "Token 统计" },
|
||||
(0, import_react.createElement)("div", { className: "stat" }, (0, import_react.createElement)("div", { className: "label" }, "Token 消耗"), (0, import_react.createElement)("div", { className: "big" }, (0, import_react.createElement)("em", null, "—")), (0, import_react.createElement)("div", { className: "foot" }, "待接入宿主 usage 数据")),
|
||||
(0, import_react.createElement)("div", { className: "stat" }, (0, import_react.createElement)("div", { className: "label" }, "上下文占用"), (0, import_react.createElement)("div", { className: "big" }, (0, import_react.createElement)("em", null, "—")), (0, import_react.createElement)("div", { className: "foot" }, "统计粒度待定:项目 / 会话 / 席位"))
|
||||
),
|
||||
(0, import_react.createElement)(
|
||||
"section",
|
||||
{ className: "card", style: { marginTop: "22px" }, "aria-label": "Token 接入说明" },
|
||||
(0, import_react.createElement)("h3", null, "接入说明"),
|
||||
(0, import_react.createElement)("p", { className: "foot-note" }, "当前宿主尚未提供稳定的 usage 数据源,本页先占位,不展示估算值,避免假精确。接入真实用量后会在这里展示 Token 消耗、上下文占用和消耗金额。")
|
||||
"div",
|
||||
{ className: "modal wide", role: "dialog", "aria-modal": "true", "aria-labelledby": "ssv-token-title" },
|
||||
(0, import_react.createElement)("div", { className: "modal-head" }, (0, import_react.createElement)("h3", { id: "ssv-token-title" }, "Token 用量"), (0, import_react.createElement)("button", { type: "button", className: "modal-close", "aria-label": "关闭", onClick: () => setTokenPanelOpen(false) }, "✕")),
|
||||
(0, import_react.createElement)(
|
||||
"section",
|
||||
{ className: "stats", style: { marginTop: "16px" }, "aria-label": "Token 统计" },
|
||||
(0, import_react.createElement)("div", { className: "stat" }, (0, import_react.createElement)("div", { className: "label" }, "Token 消耗"), (0, import_react.createElement)("div", { className: "big" }, (0, import_react.createElement)("em", null, "—")), (0, import_react.createElement)("div", { className: "foot" }, "待接入宿主 usage 数据")),
|
||||
(0, import_react.createElement)("div", { className: "stat" }, (0, import_react.createElement)("div", { className: "label" }, "上下文占用"), (0, import_react.createElement)("div", { className: "big" }, (0, import_react.createElement)("em", null, "—")), (0, import_react.createElement)("div", { className: "foot" }, "统计粒度待定:项目 / 会话 / 席位"))
|
||||
),
|
||||
(0, import_react.createElement)(
|
||||
"section",
|
||||
{ className: "card", style: { marginTop: "18px" }, "aria-label": "Token 接入说明" },
|
||||
(0, import_react.createElement)("h3", null, "接入说明"),
|
||||
(0, import_react.createElement)("p", { className: "foot-note", style: { marginTop: "8px" } }, "当前宿主尚未提供稳定的 usage 数据源,这里先占位,不展示估算值,避免假精确。接入真实用量后会展示 Token 消耗、上下文占用和消耗金额。")
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
@ -1453,9 +1444,9 @@ function WorkbenchV2(props) {
|
|||
{ className: "modal wide", role: "dialog", "aria-modal": "true" },
|
||||
(0, import_react.createElement)("div", { className: "modal-head" }, (0, import_react.createElement)("h3", null, task.title), (0, import_react.createElement)("button", { type: "button", className: "modal-close", "aria-label": "关闭", onClick: () => setSelectedTask(null) }, "✕")),
|
||||
(0, import_react.createElement)("div", { className: "m-from" }, "派工编号:" + (task.id || "—") + " · " + (task.dispatchedAt ? "派发时间 " + dateText(task.dispatchedAt) : "尚未派发")),
|
||||
(0, import_react.createElement)("div", { className: "m-sec" }, (0, import_react.createElement)("span", { className: "t-label" }, "派工说明"), (0, import_react.createElement)(ResultSummary, { text: task.goal || task.requirement || "", label: "任务摘要", empty: "(无任务说明)" })),
|
||||
(0, import_react.createElement)("div", { className: "m-sec" }, (0, import_react.createElement)("span", { className: "t-label" }, "任务说明"), (0, import_react.createElement)("div", { className: "m-rich" }, task.goal || task.requirement ? renderRichText(task.goal || task.requirement) : (0, import_react.createElement)("p", { className: "empty-note" }, "(无任务说明)"))),
|
||||
(0, import_react.createElement)("div", { className: "m-sec" }, (0, import_react.createElement)("span", { className: "t-label" }, "承办与状态"), (0, import_react.createElement)("p", null, "承办席位:" + (seat ? seat.label : task.ownerSeatId) + " · 模型:" + modelLabelOf(task.ownerSeatId) + " · 状态:" + taskLabel(task.status) + (task.deliveryState === "failed" ? " · 投递失败" : ""))),
|
||||
(0, import_react.createElement)("div", { className: "m-sec" }, (0, import_react.createElement)("span", { className: "t-label" }, "结果"), (0, import_react.createElement)(ResultSummary, { text: task.result || "", label: "结果摘要", empty: "(暂无结果)" })),
|
||||
(0, import_react.createElement)("div", { className: "m-sec" }, (0, import_react.createElement)("span", { className: "t-label" }, "任务完成情况"), (0, import_react.createElement)("div", { className: "m-rich" }, task.result ? renderRichText(task.result) : (0, import_react.createElement)("p", { className: "empty-note" }, "(暂无结果)"))),
|
||||
(0, import_react.createElement)("div", { className: "modal-actions" }, (0, import_react.createElement)("button", { type: "button", className: "btn", onClick: () => setSelectedTask(null) }, "关闭"))
|
||||
)
|
||||
);
|
||||
|
|
@ -1464,9 +1455,7 @@ function WorkbenchV2(props) {
|
|||
if (phase === "loading") return (0, import_react.createElement)("div", { className: "page" }, (0, import_react.createElement)("p", { className: "empty-note" }, "正在载入工作台…"));
|
||||
if (phase === "no-workspace") return (0, import_react.createElement)("div", { className: "page" }, (0, import_react.createElement)("p", { className: "empty-note" }, "请先在宿主中选择或建立一个项目工作区,再打开三省六部工作台。"));
|
||||
if (phase === "error" && !view) return (0, import_react.createElement)("div", { className: "page" }, (0, import_react.createElement)("p", { className: "ssv-banner is-error", role: "alert" }, error || "工作台加载失败"), errorRetryable ? (0, import_react.createElement)("div", { className: "ws-actions" }, (0, import_react.createElement)("button", { type: "button", className: "btn primary", onClick: loadProject }, "重试")) : null);
|
||||
if (tab === "queue") return renderQueue();
|
||||
if (tab === "memory") return renderMemory();
|
||||
if (tab === "token") return renderToken();
|
||||
if (tab === "settings") return renderSettings();
|
||||
return renderOverview();
|
||||
}
|
||||
|
|
@ -1486,16 +1475,24 @@ function WorkbenchV2(props) {
|
|||
(0, import_react.createElement)("span", { className: "dot" }),
|
||||
(0, import_react.createElement)("span", null, (0, import_react.createElement)("span", { className: "name" }, wb.project.name || wb.projectTitle || "当前项目"), (0, import_react.createElement)("br"), (0, import_react.createElement)("span", { className: "meta" }, "主项目 · " + wb.project.seatCount + " 席")),
|
||||
(0, import_react.createElement)("span", { className: "ssv-proj-caret" }, "⌄")
|
||||
),
|
||||
(0, import_react.createElement)(
|
||||
"div",
|
||||
{ className: "panel-actions" },
|
||||
tab !== "overview" ? (0, import_react.createElement)("button", { type: "button", className: "btn", onClick: () => setTab("overview") }, "← 总览") : null,
|
||||
(0, import_react.createElement)("button", { type: "button", className: "btn", onClick: () => setTab("memory") }, "记忆"),
|
||||
(0, import_react.createElement)("button", { type: "button", className: "btn", onClick: () => setTab("settings") }, "设置")
|
||||
)
|
||||
),
|
||||
renderTabs(),
|
||||
statusBanner,
|
||||
renderPage()
|
||||
),
|
||||
renderArtifactModal(),
|
||||
renderTaskDetail(),
|
||||
renderReviewPanel(),
|
||||
renderDurationPanel()
|
||||
renderDurationPanel(),
|
||||
renderQueuePanel(),
|
||||
renderTokenPanel()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -2179,6 +2176,21 @@ body[data-ds-dark-theme] .ssv2,html[data-theme=dark] .ssv2,.ssv2[data-ssv-theme=
|
|||
.ssv2 details.card[open]>summary::after{transform:rotate(180deg)}
|
||||
.ssv2 details.card[open]>summary{margin-bottom:8px}
|
||||
.ssv2 .dept-config-body{padding-top:2px}
|
||||
|
||||
/* ---------- 工作台 v2:顶栏小导航 / 队列与 Token 弹窗 / 卡片摘要 ---------- */
|
||||
.ssv2 .panel-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
|
||||
.ssv2 .panel-actions .btn{min-height:32px;padding:5px 11px;font-size:12.5px}
|
||||
.ssv2 .modal-toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:16px}
|
||||
.ssv2 .modal-toolbar .search{flex:1 1 220px}
|
||||
.ssv2 .queue-table-wrap{margin-top:14px;border-top:1px solid var(--panel-line)}
|
||||
.ssv2 .queue-table-wrap table{margin-top:4px}
|
||||
.ssv2 .card-summary{margin-top:8px;min-width:0}
|
||||
.ssv2 .card-summary .t-label{display:block;color:var(--muted);font-size:11.5px;margin-bottom:3px}
|
||||
.ssv2 .card-summary-text{margin:0;font-size:12.5px;line-height:1.6;color:var(--ink-2);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere;word-break:break-word}
|
||||
.ssv2 .card-summary.is-empty .card-summary-text{color:var(--muted)}
|
||||
.ssv2 .m-rich{margin-top:2px;font-size:13.5px;color:var(--ink-2);max-width:100%;overflow:hidden}
|
||||
.ssv2 .m-rich p{margin:0 0 6px}
|
||||
.ssv2 .m-rich p:last-child{margin-bottom:0}
|
||||
`;
|
||||
|
||||
// src/native/panel.js
|
||||
|
|
@ -3008,23 +3020,48 @@ function apply(ctx) {
|
|||
function installRightDockPinning() {
|
||||
const right = get("sidebarRight");
|
||||
if (!right || !isFn(right.mounted?.subscribe)) return;
|
||||
const delays = [60, 140, 280, 560, 1e3, 1800, 3e3];
|
||||
let timer = null;
|
||||
const ensure = () => {
|
||||
timer = null;
|
||||
if (!rightWorkbenchPinned) return;
|
||||
try {
|
||||
if (findRightWorkbenchTab()) revealRightTab();
|
||||
else openRightWorkbench();
|
||||
} catch {
|
||||
let attempt = 0;
|
||||
const clear = () => {
|
||||
if (timer !== null) {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
}
|
||||
};
|
||||
const stop = right.mounted.subscribe(() => {
|
||||
const ensure = () => {
|
||||
timer = null;
|
||||
if (!rightWorkbenchPinned) {
|
||||
attempt = 0;
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (findRightWorkbenchTab()) {
|
||||
revealRightTab();
|
||||
attempt = 0;
|
||||
return;
|
||||
}
|
||||
if (openRightWorkbench()) {
|
||||
attempt = 0;
|
||||
return;
|
||||
}
|
||||
} catch {
|
||||
}
|
||||
if (attempt < delays.length - 1) {
|
||||
attempt += 1;
|
||||
timer = setTimeout(ensure, delays[attempt]);
|
||||
}
|
||||
};
|
||||
const kick = () => {
|
||||
if (!rightWorkbenchPinned) return;
|
||||
if (timer !== null) clearTimeout(timer);
|
||||
timer = setTimeout(ensure, 60);
|
||||
});
|
||||
clear();
|
||||
attempt = 0;
|
||||
timer = setTimeout(ensure, delays[0]);
|
||||
};
|
||||
const stop = right.mounted.subscribe(kick);
|
||||
if (rightWorkbenchPinned) kick();
|
||||
if (isFn(ctx.effect)) ctx.effect(() => {
|
||||
if (timer !== null) clearTimeout(timer);
|
||||
clear();
|
||||
stop();
|
||||
});
|
||||
}
|
||||
|
|
@ -3167,11 +3204,6 @@ function apply(ctx) {
|
|||
registerNavEntry();
|
||||
registerRightTabType();
|
||||
installRightDockPinning();
|
||||
if (rightWorkbenchPinned) {
|
||||
for (const delay of [300, 900]) setTimeout(() => {
|
||||
if (rightWorkbenchPinned) openRightWorkbench();
|
||||
}, delay);
|
||||
}
|
||||
try {
|
||||
install(ctx);
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -424,29 +424,47 @@ export function apply(ctx) {
|
|||
}
|
||||
|
||||
// 右侧栏按会话保存布局;切换部门打开新会话后,把固定工作台重新挂到新会话。
|
||||
// 只做一次“缺标签才打开、已有标签才聚焦”的幂等动作;不再对每次 mounted 连打三枪,
|
||||
// 否则每次打开会话都会重复 openTab/focus/expand,看起来像整块刷新。
|
||||
// 新建会话的 store 是异步 mint 的:mounted 先变,sidebarRight 还会短暂报
|
||||
// “no session surface is mounted”。这里只重试“缺标签”的那一次打开;
|
||||
// 已有标签只做必要的聚焦/展开,绝不对同一会话重复 openTab。
|
||||
function installRightDockPinning() {
|
||||
const right = get('sidebarRight')
|
||||
if (!right || !isFn(right.mounted?.subscribe)) return
|
||||
const delays = [60, 140, 280, 560, 1000, 1800, 3000]
|
||||
let timer = null
|
||||
let attempt = 0
|
||||
const clear = () => {
|
||||
if (timer !== null) { clearTimeout(timer); timer = null }
|
||||
}
|
||||
const ensure = () => {
|
||||
timer = null
|
||||
if (!rightWorkbenchPinned) return
|
||||
if (!rightWorkbenchPinned) { attempt = 0; return }
|
||||
try {
|
||||
if (findRightWorkbenchTab()) revealRightTab()
|
||||
else openRightWorkbench()
|
||||
} catch { /* 会话尚未挂载时,等下一次 mounted 或用户再次点击 */ }
|
||||
if (findRightWorkbenchTab()) {
|
||||
revealRightTab()
|
||||
attempt = 0
|
||||
return
|
||||
}
|
||||
if (openRightWorkbench()) {
|
||||
attempt = 0
|
||||
return
|
||||
}
|
||||
} catch { /* 会话尚未挂载时,继续按退避重试 */ }
|
||||
if (attempt < delays.length - 1) {
|
||||
attempt += 1
|
||||
timer = setTimeout(ensure, delays[attempt])
|
||||
}
|
||||
}
|
||||
const stop = right.mounted.subscribe(() => {
|
||||
const kick = () => {
|
||||
if (!rightWorkbenchPinned) return
|
||||
if (timer !== null) clearTimeout(timer)
|
||||
// 会话切换时 mounted 先变、侧栏 seat 在同一轮 React 渲染中才 mint store;
|
||||
// 等一拍再动作,足够避开“store 尚未创建”的抛错,又不会重复打开。
|
||||
timer = setTimeout(ensure, 60)
|
||||
})
|
||||
clear()
|
||||
attempt = 0
|
||||
timer = setTimeout(ensure, delays[0])
|
||||
}
|
||||
const stop = right.mounted.subscribe(kick)
|
||||
if (rightWorkbenchPinned) kick()
|
||||
if (isFn(ctx.effect)) ctx.effect(() => {
|
||||
if (timer !== null) clearTimeout(timer)
|
||||
clear()
|
||||
stop()
|
||||
})
|
||||
}
|
||||
|
|
@ -567,9 +585,6 @@ export function apply(ctx) {
|
|||
// 右侧工作台标签类型:需在 apply 时就注册(宿主按类型 id 选正文 slot)。
|
||||
registerRightTabType()
|
||||
installRightDockPinning()
|
||||
if (rightWorkbenchPinned) {
|
||||
for (const delay of [300, 900]) setTimeout(() => { if (rightWorkbenchPinned) openRightWorkbench() }, delay)
|
||||
}
|
||||
|
||||
// dsh-go 原生面板:浏览器(无 dshGo 服务)或桥未就绪时,install 内部安静退出。
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -680,4 +680,19 @@ body[data-ds-dark-theme] .ssv2,html[data-theme=dark] .ssv2,.ssv2[data-ssv-theme=
|
|||
.ssv2 details.card[open]>summary::after{transform:rotate(180deg)}
|
||||
.ssv2 details.card[open]>summary{margin-bottom:8px}
|
||||
.ssv2 .dept-config-body{padding-top:2px}
|
||||
|
||||
/* ---------- 工作台 v2:顶栏小导航 / 队列与 Token 弹窗 / 卡片摘要 ---------- */
|
||||
.ssv2 .panel-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
|
||||
.ssv2 .panel-actions .btn{min-height:32px;padding:5px 11px;font-size:12.5px}
|
||||
.ssv2 .modal-toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:16px}
|
||||
.ssv2 .modal-toolbar .search{flex:1 1 220px}
|
||||
.ssv2 .queue-table-wrap{margin-top:14px;border-top:1px solid var(--panel-line)}
|
||||
.ssv2 .queue-table-wrap table{margin-top:4px}
|
||||
.ssv2 .card-summary{margin-top:8px;min-width:0}
|
||||
.ssv2 .card-summary .t-label{display:block;color:var(--muted);font-size:11.5px;margin-bottom:3px}
|
||||
.ssv2 .card-summary-text{margin:0;font-size:12.5px;line-height:1.6;color:var(--ink-2);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere;word-break:break-word}
|
||||
.ssv2 .card-summary.is-empty .card-summary-text{color:var(--muted)}
|
||||
.ssv2 .m-rich{margin-top:2px;font-size:13.5px;color:var(--ink-2);max-width:100%;overflow:hidden}
|
||||
.ssv2 .m-rich p{margin:0 0 6px}
|
||||
.ssv2 .m-rich p:last-child{margin-bottom:0}
|
||||
`;
|
||||
|
|
|
|||
|
|
@ -162,26 +162,14 @@ function renderRichText(text) {
|
|||
return blocks
|
||||
}
|
||||
|
||||
function ResultSummary(props) {
|
||||
const [expanded, setExpanded] = useState(false)
|
||||
function SummaryBlock(props) {
|
||||
const text = String(props && props.text ? props.text : '').trim()
|
||||
const label = props && props.label ? props.label : '摘要'
|
||||
const empty = props && props.empty ? props.empty : '(暂无内容)'
|
||||
if (!text) {
|
||||
return h('div', { className: 'result-summary is-empty' },
|
||||
label ? h('span', { className: 't-label' }, label) : null,
|
||||
h('span', { className: 'rs-empty' }, empty))
|
||||
}
|
||||
const parsed = splitResultText(text)
|
||||
return h('div', { className: 'result-summary' + (expanded ? ' is-expanded' : '') },
|
||||
h('div', { className: 'rs-line' },
|
||||
label ? h('span', { className: 't-label' }, label) : null,
|
||||
h('span', { className: 'rs-summary' }, parsed.summary)),
|
||||
parsed.points.length > 0 ? h('ul', { className: 'rs-points' }, parsed.points.map((point, index) => h('li', { key: index }, point))) : null,
|
||||
parsed.hasMore || parsed.points.length > 0 || text.includes('\n')
|
||||
? h('button', { type: 'button', className: 'rs-toggle', onClick: () => setExpanded(value => !value), 'aria-expanded': expanded ? 'true' : 'false' }, expanded ? '收起详情' : '展开详情')
|
||||
: null,
|
||||
expanded ? h('div', { className: 'rs-detail' }, renderRichText(text)) : null,
|
||||
const max = props && props.max ? props.max : 120
|
||||
return h('div', { className: 'card-summary' + (text ? '' : ' is-empty') },
|
||||
label ? h('span', { className: 't-label' }, label) : null,
|
||||
h('p', { className: 'card-summary-text' }, text ? shortText(text, max) : empty),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -239,6 +227,8 @@ export function WorkbenchV2(props) {
|
|||
const [selectedTask, setSelectedTask] = useState(null)
|
||||
const [reviewPanelOpen, setReviewPanelOpen] = useState(false)
|
||||
const [durationPanelOpen, setDurationPanelOpen] = useState(false)
|
||||
const [tokenPanelOpen, setTokenPanelOpen] = useState(false)
|
||||
const [queuePanelOpen, setQueuePanelOpen] = useState(false)
|
||||
const [draft, setDraft] = useState({})
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [summaryBusy, setSummaryBusy] = useState(false)
|
||||
|
|
@ -523,22 +513,6 @@ export function WorkbenchV2(props) {
|
|||
)
|
||||
}
|
||||
|
||||
function renderTabs() {
|
||||
const entries = [
|
||||
{ id: 'overview', label: '总览', icon: ['M3 3h7v9H3z', 'M14 3h7v5h-7z', 'M14 12h7v9h-7z', 'M3 16h7v5H3z'] },
|
||||
{ id: 'queue', label: '派工队列', icon: ['m22 2-7 20-4-9-9-4Z', 'M22 2 11 13'] },
|
||||
{ id: 'memory', label: '记忆', icon: ['M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'] },
|
||||
{ id: 'token', label: 'Token 用量', icon: ['M12 2v20', 'M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6'] },
|
||||
{ id: 'settings', label: '设置', icon: ['M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z', 'M12 12a3 3 0 1 0 0-6 3 3 0 0 0 0 6z'] },
|
||||
]
|
||||
return h('nav', { className: 'tabs', 'aria-label': '工作台导航' },
|
||||
entries.map(entry => h('a', {
|
||||
key: entry.id, href: '#', className: tab === entry.id ? 'on' : '', 'aria-current': tab === entry.id ? 'page' : undefined,
|
||||
onClick: event => { event.preventDefault(); setTab(entry.id) },
|
||||
}, fileIcon(entry.icon), entry.label)),
|
||||
)
|
||||
}
|
||||
|
||||
function renderSeatNode(seat) {
|
||||
const tone = toneOfSeat(seat)
|
||||
const latest = latestTaskOf(seat.id)
|
||||
|
|
@ -555,7 +529,7 @@ export function WorkbenchV2(props) {
|
|||
|
||||
function renderOverview() {
|
||||
const stats = [
|
||||
h('button', { type: 'button', className: 'stat stat-link', key: 'cost', onClick: () => setTab('token') },
|
||||
h('button', { type: 'button', className: 'stat stat-link', key: 'cost', onClick: () => setTokenPanelOpen(true) },
|
||||
h('div', { className: 'label' }, '消耗金额'),
|
||||
h('div', { className: 'big' }, h('em', null, '—'), h('span', { className: 'unit' }, '元')),
|
||||
h('div', { className: 'foot' }, 'Token 统计待接入'),
|
||||
|
|
@ -570,7 +544,7 @@ export function WorkbenchV2(props) {
|
|||
h('div', { className: 'big' }, h('em', null, String(reviewTasks.length)), ' ', h('span', { className: 'unit' }, '件')),
|
||||
h('div', { className: 'foot' }, '待门下复核'),
|
||||
),
|
||||
h('button', { type: 'button', className: 'stat stat-link', key: 'anomaly', onClick: () => { setQueueSearch('失败'); setTab('queue') } },
|
||||
h('button', { type: 'button', className: 'stat stat-link', key: 'anomaly', onClick: () => { setQueueSearch('失败'); setQueuePanelOpen(true) } },
|
||||
h('div', { className: 'label' }, '异常 / 失败'),
|
||||
h('div', { className: 'big' }, h('em', null, String(anomalyTasks.length)), ' ', h('span', { className: 'unit' }, '条')),
|
||||
h('div', { className: 'foot' }, '失败或投递失败'),
|
||||
|
|
@ -596,7 +570,7 @@ export function WorkbenchV2(props) {
|
|||
h('dt', null, '本日派工'), h('dd', null, selectedToday.length + ' 条 · 完成 ' + selectedDone.length),
|
||||
h('dt', null, '最近会话'), h('dd', null, selected.sessionId ? '已绑定 · ' + selected.sessionId.slice(0, 8) : '尚未建立'),
|
||||
),
|
||||
h('div', { className: 'excerpt' }, h(ResultSummary, { text: excerpt, label: '最近产出摘录', empty: '(暂无产出)' })),
|
||||
h('div', { className: 'excerpt' }, h(SummaryBlock, { text: excerpt, label: '最近产出', empty: '(暂无产出)', max: 110 })),
|
||||
)
|
||||
|
||||
const workspace = h('section', { className: 'card', 'aria-label': '席位工作区' },
|
||||
|
|
@ -609,8 +583,8 @@ export function WorkbenchV2(props) {
|
|||
? h('p', { className: 'empty-note' }, '该席位还没有任务记录。')
|
||||
: h('div', { className: 'review-list' }, selectedTasks.slice(0, 3).map(task => h('article', { className: 'review-card', key: task.id },
|
||||
h('div', { className: 'rc-head' }, h('div', { className: 'rc-title' }, task.title), h('span', { className: 'rc-status ' + taskTone(task.status) }, h('i'), taskLabel(task.status))),
|
||||
h('div', { className: 'rc-meta-row' }, h('span', { className: 'rc-from' }, task.id || '—'), h('span', { className: 'rc-meta' }, task.dispatchedAt ? '派发 ' + dateText(task.dispatchedAt) : '尚未派发')),
|
||||
h(ResultSummary, { text: task.goal || task.requirement || '', label: '任务说明', empty: '(无任务说明)' }),
|
||||
h(SummaryBlock, { text: task.goal || task.requirement || '', label: '任务说明', empty: '(无任务说明)', max: 110 }),
|
||||
h(SummaryBlock, { text: task.result || taskLabel(task.status), label: '任务完成情况', empty: '(暂无结果)', max: 110 }),
|
||||
h('div', { className: 'rc-actions' }, h('span', { className: 'spacer' }),
|
||||
h('button', { type: 'button', className: 'r-open', onClick: () => setSelectedTask(task) }, '查看详情 →'),
|
||||
),
|
||||
|
|
@ -677,6 +651,7 @@ export function WorkbenchV2(props) {
|
|||
|
||||
return h('div', { className: 'page' },
|
||||
renderTopbar('总览', [
|
||||
h('button', { type: 'button', className: 'btn', onClick: () => { setQueueSearch(''); setQueuePanelOpen(true) } }, '派工队列'),
|
||||
h('button', { type: 'button', className: 'btn', onClick: loadProject, disabled: phase === 'loading' }, h(RefreshIcon), '刷新状态'),
|
||||
h('button', { type: 'button', className: 'btn primary btn-cx', onClick: () => { setSeat('lead'); if (seatById.lead.status === 'bound') void openSeat('lead'); else setTab('settings') } },
|
||||
h('span', { className: 'cx-name' }, '丞相'), h('span', { className: 'cx-dot', 'aria-hidden': 'true' }), h('span', { className: 'cx-state' }, seatStateText(seatById.lead))),
|
||||
|
|
@ -698,7 +673,8 @@ export function WorkbenchV2(props) {
|
|||
)
|
||||
}
|
||||
|
||||
function renderQueue() {
|
||||
function renderQueuePanel() {
|
||||
if (!queuePanelOpen) return null
|
||||
const query = queueSearch.trim().toLowerCase()
|
||||
const filtered = tasks.filter(task => {
|
||||
if (!query) return true
|
||||
|
|
@ -706,27 +682,30 @@ export function WorkbenchV2(props) {
|
|||
const haystack = [task.title, seatName, task.id, task.goal, task.requirement, task.result, taskLabel(task.status), task.deliveryState === 'failed' ? '投递失败' : ''].filter(Boolean).join(' ').toLowerCase()
|
||||
return haystack.includes(query)
|
||||
})
|
||||
return h('div', { className: 'page' },
|
||||
renderTopbar('派工队列', [
|
||||
h('button', { type: 'button', className: 'btn', disabled: summaryBusy || busy, onClick: summarizeByShangshu }, summaryBusy ? '汇总中…' : '尚书汇总'),
|
||||
h('button', { type: 'button', className: 'btn', disabled: busy, onClick: reloadTasks }, h(RefreshIcon), '刷新'),
|
||||
h('label', { className: 'search' }, h(SearchIcon), h('input', { type: 'search', value: queueSearch, placeholder: '搜索派工记录…', 'aria-label': '搜索派工队列', onChange: event => setQueueSearch(event.target.value) })),
|
||||
]),
|
||||
h('section', { className: 'table-card', 'aria-label': '派工队列', style: { marginTop: '18px' } },
|
||||
h('div', { className: 'table-scroll' }, h('table', null,
|
||||
h('thead', null, h('tr', null, ['任务', '承办席位', '状态', '结果', '耗时', '派发时间'].map(label => h('th', { key: label, scope: 'col' }, label)))),
|
||||
h('tbody', null, filtered.map(task => h('tr', { key: task.id, className: 'clickable', tabIndex: 0, onClick: () => setSelectedTask(task), onKeyDown: event => { if (event.key === 'Enter') setSelectedTask(task) } },
|
||||
h('td', null, h('span', { className: 'task-name' }, task.title), h('br'), h('span', { className: 'task-id' }, task.id)),
|
||||
h('td', null, SEATS[task.ownerSeatId]?.label || task.ownerSeatId || '—'),
|
||||
h('td', null, h('span', { className: 'pill ' + taskTone(task.status) }, h('i'), taskLabel(task.status)), task.deliveryState === 'failed' ? h('span', { className: 'pill fail', style: { marginLeft: '4px' } }, h('i'), '投递失败') : null),
|
||||
h('td', { className: 'result-cell' }, task.result ? shortText(task.result, 42) : '—'),
|
||||
h('td', { className: 'dur' }, taskDurationMs(task) > 0 ? durationText(taskDurationMs(task)) : '—'),
|
||||
h('td', { className: 'time' }, task.dispatchedAt ? dateText(task.dispatchedAt) : '—'),
|
||||
))),
|
||||
)),
|
||||
filtered.length === 0 ? h('p', { className: 'foot-note' }, '没有匹配的派工记录,换个关键词试试。') : null,
|
||||
),
|
||||
)
|
||||
const openTask = task => { setQueuePanelOpen(false); setSelectedTask(task) }
|
||||
return h('div', { className: 'modal-backdrop', onClick: event => { if (event.target === event.currentTarget) setQueuePanelOpen(false) } },
|
||||
h('div', { className: 'modal wide', role: 'dialog', 'aria-modal': 'true', 'aria-labelledby': 'ssv-queue-title' },
|
||||
h('div', { className: 'modal-head' }, h('h3', { id: 'ssv-queue-title' }, '派工队列'), h('button', { type: 'button', className: 'modal-close', 'aria-label': '关闭', onClick: () => setQueuePanelOpen(false) }, '✕')),
|
||||
h('div', { className: 'modal-toolbar' },
|
||||
h('label', { className: 'search' }, h(SearchIcon), h('input', { type: 'search', value: queueSearch, placeholder: '搜索派工记录…', 'aria-label': '搜索派工队列', onChange: event => setQueueSearch(event.target.value) })),
|
||||
h('button', { type: 'button', className: 'btn', disabled: summaryBusy || busy, onClick: summarizeByShangshu }, summaryBusy ? '汇总中…' : '尚书汇总'),
|
||||
h('button', { type: 'button', className: 'btn', disabled: busy, onClick: reloadTasks }, h(RefreshIcon), '刷新'),
|
||||
),
|
||||
h('div', { className: 'queue-table-wrap' },
|
||||
h('div', { className: 'table-scroll' }, h('table', null,
|
||||
h('thead', null, h('tr', null, ['任务', '承办席位', '状态', '结果', '耗时', '派发时间'].map(label => h('th', { key: label, scope: 'col' }, label)))),
|
||||
h('tbody', null, filtered.map(task => h('tr', { key: task.id, className: 'clickable', tabIndex: 0, onClick: () => openTask(task), onKeyDown: event => { if (event.key === 'Enter') openTask(task) } },
|
||||
h('td', null, h('span', { className: 'task-name' }, task.title), h('br'), h('span', { className: 'task-id' }, task.id)),
|
||||
h('td', null, SEATS[task.ownerSeatId]?.label || task.ownerSeatId || '—'),
|
||||
h('td', null, h('span', { className: 'pill ' + taskTone(task.status) }, h('i'), taskLabel(task.status)), task.deliveryState === 'failed' ? h('span', { className: 'pill fail', style: { marginLeft: '4px' } }, h('i'), '投递失败') : null),
|
||||
h('td', { className: 'result-cell' }, task.result ? shortText(task.result, 42) : '—'),
|
||||
h('td', { className: 'dur' }, taskDurationMs(task) > 0 ? durationText(taskDurationMs(task)) : '—'),
|
||||
h('td', { className: 'time' }, task.dispatchedAt ? dateText(task.dispatchedAt) : '—'),
|
||||
))),
|
||||
)),
|
||||
h('p', { className: 'foot-note' }, filtered.length === 0 ? '没有匹配的派工记录,换个关键词试试。' : '共 ' + filtered.length + ' 条派工记录。'),
|
||||
),
|
||||
))
|
||||
}
|
||||
|
||||
function renderMemory() {
|
||||
|
|
@ -739,7 +718,10 @@ export function WorkbenchV2(props) {
|
|||
h('div', { className: 'rc-excerpt' }, body || '(暂无)'),
|
||||
)
|
||||
return h('div', { className: 'page' },
|
||||
renderTopbar('记忆', [h('span', { className: 'date' }, (wb.project.name || '项目') + ' · 项目共识 v' + (memory?.revision ?? 0))]),
|
||||
renderTopbar('记忆', [
|
||||
h('button', { type: 'button', className: 'btn', onClick: () => setTab('overview') }, '← 总览'),
|
||||
h('span', { className: 'date' }, (wb.project.name || '项目') + ' · 项目共识 v' + (memory?.revision ?? 0)),
|
||||
]),
|
||||
h('div', { className: 'settings-stack' },
|
||||
h('section', { className: 'card', 'aria-label': '项目共识' },
|
||||
h('h3', null, '项目共识 ', h('span', { className: 'seat-tag' }, 'v' + (memory?.revision ?? 0))),
|
||||
|
|
@ -771,7 +753,7 @@ export function WorkbenchV2(props) {
|
|||
|
||||
function renderSettings() {
|
||||
return h('div', { className: 'page' },
|
||||
renderTopbar('设置'),
|
||||
renderTopbar('设置', [h('button', { type: 'button', className: 'btn', onClick: () => setTab('overview') }, '← 总览')]),
|
||||
h('div', { className: 'settings-stack' },
|
||||
h('section', { className: 'card', 'aria-label': '项目绑定' },
|
||||
h('h3', null, '项目绑定'),
|
||||
|
|
@ -817,7 +799,7 @@ export function WorkbenchV2(props) {
|
|||
: h('div', { className: 'review-list' }, reviewTasks.map(task => h('article', { className: 'review-card', key: task.id },
|
||||
h('div', { className: 'rc-head' }, h('div', { className: 'rc-title' }, task.title), h('span', { className: 'rc-status ' + taskTone(task.status) }, h('i'), taskLabel(task.status))),
|
||||
h('div', { className: 'rc-meta-row' }, h('span', { className: 'rc-from' }, task.id || '—'), h('span', { className: 'rc-meta' }, task.dispatchedAt ? '派发 ' + dateText(task.dispatchedAt) : '尚未派发')),
|
||||
h(ResultSummary, { text: task.result || task.goal || task.requirement || '', label: '审核材料', empty: '(暂无内容)' }),
|
||||
h(SummaryBlock, { text: task.result || task.goal || task.requirement || '', label: '审核材料', empty: '(暂无内容)', max: 110 }),
|
||||
h('div', { className: 'rc-actions' }, h('span', { className: 'spacer' }), h('button', { type: 'button', className: 'r-open', onClick: () => { setReviewPanelOpen(false); setSelectedTask(task) } }, '查看任务 →')),
|
||||
))),
|
||||
),
|
||||
|
|
@ -846,18 +828,20 @@ export function WorkbenchV2(props) {
|
|||
)
|
||||
}
|
||||
|
||||
function renderToken() {
|
||||
return h('div', { className: 'page' },
|
||||
renderTopbar('Token 用量'),
|
||||
h('section', { className: 'stats', 'aria-label': 'Token 统计' },
|
||||
h('div', { className: 'stat' }, h('div', { className: 'label' }, 'Token 消耗'), h('div', { className: 'big' }, h('em', null, '—')), h('div', { className: 'foot' }, '待接入宿主 usage 数据')),
|
||||
h('div', { className: 'stat' }, h('div', { className: 'label' }, '上下文占用'), h('div', { className: 'big' }, h('em', null, '—')), h('div', { className: 'foot' }, '统计粒度待定:项目 / 会话 / 席位')),
|
||||
),
|
||||
h('section', { className: 'card', style: { marginTop: '22px' }, 'aria-label': 'Token 接入说明' },
|
||||
h('h3', null, '接入说明'),
|
||||
h('p', { className: 'foot-note' }, '当前宿主尚未提供稳定的 usage 数据源,本页先占位,不展示估算值,避免假精确。接入真实用量后会在这里展示 Token 消耗、上下文占用和消耗金额。'),
|
||||
),
|
||||
)
|
||||
function renderTokenPanel() {
|
||||
if (!tokenPanelOpen) return null
|
||||
return h('div', { className: 'modal-backdrop', onClick: event => { if (event.target === event.currentTarget) setTokenPanelOpen(false) } },
|
||||
h('div', { className: 'modal wide', role: 'dialog', 'aria-modal': 'true', 'aria-labelledby': 'ssv-token-title' },
|
||||
h('div', { className: 'modal-head' }, h('h3', { id: 'ssv-token-title' }, 'Token 用量'), h('button', { type: 'button', className: 'modal-close', 'aria-label': '关闭', onClick: () => setTokenPanelOpen(false) }, '✕')),
|
||||
h('section', { className: 'stats', style: { marginTop: '16px' }, 'aria-label': 'Token 统计' },
|
||||
h('div', { className: 'stat' }, h('div', { className: 'label' }, 'Token 消耗'), h('div', { className: 'big' }, h('em', null, '—')), h('div', { className: 'foot' }, '待接入宿主 usage 数据')),
|
||||
h('div', { className: 'stat' }, h('div', { className: 'label' }, '上下文占用'), h('div', { className: 'big' }, h('em', null, '—')), h('div', { className: 'foot' }, '统计粒度待定:项目 / 会话 / 席位')),
|
||||
),
|
||||
h('section', { className: 'card', style: { marginTop: '18px' }, 'aria-label': 'Token 接入说明' },
|
||||
h('h3', null, '接入说明'),
|
||||
h('p', { className: 'foot-note', style: { marginTop: '8px' } }, '当前宿主尚未提供稳定的 usage 数据源,这里先占位,不展示估算值,避免假精确。接入真实用量后会展示 Token 消耗、上下文占用和消耗金额。'),
|
||||
),
|
||||
))
|
||||
}
|
||||
|
||||
function renderArtifactModal() {
|
||||
|
|
@ -881,9 +865,9 @@ export function WorkbenchV2(props) {
|
|||
h('div', { className: 'modal wide', role: 'dialog', 'aria-modal': 'true' },
|
||||
h('div', { className: 'modal-head' }, h('h3', null, task.title), h('button', { type: 'button', className: 'modal-close', 'aria-label': '关闭', onClick: () => setSelectedTask(null) }, '✕')),
|
||||
h('div', { className: 'm-from' }, '派工编号:' + (task.id || '—') + ' · ' + (task.dispatchedAt ? '派发时间 ' + dateText(task.dispatchedAt) : '尚未派发')),
|
||||
h('div', { className: 'm-sec' }, h('span', { className: 't-label' }, '派工说明'), h(ResultSummary, { text: task.goal || task.requirement || '', label: '任务摘要', empty: '(无任务说明)' })),
|
||||
h('div', { className: 'm-sec' }, h('span', { className: 't-label' }, '任务说明'), h('div', { className: 'm-rich' }, task.goal || task.requirement ? renderRichText(task.goal || task.requirement) : h('p', { className: 'empty-note' }, '(无任务说明)'))),
|
||||
h('div', { className: 'm-sec' }, h('span', { className: 't-label' }, '承办与状态'), h('p', null, '承办席位:' + (seat ? seat.label : task.ownerSeatId) + ' · 模型:' + modelLabelOf(task.ownerSeatId) + ' · 状态:' + taskLabel(task.status) + (task.deliveryState === 'failed' ? ' · 投递失败' : ''))),
|
||||
h('div', { className: 'm-sec' }, h('span', { className: 't-label' }, '结果'), h(ResultSummary, { text: task.result || '', label: '结果摘要', empty: '(暂无结果)' })),
|
||||
h('div', { className: 'm-sec' }, h('span', { className: 't-label' }, '任务完成情况'), h('div', { className: 'm-rich' }, task.result ? renderRichText(task.result) : h('p', { className: 'empty-note' }, '(暂无结果)'))),
|
||||
h('div', { className: 'modal-actions' }, h('button', { type: 'button', className: 'btn', onClick: () => setSelectedTask(null) }, '关闭')),
|
||||
),
|
||||
)
|
||||
|
|
@ -893,9 +877,7 @@ export function WorkbenchV2(props) {
|
|||
if (phase === 'loading') return h('div', { className: 'page' }, h('p', { className: 'empty-note' }, '正在载入工作台…'))
|
||||
if (phase === 'no-workspace') return h('div', { className: 'page' }, h('p', { className: 'empty-note' }, '请先在宿主中选择或建立一个项目工作区,再打开三省六部工作台。'))
|
||||
if (phase === 'error' && !view) return h('div', { className: 'page' }, h('p', { className: 'ssv-banner is-error', role: 'alert' }, error || '工作台加载失败'), errorRetryable ? h('div', { className: 'ws-actions' }, h('button', { type: 'button', className: 'btn primary', onClick: loadProject }, '重试')) : null)
|
||||
if (tab === 'queue') return renderQueue()
|
||||
if (tab === 'memory') return renderMemory()
|
||||
if (tab === 'token') return renderToken()
|
||||
if (tab === 'settings') return renderSettings()
|
||||
return renderOverview()
|
||||
}
|
||||
|
|
@ -908,8 +890,12 @@ export function WorkbenchV2(props) {
|
|||
h('span', { className: 'dot' }),
|
||||
h('span', null, h('span', { className: 'name' }, wb.project.name || wb.projectTitle || '当前项目'), h('br'), h('span', { className: 'meta' }, '主项目 · ' + wb.project.seatCount + ' 席')),
|
||||
h('span', { className: 'ssv-proj-caret' }, '⌄')),
|
||||
h('div', { className: 'panel-actions' },
|
||||
tab !== 'overview' ? h('button', { type: 'button', className: 'btn', onClick: () => setTab('overview') }, '← 总览') : null,
|
||||
h('button', { type: 'button', className: 'btn', onClick: () => setTab('memory') }, '记忆'),
|
||||
h('button', { type: 'button', className: 'btn', onClick: () => setTab('settings') }, '设置'),
|
||||
),
|
||||
),
|
||||
renderTabs(),
|
||||
statusBanner,
|
||||
renderPage(),
|
||||
),
|
||||
|
|
@ -917,5 +903,7 @@ export function WorkbenchV2(props) {
|
|||
renderTaskDetail(),
|
||||
renderReviewPanel(),
|
||||
renderDurationPanel(),
|
||||
renderQueuePanel(),
|
||||
renderTokenPanel(),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue