feat: route mode cards through AI assistant

This commit is contained in:
vee
2026-09-09 08:32:51 +08:00
parent 93103c2579
commit 2af8b8f9ac
8 changed files with 145 additions and 22 deletions
+23 -11
View File
@@ -6417,22 +6417,34 @@ async function executeSavedModeProfile(mode) {
}
function applyModeCommand(command, modeProfileId = null) {
if (!command) return;
if ($("#runButton").disabled) {
const modeCommand = String(command || "").trim();
if (!modeCommand) return false;
const assistant = window.CognitiveAgentAssistant;
if (assistant?.isPending?.()) {
showToast("AI助手正在处理上一条指令,请稍候");
return false;
}
if ($("#runButton")?.disabled) {
showToast("上一条指令仍在执行,请稍候");
return;
return false;
}
const mode = modeProfiles().find((item) => item.id === modeProfileId);
setModeRailSelection(mode);
if (mode?.command_flow?.source_request_id) {
void executeSavedModeProfile(mode);
return;
}
closeModeGallery({ restoreFocus: false });
state.pendingModeProfileId = modeProfileId;
if (modeProfileId) setModeExecutionState(modeProfileId, "running");
$("#utterance").value = command;
$("#requestForm").requestSubmit();
assistant?.open?.();
const input = $("#utterance");
const form = $("#requestForm");
if (!input || !form) {
showToast("AI助手暂时不可用,请稍后重试");
return false;
}
input.value = modeCommand;
delete input.dataset.speechStage;
delete input.dataset.speechUtteranceId;
delete input.dataset.speechValue;
input.dispatchEvent(new Event("input", { bubbles: true }));
form.requestSubmit();
return true;
}
function applyRuntimeTargetPolicy(runtime) {
+1 -1
View File
@@ -20,7 +20,7 @@
<script src="/vendor/three/0.147.0/fflate.min.js" defer></script>
<script src="/vendor/three/0.147.0/FBXLoader.js" defer></script>
<script src="/network.js?v=android-pad-2" defer></script>
<script src="/app.js?v=dual-seat-128" defer></script>
<script src="/app.js?v=dual-seat-129" defer></script>
<script src="/speech-input.js?v=sensevoice-13" defer></script>
<script type="module" src="/gesture-control.js?v=android-pad-9"></script>
<script src="/pwa.js?v=android-pad-3" defer></script>
+2 -2
View File
@@ -1,4 +1,4 @@
const CACHE_VERSION = "cognitive-agent-pad-v275";
const CACHE_VERSION = "cognitive-agent-pad-v276";
const SHELL_CACHE = `${CACHE_VERSION}-shell`;
const RUNTIME_CACHE = `${CACHE_VERSION}-runtime`;
const APP_SHELL = [
@@ -6,7 +6,7 @@ const APP_SHELL = [
"/index.html",
"/styles.css?v=dual-seat-23",
"/network.js?v=android-pad-2",
"/app.js?v=dual-seat-128",
"/app.js?v=dual-seat-129",
"/gesture-control.js?v=android-pad-9",
"/pwa.js?v=android-pad-3",
"/console-v2.css?v=delivery-state-66",