fix(scenes): restore cinema seat controls and ordered romantic lighting
This commit is contained in:
+40
-14
@@ -7049,12 +7049,16 @@ function setModeExecutionState(modeProfileId, modeState = "idle") {
|
||||
? "已停止"
|
||||
: active && modeState === "succeeded"
|
||||
? "已完成"
|
||||
: active && modeState === "submitted"
|
||||
? "待车端确认"
|
||||
: active && modeState === "partial"
|
||||
? "部分处理"
|
||||
: active && modeState === "failed"
|
||||
? "执行失败"
|
||||
: "点击执行";
|
||||
}
|
||||
});
|
||||
if (modeProfileId && ["succeeded", "failed", "started", "ended", "stopped"].includes(modeState)) {
|
||||
if (modeProfileId && ["succeeded", "failed", "started", "ended", "stopped", "submitted", "partial"].includes(modeState)) {
|
||||
state.modeRunTimer = window.setTimeout(() => setModeExecutionState(null), 2800);
|
||||
}
|
||||
}
|
||||
@@ -7073,6 +7077,35 @@ function hasExecutableModeCommandFlow(mode) {
|
||||
|| (plans && typeof plans === "object" && Object.keys(plans).length > 0);
|
||||
}
|
||||
|
||||
function savedModeExecutionView(mode, result) {
|
||||
const name = mode?.name || "功能模式";
|
||||
if (modeScheduleExecutionView(result)?.state === "processing") {
|
||||
return { state: "started", title: `${name}时间轴已启动`, toast: "时间轴已启动,可输入“停止动态模式”提前结束" };
|
||||
}
|
||||
if (!["succeeded", "partially_succeeded"].includes(result.status)) {
|
||||
return { state: "failed", title: `${name}执行未完成`, toast: `${name}未完成,请查看执行结果` };
|
||||
}
|
||||
const preview = result.execution_mode === "dry_run";
|
||||
const waiting = !preview && executionVerificationStatus(result) === "submitted_unverified";
|
||||
if (result.status === "partially_succeeded") {
|
||||
return {
|
||||
state: "partial",
|
||||
title: `${name}${preview ? "模拟校验部分通过" : waiting ? "部分指令已提交,待车端确认" : "部分完成"}`,
|
||||
toast: preview
|
||||
? `${name}模拟校验部分通过,仍有未由 PC 执行的动作`
|
||||
: `${name}仅部分处理成功,请查看各项指令和车端转发状态`,
|
||||
};
|
||||
}
|
||||
if (waiting) {
|
||||
return { state: "submitted", title: `${name}指令已提交,待车端确认`, toast: "指令已提交,尚未确认车辆执行完成" };
|
||||
}
|
||||
return {
|
||||
state: "succeeded",
|
||||
title: `${name}${preview ? "模拟校验完成" : "执行完成"}`,
|
||||
toast: `${name}${preview ? "模拟校验完成" : "已完成保存的控制指令流"}`,
|
||||
};
|
||||
}
|
||||
|
||||
async function executeSavedModeProfile(mode, { command = "" } = {}) {
|
||||
if (!hasExecutableModeCommandFlow(mode)) return false;
|
||||
const modeCommand = String(command || `进入${mode.name || mode.id}`).trim();
|
||||
@@ -7125,14 +7158,9 @@ async function executeSavedModeProfile(mode, { command = "" } = {}) {
|
||||
);
|
||||
if (!payload) throw new Error("模式卡片未返回执行结果");
|
||||
renderResult(payload);
|
||||
const scheduleRunning = modeScheduleExecutionView(payload)?.state === "processing";
|
||||
const completed = ["succeeded", "partially_succeeded"].includes(payload.status);
|
||||
$("#resultTitle").textContent = scheduleRunning
|
||||
? `${mode.name}时间轴已启动`
|
||||
: completed
|
||||
? `${mode.name}执行完成`
|
||||
: `${mode.name}执行未完成`;
|
||||
setModeExecutionState(mode.id, scheduleRunning ? "started" : completed ? "succeeded" : "failed");
|
||||
const executionView = savedModeExecutionView(mode, payload);
|
||||
$("#resultTitle").textContent = executionView.title;
|
||||
setModeExecutionState(mode.id, executionView.state);
|
||||
if (assistantModeHandle && assistant?.completeModeExecution) {
|
||||
assistant.completeModeExecution(assistantModeHandle, mode, payload, {
|
||||
command: modeCommand,
|
||||
@@ -7141,11 +7169,7 @@ async function executeSavedModeProfile(mode, { command = "" } = {}) {
|
||||
assistant?.announceModeExecution?.(mode, payload, { command: modeCommand });
|
||||
}
|
||||
if (state.executionMode === "hardware") await synchronizePhysicalSeatState();
|
||||
showToast(scheduleRunning
|
||||
? "时间轴已启动,可输入“停止动态模式”提前结束"
|
||||
: completed
|
||||
? `${mode.name}已直接执行保存的控制指令流`
|
||||
: `${mode.name}未完成,请查看执行结果`);
|
||||
showToast(executionView.toast);
|
||||
} catch (error) {
|
||||
setModeExecutionState(mode.id, "failed");
|
||||
setRunStatus("failed", "MODE FAILED");
|
||||
@@ -8926,6 +8950,8 @@ function renderResult(result) {
|
||||
? `${result.mode_profile?.name ? `${result.mode_profile.name} · ` : ""}${scheduleExecution.title}`
|
||||
: peripheralRoute && executionSucceeded
|
||||
? `${result.peripheral?.name || "第三方外设"} · ${result.peripheral?.action || "动作已执行"}`
|
||||
: savedModeExecution && result.mode_profile
|
||||
? savedModeExecutionView(result.mode_profile, result).title
|
||||
: partiallySucceeded
|
||||
? `${domains.length} 域场景部分完成`
|
||||
: executionSucceeded
|
||||
|
||||
Reference in New Issue
Block a user