Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 23 additions & 14 deletions src/agent/dsh-native-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,10 @@ export function apply(ctx: ClientContext): void {
status === undefined ||
status.viaFallback !== true ||
status.conversationId === hostSessionId;
// #4281: framed ⇒ fill the whole conversation view (full-height
// column, no outer padding, borderless frame on flex:1, slim top
// action row); every hint state keeps its own breathing room.
const framed = origin !== undefined && liveEmbed === "ok" && sessionId !== null && sessionOurs;
const hintP = (key: string): unknown => createElement("p", { style: { margin: 0, opacity: 0.7, lineHeight: 1.6 } }, t(key));
let middle: unknown;
if (origin === undefined) {
Expand All @@ -624,18 +628,19 @@ export function apply(ctx: ClientContext): void {
// Frozen proxy predates the ?embed=1 route: framing is impossible
// on any page, including the session one.
middle = hintP("stale");
} else if (liveEmbed === "ok" && sessionId !== null && sessionOurs) {
} else if (framed) {
middle = createElement(
"iframe",
{
src: `${origin}/__bili/?embed=1&lang=${lang}${theme !== undefined ? `&theme=${theme}` : ""}#/session/${encodeURIComponent(sessionId)}`,
title: t("title"),
style: {
display: "block",
flex: 1,
width: "100%",
height: EMBED_HEIGHT,
border: "1px solid rgba(127,127,127,0.4)",
borderRadius: 8,
height: "100%",
minHeight: 0,
border: "none",
background: "transparent",
},
},
Expand All @@ -657,23 +662,27 @@ export function apply(ctx: ClientContext): void {
}
return createElement(
"div",
{ style: { display: "flex", flexDirection: "column", gap: 12, padding: "20px 8px" } },
middle,
createElement(
"div",
{ style: { display: "flex", alignItems: "center", gap: 10, flexWrap: "wrap" } },
origin !== undefined
? createElement(
{ style: { display: "flex", flexDirection: "column", height: "100%", minWidth: 0, minHeight: 0 } },
origin !== undefined
? createElement(
"div",
{ style: { display: "flex", alignItems: "center", gap: 8, flexShrink: 0, padding: "8px 12px" } },
createElement(
"button",
{
type: "button",
onClick: () => setReloadTick((x) => x + 1),
style: { cursor: "pointer", borderRadius: 8, border: "1px solid rgba(127,127,127,0.4)", background: "transparent", color: "inherit", fontFamily: "inherit", fontSize: 13, lineHeight: "20px", padding: "4px 14px" },
},
t("ctx_refresh"),
)
: null,
openWebButton(origin, t, { fontSize: "13", lineHeight: "20px", padding: "4px 14px" }),
),
openWebButton(origin, t, { fontSize: "13", lineHeight: "20px", padding: "4px 14px" }),
)
: null,
createElement(
"div",
{ style: framed ? { display: "flex", flex: 1, minHeight: 0 } : { flex: 1, minHeight: 0, padding: 16 } },
middle,
),
);
};
Expand Down
30 changes: 29 additions & 1 deletion tests/dsh-settings-ui.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1536,7 +1536,19 @@ test("#3862: conversation.view Context tab embeds the web UI session page, polls
assert.ok(frame.props !== null, "frame carries props");
assert.equal(frame.props.src, EXPECTED_SRC, "frame navigates to #/session/<id> on the ?embed=1 face");
assert.equal(frame.props.title, "billion-context 压缩代理", "frame keeps the shared bili frame title");
// Footer: refresh + the shared open-in-browser action.
// #4281: the tab FILLS the conversation view — full-height column root
// with no outer padding, a borderless frame stretched by flex, and the
// actions riding a slim TOP row instead of a footer below the frame.
assert.equal(tree.type, "div");
const rootStyle = (tree.props?.style ?? {}) as Record<string, unknown>;
assert.equal(rootStyle.height, "100%", "#4281: root fills the conversation view");
assert.equal(rootStyle.padding, undefined, "#4281: no outer padding");
const frameStyle = (frame.props?.style ?? {}) as Record<string, unknown>;
assert.equal(frameStyle.border, "none", "#4281: borderless frame");
assert.equal(frameStyle.borderRadius, undefined, "#4281: no rounded corners");
assert.equal(frameStyle.flex, 1, "#4281: frame stretches the remaining height");
assert.equal(frameStyle.height, "100%");
// Top-row actions: refresh + the shared open-in-browser action.
const buttons = collectButtons(tree);
assert.equal(buttons.length, 2, "refresh + open-WebUI only");
const refresh = buttons.find((b) => {
Expand All @@ -1547,6 +1559,15 @@ test("#3862: conversation.view Context tab embeds the web UI session page, polls
assert.ok(refresh !== undefined, "refresh button renders");
const webBtn = buttons.find((b) => b.props?.title === ORIGIN);
assert.ok(webBtn !== undefined, "open-WebUI button keeps the origin tooltip");
// #4281: BOTH actions share one slim row above the frame — nothing rides
// a footer below it anymore.
const actionRow = findDivParenting(tree, (el) => {
const bt: string[] = [];
collectText(el, bt);
return bt.join("") === "刷新";
});
assert.ok(actionRow !== undefined, "refresh button has a parent row");
assert.deepEqual(collectButtons(actionRow), buttons, "#4281: refresh + open-WebUI share ONE top row");
(webBtn!.props!.onClick as () => void)();
assert.deepEqual(opened, [`${ORIGIN}/__bili/`]);
// Polling: exactly one loop on the slow cadence — counting STATUS reads
Expand Down Expand Up @@ -1601,6 +1622,13 @@ test("#3862: conversation.view Context tab embeds the web UI session page, polls
const st = await subMount({ ok: true, phase: "pre-first-request", sessionId: null });
assert.ok(textOf(st).includes("等待首个模型请求…"), "pre-first-request waits, does not guess");
assert.equal(findTag(st, "iframe"), undefined);
// #4281: hint states keep breathing room — with the root padding gone,
// the content wrapper pads itself (the toolbar row still renders:
// origin known ⇒ actions available even before the session exists).
const kids = (st.children ?? []).filter((c) => c !== null && typeof c === "object") as ElementNode[];
const wrap = kids.at(-1)!;
assert.equal((wrap.props?.style as Record<string, unknown>).padding, 16, "#4281: hint wrapper carries its own padding");
assert.equal(collectButtons(wrap).length, 0, "#4281: actions never ride inside the content wrapper");
}
{
// #1357 chain-advisory carries a panel string but NO session id: reads
Expand Down
Loading