fix(web): unify mode previews and label window positions

This commit is contained in:
Miayui
2026-09-22 14:17:50 +08:00
parent 2b365b3922
commit f4ab5f4867
12 changed files with 176 additions and 51 deletions
+21 -2
View File
@@ -111,7 +111,7 @@ import { Fragment, createApp, h, nextTick, reactive } from "vue";
}
function createCommandMount(container) {
const state = reactive({ commands: [], open: true, heading: "下发控制指令" });
const state = reactive({ commands: [], open: true, heading: "下发控制指令", footer: null, hideCommands: false });
const app = createApp({
name: "N7DispatchedControlsCard",
setup() {
@@ -138,7 +138,16 @@ import { Fragment, createApp, h, nextTick, reactive } from "vue";
"data-lucide": "chevron-down",
}),
]),
h("ol", { class: "assistant-dispatched-controls-list" }, state.commands.map(renderCommandRow)),
h("ol", { class: "assistant-dispatched-controls-list", hidden: state.hideCommands }, state.commands.map(renderCommandRow)),
h("div", {
class: "assistant-dispatched-controls-footer",
hidden: !state.footer,
ref(element) {
if (element && state.footer && state.footer.parentNode !== element) {
element.replaceChildren(state.footer);
}
},
}),
]);
},
});
@@ -160,12 +169,22 @@ import { Fragment, createApp, h, nextTick, reactive } from "vue";
return true;
}
function setDispatchedControlsFooter(container, footer, options = {}) {
const mount = commandMounts.get(container);
if (!mount || !(footer instanceof Element)) return false;
mount.state.footer = footer;
mount.state.hideCommands = Boolean(options.hideCommands);
refreshIcons();
return true;
}
document.documentElement.classList.add("vue-presentation-enabled");
document.documentElement.dataset.vueVersion = VUE_VERSION;
window.CognitiveAgentVueUI = Object.freeze({
available: true,
version: VUE_VERSION,
renderDispatchedControls,
setDispatchedControlsFooter,
renderModeChips,
});
}());