|
@@ -81,18 +81,26 @@
|
|
|
<block type="ai_text_to_image"></block>
|
|
<block type="ai_text_to_image"></block>
|
|
|
<block type="ai_text_to_video"></block>
|
|
<block type="ai_text_to_video"></block>
|
|
|
<block type="ai_text_to_text"></block>
|
|
<block type="ai_text_to_text"></block>
|
|
|
- <block type="ai_smart_lamp_single_param"></block>
|
|
|
|
|
- <block type="ai_smart_lamp"></block>
|
|
|
|
|
- <block type="ai_lamp_set_brightness"></block>
|
|
|
|
|
- <block type="ai_lamp_set_color"></block>
|
|
|
|
|
|
|
+
|
|
|
<block type="ai_music_play"></block>
|
|
<block type="ai_music_play"></block>
|
|
|
|
|
|
|
|
|
|
+ <!-- 智能顶灯 -->
|
|
|
|
|
+ <block type="ai_control_top_lamp"></block>
|
|
|
|
|
+ <block type="ai_top_lamp_on"></block>
|
|
|
|
|
+ <block type="ai_top_lamp_off"></block>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 智能电视 -->
|
|
|
|
|
+ <block type="ai_control_tv"></block>
|
|
|
<block type="ai_turn_on_tv"></block>
|
|
<block type="ai_turn_on_tv"></block>
|
|
|
<block type="ai_turn_off_tv"></block>
|
|
<block type="ai_turn_off_tv"></block>
|
|
|
|
|
|
|
|
- <!-- 添加窗帘控制积木 -->
|
|
|
|
|
|
|
+ <!-- 智能窗帘 -->
|
|
|
|
|
+ <block type="ai_control_curtain"></block>
|
|
|
<block type="ai_curtain_open"></block>
|
|
<block type="ai_curtain_open"></block>
|
|
|
<block type="ai_curtain_close"></block>
|
|
<block type="ai_curtain_close"></block>
|
|
|
|
|
+
|
|
|
|
|
+ <block type="ai_smart_speaker_multi_param"></block>
|
|
|
|
|
+ <block type="ai_smart_speaker_single_param"></block>
|
|
|
</category>
|
|
</category>
|
|
|
|
|
|
|
|
<category name="逻辑" colour="%{BKY_LOGIC_HUE}">
|
|
<category name="逻辑" colour="%{BKY_LOGIC_HUE}">
|
|
@@ -251,7 +259,7 @@ const device = ref({
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// 台灯预览显示状态
|
|
// 台灯预览显示状态
|
|
|
-const showLampPreview = ref(true);
|
|
|
|
|
|
|
+const showLampPreview = ref(false);
|
|
|
// 语音识别
|
|
// 语音识别
|
|
|
const isRecording = ref(false);
|
|
const isRecording = ref(false);
|
|
|
const recordingCountdown = ref(10);
|
|
const recordingCountdown = ref(10);
|
|
@@ -328,118 +336,6 @@ const jsonDataString = computed({
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-// 响应式变量
|
|
|
|
|
-// const jsonData = ref({
|
|
|
|
|
-// "blocks": {
|
|
|
|
|
-// "languageVersion": 0,
|
|
|
|
|
-// "blocks": [
|
|
|
|
|
-// {
|
|
|
|
|
-// "type": "variables_set",
|
|
|
|
|
-// "id": "kM:Fgf:wd4U3Z$j0x8oK",
|
|
|
|
|
-// "x": 90,
|
|
|
|
|
-// "y": 130,
|
|
|
|
|
-// "fields": {
|
|
|
|
|
-// "VAR": {
|
|
|
|
|
-// "id": "MHW(ZbOKhL!/An`5N@6`"
|
|
|
|
|
-// }
|
|
|
|
|
-// },
|
|
|
|
|
-// "inputs": {
|
|
|
|
|
-// "VALUE": {
|
|
|
|
|
-// "block": {
|
|
|
|
|
-// "type": "ai_voice_input",
|
|
|
|
|
-// "id": "l5E=g|1L+4hThQ8v})lQ",
|
|
|
|
|
-// "fields": {
|
|
|
|
|
-// "LANGUAGE": "zh-CN"
|
|
|
|
|
-// },
|
|
|
|
|
-// "inputs": {
|
|
|
|
|
-// "PROMPT": {
|
|
|
|
|
-// "block": {
|
|
|
|
|
-// "type": "text",
|
|
|
|
|
-// "id": "Q*n.c_)@7j^E2=s5/X!n",
|
|
|
|
|
-// "fields": {
|
|
|
|
|
-// "TEXT": "请发言:"
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// },
|
|
|
|
|
-// "next": {
|
|
|
|
|
-// "block": {
|
|
|
|
|
-// "type": "variables_set",
|
|
|
|
|
-// "id": "]g.xbBe.i=a9B*Kfw@|`",
|
|
|
|
|
-// "fields": {
|
|
|
|
|
-// "VAR": {
|
|
|
|
|
-// "id": "zn.7{ZqbUaH1?P,R05hF"
|
|
|
|
|
-// }
|
|
|
|
|
-// },
|
|
|
|
|
-// "inputs": {
|
|
|
|
|
-// "VALUE": {
|
|
|
|
|
-// "block": {
|
|
|
|
|
-// "type": "ai_text_to_text",
|
|
|
|
|
-// "id": "R$h+R!6#@+4=+WX1*nvh",
|
|
|
|
|
-// "inputs": {
|
|
|
|
|
-// "PROMPT": {
|
|
|
|
|
-// "block": {
|
|
|
|
|
-// "type": "variables_get",
|
|
|
|
|
-// "id": "h$S$nt)3VU.=nX*W-mo~",
|
|
|
|
|
-// "fields": {
|
|
|
|
|
-// "VAR": {
|
|
|
|
|
-// "id": "MHW(ZbOKhL!/An`5N@6`"
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// },
|
|
|
|
|
-// "提示词": {
|
|
|
|
|
-// "block": {
|
|
|
|
|
-// "type": "text",
|
|
|
|
|
-// "id": "7k%sgLP?i]e[,m^49P++",
|
|
|
|
|
-// "fields": {
|
|
|
|
|
-// "TEXT": "请只回复我指定格式:白,100,热闹"
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// },
|
|
|
|
|
-// "next": {
|
|
|
|
|
-// "block": {
|
|
|
|
|
-// "type": "ai_smart_lamp_single_param",
|
|
|
|
|
-// "id": "!.0;Ktwm+Z?o8_9FRa}G",
|
|
|
|
|
-// "inputs": {
|
|
|
|
|
-// "PARAMS": {
|
|
|
|
|
-// "block": {
|
|
|
|
|
-// "type": "variables_get",
|
|
|
|
|
-// "id": "d{cIJ-kEFFQcn~%A,g@g",
|
|
|
|
|
-// "fields": {
|
|
|
|
|
-// "VAR": {
|
|
|
|
|
-// "id": "zn.7{ZqbUaH1?P,R05hF"
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// ]
|
|
|
|
|
-// },
|
|
|
|
|
-// "variables": [
|
|
|
|
|
-// {
|
|
|
|
|
-// "name": "inputText",
|
|
|
|
|
-// "id": "MHW(ZbOKhL!/An`5N@6`"
|
|
|
|
|
-// },
|
|
|
|
|
-// {
|
|
|
|
|
-// "name": "lampConfig",
|
|
|
|
|
-// "id": "zn.7{ZqbUaH1?P,R05hF"
|
|
|
|
|
-// }
|
|
|
|
|
-// ]
|
|
|
|
|
-// });
|
|
|
|
|
-
|
|
|
|
|
//输出结果
|
|
//输出结果
|
|
|
const output = ref('');
|
|
const output = ref('');
|
|
|
const statusMessage = ref('');
|
|
const statusMessage = ref('');
|
|
@@ -863,49 +759,6 @@ const aiService = {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- // 设置台灯亮度
|
|
|
|
|
- setLampBrightness: withErrorHandling('设置台灯亮度', async function(brightness) {
|
|
|
|
|
- // 验证亮度值在0-100之间
|
|
|
|
|
- const validBrightness = Math.max(0, Math.min(100, parseInt(brightness) || 0));
|
|
|
|
|
-
|
|
|
|
|
- // 更新状态
|
|
|
|
|
- state.lamp.brightness = validBrightness;
|
|
|
|
|
-
|
|
|
|
|
- // 模拟API调用(实际项目中可替换为真实API)
|
|
|
|
|
- console.log(`智能台灯亮度已设置为: ${validBrightness}%`);
|
|
|
|
|
-
|
|
|
|
|
- return validBrightness;
|
|
|
|
|
- }, '设置台灯亮度失败'),
|
|
|
|
|
-
|
|
|
|
|
- // 设置台灯颜色
|
|
|
|
|
- setLampColor: withErrorHandling('设置台灯颜色', async function(color) {
|
|
|
|
|
- // 预定义的颜色映射
|
|
|
|
|
- const colorMap = {
|
|
|
|
|
- '紫': '#D886F0',
|
|
|
|
|
- '橙': '#F89E35',
|
|
|
|
|
- '黄': '#F9E67E',
|
|
|
|
|
- '青': '#6BF5E6',
|
|
|
|
|
- '白': '#ffffff',
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- // 获取有效的颜色值
|
|
|
|
|
- let validColor = colorMap[color] || color;
|
|
|
|
|
-
|
|
|
|
|
- // 检查是否是有效的颜色格式
|
|
|
|
|
- if (!/^#[0-9A-F]{6}$/i.test(validColor)) {
|
|
|
|
|
- validColor = "#ffffff"; // 默认白色
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 更新状态
|
|
|
|
|
- state.lamp.color = validColor;
|
|
|
|
|
- state.lamp.colorLog = color;
|
|
|
|
|
-
|
|
|
|
|
- // 模拟API调用(实际项目中可替换为真实API)
|
|
|
|
|
- console.log(`智能台灯颜色已设置为: ${color}`);
|
|
|
|
|
-
|
|
|
|
|
- return validColor;
|
|
|
|
|
- }, '设置台灯颜色失败'),
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 播放音乐功能
|
|
* 播放音乐功能
|
|
|
* @param {string} musicType - 音乐类型
|
|
* @param {string} musicType - 音乐类型
|
|
@@ -922,49 +775,43 @@ const aiService = {
|
|
|
return stopMusic(state, musicPlayer);
|
|
return stopMusic(state, musicPlayer);
|
|
|
}, '停止音乐失败'),
|
|
}, '停止音乐失败'),
|
|
|
|
|
|
|
|
- // 综合控制台灯(参数格式:"颜色, 亮度, 音乐")
|
|
|
|
|
- controlLampWithSingleParam: withErrorHandling('智能台灯综合控制', async function(params) {
|
|
|
|
|
- // 解析参数字符串
|
|
|
|
|
- let color = '白'; // 默认颜色
|
|
|
|
|
- let brightness = 0; // 默认亮度
|
|
|
|
|
- let music = ''; // 音乐信息
|
|
|
|
|
-
|
|
|
|
|
- if (params && typeof params === 'string') {
|
|
|
|
|
- // 根据逗号分割参数
|
|
|
|
|
- const paramArray = params.split(',').map(p => p.trim());
|
|
|
|
|
-
|
|
|
|
|
- // 提取颜色(第一个参数)
|
|
|
|
|
- if (paramArray.length > 0 && paramArray[0]) {
|
|
|
|
|
- color = paramArray[0];
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 提取亮度(第二个参数)
|
|
|
|
|
- if (paramArray.length > 1 && paramArray[1]) {
|
|
|
|
|
- brightness = paramArray[1];
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 提取音乐(第三个参数)
|
|
|
|
|
- if (paramArray.length > 2 && paramArray[2]) {
|
|
|
|
|
- music = paramArray[2];
|
|
|
|
|
-
|
|
|
|
|
- // 调用音乐播放函数
|
|
|
|
|
- await this.playMusic(music);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 控制顶灯状态
|
|
|
|
|
+ controlTopLamp: withErrorHandling('控制顶灯状态', async function(isOn) {
|
|
|
|
|
+ // 根据传入的布尔值决定是打开还是关闭顶灯
|
|
|
|
|
+ if (isOn) {
|
|
|
|
|
+ await this.topLampOn();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ await this.topLampOff();
|
|
|
}
|
|
}
|
|
|
- // 调用控制台灯方法
|
|
|
|
|
- return await this.controlLamp(brightness, color);
|
|
|
|
|
- }, '智能台灯综合控制失败'),
|
|
|
|
|
-
|
|
|
|
|
- // 综合控制台灯(参数格式:"颜色, 亮度")
|
|
|
|
|
- controlLamp: withErrorHandling('智能台灯控制', async function(brightness, color) {
|
|
|
|
|
- // 先设置亮度
|
|
|
|
|
- await this.setLampBrightness(brightness);
|
|
|
|
|
|
|
+ return isOn;
|
|
|
|
|
+ }, '控制窗帘状态失败'),
|
|
|
|
|
+
|
|
|
|
|
+ // 打开顶灯
|
|
|
|
|
+ topLampOn: withErrorHandling('打开顶灯', async function() {
|
|
|
|
|
+ console.log("打开顶灯");
|
|
|
|
|
+ // 这里可以添加实际的顶灯控制逻辑
|
|
|
|
|
+ showStatus("顶灯已打开");
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }, '打开顶灯失败'),
|
|
|
|
|
|
|
|
- // 再设置颜色
|
|
|
|
|
- await this.setLampColor(color);
|
|
|
|
|
|
|
+ // 关闭顶灯
|
|
|
|
|
+ topLampOff: withErrorHandling('关闭顶灯', async function() {
|
|
|
|
|
+ console.log("关闭顶灯");
|
|
|
|
|
+ // 这里可以添加实际的顶灯控制逻辑
|
|
|
|
|
+ showStatus("顶灯已关闭");
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }, '关闭窗帘失败'),
|
|
|
|
|
|
|
|
- return { brightness: state.lamp.brightness, color: state.lamp.color };
|
|
|
|
|
- }, '智能台灯控制失败'),
|
|
|
|
|
|
|
+ // 控制电视状态
|
|
|
|
|
+ controlTv: withErrorHandling('控制电视状态', async function(isOn) {
|
|
|
|
|
+ // 根据传入的布尔值决定是打开还是关闭电视
|
|
|
|
|
+ if (isOn) {
|
|
|
|
|
+ await this.turnOnTv();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ await this.turnOffTv();
|
|
|
|
|
+ }
|
|
|
|
|
+ return isOn;
|
|
|
|
|
+ }, '控制电视状态失败'),
|
|
|
|
|
|
|
|
// 打开电视
|
|
// 打开电视
|
|
|
turnOnTv: withErrorHandling('打开电视', async function() {
|
|
turnOnTv: withErrorHandling('打开电视', async function() {
|
|
@@ -984,6 +831,17 @@ const aiService = {
|
|
|
return true;
|
|
return true;
|
|
|
}, '关闭电视失败'),
|
|
}, '关闭电视失败'),
|
|
|
|
|
|
|
|
|
|
+ // 控制窗帘状态
|
|
|
|
|
+ controlCurtain: withErrorHandling('控制窗帘状态', async function(isOn) {
|
|
|
|
|
+ // 根据传入的布尔值决定是打开还是关闭窗帘
|
|
|
|
|
+ if (isOn) {
|
|
|
|
|
+ await this.openCurtain();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ await this.closeCurtain();
|
|
|
|
|
+ }
|
|
|
|
|
+ return isOn;
|
|
|
|
|
+ }, '控制窗帘状态失败'),
|
|
|
|
|
+
|
|
|
// 打开窗帘
|
|
// 打开窗帘
|
|
|
openCurtain: withErrorHandling('打开窗帘', async function() {
|
|
openCurtain: withErrorHandling('打开窗帘', async function() {
|
|
|
console.log("打开窗帘");
|
|
console.log("打开窗帘");
|
|
@@ -1000,6 +858,56 @@ const aiService = {
|
|
|
return true;
|
|
return true;
|
|
|
}, '关闭窗帘失败'),
|
|
}, '关闭窗帘失败'),
|
|
|
|
|
|
|
|
|
|
+ // 智能音箱命令处理 - 单参数版本
|
|
|
|
|
+ controlSmartSpeaker: withErrorHandling('智能音箱命令处理(单参数)', async function(params) {
|
|
|
|
|
+ console.log(`智能音箱执行命令: ${params}`);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // 解析命令字符串 (格式: light=on,curtain=open,tv=on)
|
|
|
|
|
+ const commandPairs = params.split(',');
|
|
|
|
|
+
|
|
|
|
|
+ for (const pair of commandPairs) {
|
|
|
|
|
+ const [device, action] = pair.split('=');
|
|
|
|
|
+
|
|
|
|
|
+ if (!device || !action) continue;
|
|
|
|
|
+
|
|
|
|
|
+ // 根据设备类型和动作执行相应的操作
|
|
|
|
|
+ if (device === 'light') {
|
|
|
|
|
+ if (action === 'on' || action.toLowerCase() === 'true' || action === '1') {
|
|
|
|
|
+ // 这里可以添加开灯光的具体逻辑
|
|
|
|
|
+ console.log('打开灯光');
|
|
|
|
|
+ showStatus('灯光已打开');
|
|
|
|
|
+ } else if (action === 'off' || action.toLowerCase() === 'false' || action === '0') {
|
|
|
|
|
+ // 这里可以添加关灯光的具体逻辑
|
|
|
|
|
+ console.log('关闭灯光');
|
|
|
|
|
+ showStatus('灯光已关闭');
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (device === 'curtain') {
|
|
|
|
|
+ if (action === 'open') {
|
|
|
|
|
+ await this.openCurtain();
|
|
|
|
|
+ } else if (action === 'close') {
|
|
|
|
|
+ await this.closeCurtain();
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (device === 'tv') {
|
|
|
|
|
+ if (action === 'on') {
|
|
|
|
|
+ await this.turnOnTv();
|
|
|
|
|
+ } else if (action === 'off') {
|
|
|
|
|
+ await this.turnOffTv();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return "命令执行完成";
|
|
|
|
|
+ }, '智能音箱命令执行失败'),
|
|
|
|
|
+
|
|
|
|
|
+ // 智能音箱命令处理 - 多参数版本
|
|
|
|
|
+ controlSmartSpeakers: withErrorHandling('智能音箱命令处理(多参数)', async function(lightStatus, curtainStatus, tvStatus) {
|
|
|
|
|
+ // 模拟智能音箱执行命令
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ return "result";
|
|
|
|
|
+ }, '智能音箱命令执行失败'),
|
|
|
|
|
+
|
|
|
// 启动任务轮询
|
|
// 启动任务轮询
|
|
|
startPollingTasks(type) {
|
|
startPollingTasks(type) {
|
|
|
if (type === 'image' || type === 'all') {
|
|
if (type === 'image' || type === 'all') {
|
|
@@ -1149,92 +1057,87 @@ onMounted(() => {
|
|
|
},
|
|
},
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- //AI智能台灯单参数积木
|
|
|
|
|
- Blockly.Blocks['ai_smart_lamp_single_param'] = {
|
|
|
|
|
|
|
+ // 注册音乐播放积木
|
|
|
|
|
+ Blockly.Blocks['ai_music_play'] = {
|
|
|
init: function() {
|
|
init: function() {
|
|
|
this.appendDummyInput()
|
|
this.appendDummyInput()
|
|
|
- .appendField('智能台灯控制(单参数)');
|
|
|
|
|
- this.appendValueInput('PARAMS')
|
|
|
|
|
- .setCheck('String')
|
|
|
|
|
- .appendField('参数(格式: 颜色,亮度,音乐):');
|
|
|
|
|
|
|
+ .appendField('播放音乐');
|
|
|
this.appendDummyInput()
|
|
this.appendDummyInput()
|
|
|
- .appendField('例如: 蓝,50,平静');
|
|
|
|
|
|
|
+ .appendField('音乐类型:')
|
|
|
|
|
+ .appendField(
|
|
|
|
|
+ new Blockly.FieldDropdown([
|
|
|
|
|
+ ['热闹', '热闹'],
|
|
|
|
|
+ ['舒缓', '舒缓'],
|
|
|
|
|
+ ]),
|
|
|
|
|
+ 'MUSIC_TYPE'
|
|
|
|
|
+ );
|
|
|
this.setInputsInline(false);
|
|
this.setInputsInline(false);
|
|
|
this.setPreviousStatement(true, null);
|
|
this.setPreviousStatement(true, null);
|
|
|
this.setNextStatement(true, null);
|
|
this.setNextStatement(true, null);
|
|
|
- this.setColour(280);
|
|
|
|
|
- this.setTooltip('通过一个参数字符串控制智能台灯的亮度、颜色和音乐\n格式: 颜色,亮度,音乐\n例如: 蓝,50,平静');
|
|
|
|
|
|
|
+ this.setColour(290);
|
|
|
|
|
+ this.setTooltip('播放指定类型的音乐');
|
|
|
this.setHelpUrl('');
|
|
this.setHelpUrl('');
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- // 注册AI智能台灯积木
|
|
|
|
|
- Blockly.Blocks["ai_smart_lamp"] = {
|
|
|
|
|
- init: function () {
|
|
|
|
|
- this.appendDummyInput().appendField("智能台灯控制");
|
|
|
|
|
- this.appendValueInput("BRIGHTNESS")
|
|
|
|
|
- .setCheck(["Number", "String"])
|
|
|
|
|
- .appendField("亮度 (0-100):");
|
|
|
|
|
- this.appendValueInput("COLOR").setCheck("String").appendField("颜色:");
|
|
|
|
|
|
|
+ // 注册控制顶灯状态积木
|
|
|
|
|
+ Blockly.Blocks['ai_control_top_lamp'] = {
|
|
|
|
|
+ init: function() {
|
|
|
|
|
+ this.appendDummyInput()
|
|
|
|
|
+ .appendField('设置顶灯状态');
|
|
|
|
|
+ this.appendValueInput('IS_ON')
|
|
|
|
|
+ .setCheck('Boolean')
|
|
|
|
|
+ .appendField('顶灯状态:');
|
|
|
this.setInputsInline(false);
|
|
this.setInputsInline(false);
|
|
|
this.setPreviousStatement(true, null);
|
|
this.setPreviousStatement(true, null);
|
|
|
this.setNextStatement(true, null);
|
|
this.setNextStatement(true, null);
|
|
|
- this.setColour(280);
|
|
|
|
|
- this.setTooltip("控制智能台灯的亮度和颜色");
|
|
|
|
|
- this.setHelpUrl("");
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ this.setColour(260);
|
|
|
|
|
+ this.setTooltip('设置顶灯的开关状态');
|
|
|
|
|
+ this.setHelpUrl('');
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- // 注册AI台灯设置亮度积木
|
|
|
|
|
- Blockly.Blocks["ai_lamp_set_brightness"] = {
|
|
|
|
|
- init: function () {
|
|
|
|
|
- this.appendDummyInput().appendField("设置台灯亮度");
|
|
|
|
|
- this.appendValueInput("BRIGHTNESS")
|
|
|
|
|
- .setCheck(["Number", "String"])
|
|
|
|
|
- .appendField("亮度 (0-100):");
|
|
|
|
|
|
|
+ // 注册打开顶灯积木
|
|
|
|
|
+ Blockly.Blocks['ai_top_lamp_on'] = {
|
|
|
|
|
+ init: function() {
|
|
|
|
|
+ this.appendDummyInput()
|
|
|
|
|
+ .appendField('打开顶灯');
|
|
|
this.setInputsInline(false);
|
|
this.setInputsInline(false);
|
|
|
this.setPreviousStatement(true, null);
|
|
this.setPreviousStatement(true, null);
|
|
|
this.setNextStatement(true, null);
|
|
this.setNextStatement(true, null);
|
|
|
- this.setColour(270);
|
|
|
|
|
- this.setTooltip("设置智能台灯的亮度");
|
|
|
|
|
- this.setHelpUrl("");
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ this.setColour(260);
|
|
|
|
|
+ this.setTooltip('打开顶灯');
|
|
|
|
|
+ this.setHelpUrl('');
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- // 注册AI台灯设置颜色积木
|
|
|
|
|
- Blockly.Blocks["ai_lamp_set_color"] = {
|
|
|
|
|
- init: function () {
|
|
|
|
|
- this.appendDummyInput().appendField("设置台灯颜色");
|
|
|
|
|
- this.appendValueInput("COLOR").setCheck("String").appendField("颜色:");
|
|
|
|
|
- this.appendDummyInput().appendField("可选颜色: 白,黄,紫,橙,青");
|
|
|
|
|
|
|
+ // 注册关闭顶灯积木
|
|
|
|
|
+ Blockly.Blocks['ai_top_lamp_off'] = {
|
|
|
|
|
+ init: function() {
|
|
|
|
|
+ this.appendDummyInput()
|
|
|
|
|
+ .appendField('关闭顶灯');
|
|
|
this.setInputsInline(false);
|
|
this.setInputsInline(false);
|
|
|
this.setPreviousStatement(true, null);
|
|
this.setPreviousStatement(true, null);
|
|
|
this.setNextStatement(true, null);
|
|
this.setNextStatement(true, null);
|
|
|
- this.setColour(275);
|
|
|
|
|
- this.setTooltip("设置智能台灯的颜色");
|
|
|
|
|
- this.setHelpUrl("");
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ this.setColour(260);
|
|
|
|
|
+ this.setTooltip('关闭顶灯');
|
|
|
|
|
+ this.setHelpUrl('');
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- // 注册音乐播放积木
|
|
|
|
|
- Blockly.Blocks['ai_music_play'] = {
|
|
|
|
|
|
|
+ // 注册控制电视状态积木
|
|
|
|
|
+ Blockly.Blocks['ai_control_tv'] = {
|
|
|
init: function() {
|
|
init: function() {
|
|
|
this.appendDummyInput()
|
|
this.appendDummyInput()
|
|
|
- .appendField('播放音乐');
|
|
|
|
|
- this.appendDummyInput()
|
|
|
|
|
- .appendField('音乐类型:')
|
|
|
|
|
- .appendField(
|
|
|
|
|
- new Blockly.FieldDropdown([
|
|
|
|
|
- ['热闹', '热闹'],
|
|
|
|
|
- ['舒缓', '舒缓'],
|
|
|
|
|
- ]),
|
|
|
|
|
- 'MUSIC_TYPE'
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ .appendField('设置电视状态');
|
|
|
|
|
+ this.appendValueInput('IS_ON')
|
|
|
|
|
+ .setCheck('Boolean')
|
|
|
|
|
+ .appendField('电视状态:');
|
|
|
this.setInputsInline(false);
|
|
this.setInputsInline(false);
|
|
|
this.setPreviousStatement(true, null);
|
|
this.setPreviousStatement(true, null);
|
|
|
this.setNextStatement(true, null);
|
|
this.setNextStatement(true, null);
|
|
|
- this.setColour(290);
|
|
|
|
|
- this.setTooltip('播放指定类型的音乐');
|
|
|
|
|
|
|
+ this.setColour(260);
|
|
|
|
|
+ this.setTooltip('设置电视的开关状态');
|
|
|
this.setHelpUrl('');
|
|
this.setHelpUrl('');
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -1267,6 +1170,23 @@ onMounted(() => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ // 注册控制窗帘状态积木
|
|
|
|
|
+ Blockly.Blocks['ai_control_curtain'] = {
|
|
|
|
|
+ init: function() {
|
|
|
|
|
+ this.appendDummyInput()
|
|
|
|
|
+ .appendField('设置窗帘状态');
|
|
|
|
|
+ this.appendValueInput('IS_ON')
|
|
|
|
|
+ .setCheck('Boolean')
|
|
|
|
|
+ .appendField('窗帘状态:');
|
|
|
|
|
+ this.setInputsInline(false);
|
|
|
|
|
+ this.setPreviousStatement(true, null);
|
|
|
|
|
+ this.setNextStatement(true, null);
|
|
|
|
|
+ this.setColour(260);
|
|
|
|
|
+ this.setTooltip('设置窗帘的开关状态');
|
|
|
|
|
+ this.setHelpUrl('');
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
// 注册打开窗帘积木
|
|
// 注册打开窗帘积木
|
|
|
Blockly.Blocks['ai_curtain_open'] = {
|
|
Blockly.Blocks['ai_curtain_open'] = {
|
|
|
init: function() {
|
|
init: function() {
|
|
@@ -1295,6 +1215,47 @@ onMounted(() => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ // 注册智能音箱多参数积木组件
|
|
|
|
|
+ Blockly.Blocks['ai_smart_speaker_multi_param'] = {
|
|
|
|
|
+ init: function() {
|
|
|
|
|
+ this.appendDummyInput()
|
|
|
|
|
+ .appendField('智能音箱控制');
|
|
|
|
|
+ this.appendValueInput('LIGHT_STATUS')
|
|
|
|
|
+ .setCheck(['Boolean', 'String'])
|
|
|
|
|
+ .appendField('灯状态:');
|
|
|
|
|
+ this.appendValueInput('CURTAIN_STATUS')
|
|
|
|
|
+ .setCheck(['Boolean', 'String'])
|
|
|
|
|
+ .appendField('窗帘状态:');
|
|
|
|
|
+ this.appendValueInput('TV_STATUS')
|
|
|
|
|
+ .setCheck(['Boolean', 'String'])
|
|
|
|
|
+ .appendField('电视状态:');
|
|
|
|
|
+ this.setInputsInline(false);
|
|
|
|
|
+ this.setPreviousStatement(true, null);
|
|
|
|
|
+ this.setNextStatement(true, null);
|
|
|
|
|
+ this.setColour(220);
|
|
|
|
|
+ this.setTooltip('通过智能音箱控制多个设备(灯、窗帘、电视)');
|
|
|
|
|
+ this.setHelpUrl('');
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 注册智能音箱单参数积木组件
|
|
|
|
|
+ Blockly.Blocks['ai_smart_speaker_single_param'] = {
|
|
|
|
|
+ init: function() {
|
|
|
|
|
+ this.appendDummyInput()
|
|
|
|
|
+ .appendField('智能音箱单参数控制');
|
|
|
|
|
+ this.appendValueInput('COMMANDS')
|
|
|
|
|
+ .setCheck('String')
|
|
|
|
|
+ .appendField('命令(英文逗号分隔):');
|
|
|
|
|
+ this.appendDummyInput().appendField('格式示例: light=on,curtain=open,tv=on');
|
|
|
|
|
+ this.setInputsInline(false);
|
|
|
|
|
+ this.setPreviousStatement(true, null);
|
|
|
|
|
+ this.setNextStatement(true, null);
|
|
|
|
|
+ this.setColour(230);
|
|
|
|
|
+ this.setTooltip('通过智能音箱使用英文逗号分隔的命令控制多个设备');
|
|
|
|
|
+ this.setHelpUrl('');
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
// 注册JavaScript代码生成器
|
|
// 注册JavaScript代码生成器
|
|
|
registerJavaScriptGenerators();
|
|
registerJavaScriptGenerators();
|
|
|
|
|
|
|
@@ -1420,39 +1381,36 @@ function registerJavaScriptGenerators() {
|
|
|
return [code, javascriptGenerator.ORDER_ATOMIC];
|
|
return [code, javascriptGenerator.ORDER_ATOMIC];
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- // 智能台灯控制(单参数)
|
|
|
|
|
- javascriptGenerator.forBlock['ai_smart_lamp_single_param'] = function(block, generator) {
|
|
|
|
|
- const params = generator.valueToCode(block, 'PARAMS', javascriptGenerator.ORDER_ATOMIC);
|
|
|
|
|
- const code = `await aiService.controlLampWithSingleParam(${params || "'白,0,平静'"});`;
|
|
|
|
|
|
|
+ // 音乐播放
|
|
|
|
|
+ javascriptGenerator.forBlock['ai_music_play'] = function(block, generator) {
|
|
|
|
|
+ const musicType = block.getFieldValue('MUSIC_TYPE');
|
|
|
|
|
+ const code = `await aiService.playMusic('${musicType}');`;
|
|
|
return code;
|
|
return code;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- // 智能台灯控制(多参数)
|
|
|
|
|
- javascriptGenerator.forBlock['ai_smart_lamp'] = function(block, generator) {
|
|
|
|
|
- const brightness = generator.valueToCode(block, 'BRIGHTNESS', javascriptGenerator.ORDER_ATOMIC);
|
|
|
|
|
- const color = generator.valueToCode(block, 'COLOR', javascriptGenerator.ORDER_ATOMIC);
|
|
|
|
|
- const code = `await aiService.controlLamp(${brightness || '0'}, ${color || "'白'"});`;
|
|
|
|
|
|
|
+ // 控制顶灯状态
|
|
|
|
|
+ javascriptGenerator.forBlock['ai_control_top_lamp'] = function(block, generator) {
|
|
|
|
|
+ const isOn = generator.valueToCode(block, 'IS_ON', javascriptGenerator.ORDER_ATOMIC);
|
|
|
|
|
+ const code = `await aiService.controlTopLamp(${isOn || 'false'});`;
|
|
|
return code;
|
|
return code;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- // 设置台灯亮度
|
|
|
|
|
- javascriptGenerator.forBlock['ai_lamp_set_brightness'] = function(block, generator) {
|
|
|
|
|
- const brightness = generator.valueToCode(block, 'BRIGHTNESS', javascriptGenerator.ORDER_ATOMIC);
|
|
|
|
|
- const code = `await aiService.setLampBrightness(${brightness || '0'});`;
|
|
|
|
|
|
|
+ // 打开顶灯
|
|
|
|
|
+ javascriptGenerator.forBlock['ai_top_lamp_on'] = function(block, generator) {
|
|
|
|
|
+ const code = `await aiService.topLampOn();`;
|
|
|
return code;
|
|
return code;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- // 设置台灯颜色
|
|
|
|
|
- javascriptGenerator.forBlock['ai_lamp_set_color'] = function(block, generator) {
|
|
|
|
|
- const color = generator.valueToCode(block, 'COLOR', javascriptGenerator.ORDER_ATOMIC);
|
|
|
|
|
- const code = `await aiService.setLampColor(${color || "'白'"});`;
|
|
|
|
|
|
|
+ // 关闭顶灯
|
|
|
|
|
+ javascriptGenerator.forBlock['ai_top_lamp_off'] = function(block, generator) {
|
|
|
|
|
+ const code = `await aiService.topLampOff();`;
|
|
|
return code;
|
|
return code;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- // 音乐播放
|
|
|
|
|
- javascriptGenerator.forBlock['ai_music_play'] = function(block, generator) {
|
|
|
|
|
- const musicType = block.getFieldValue('MUSIC_TYPE');
|
|
|
|
|
- const code = `await aiService.playMusic('${musicType}');`;
|
|
|
|
|
|
|
+ // 控制电视状态
|
|
|
|
|
+ javascriptGenerator.forBlock['ai_control_tv'] = function(block, generator) {
|
|
|
|
|
+ const isOn = generator.valueToCode(block, 'IS_ON', javascriptGenerator.ORDER_ATOMIC);
|
|
|
|
|
+ const code = `await aiService.controlTv(${isOn || 'false'});`;
|
|
|
return code;
|
|
return code;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -1468,6 +1426,13 @@ function registerJavaScriptGenerators() {
|
|
|
return code;
|
|
return code;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ // 控制窗帘状态
|
|
|
|
|
+ javascriptGenerator.forBlock['ai_control_curtain'] = function(block, generator) {
|
|
|
|
|
+ const isOn = generator.valueToCode(block, 'IS_ON', javascriptGenerator.ORDER_ATOMIC);
|
|
|
|
|
+ const code = `await aiService.controlCurtain(${isOn || 'false'});`;
|
|
|
|
|
+ return code;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
// 打开窗帘
|
|
// 打开窗帘
|
|
|
javascriptGenerator.forBlock['ai_curtain_open'] = function(block, generator) {
|
|
javascriptGenerator.forBlock['ai_curtain_open'] = function(block, generator) {
|
|
|
const code = `await aiService.openCurtain();`;
|
|
const code = `await aiService.openCurtain();`;
|
|
@@ -1479,6 +1444,24 @@ function registerJavaScriptGenerators() {
|
|
|
const code = `await aiService.closeCurtain();`;
|
|
const code = `await aiService.closeCurtain();`;
|
|
|
return code;
|
|
return code;
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
|
|
+ // 智能音箱多参数控制
|
|
|
|
|
+ javascriptGenerator.forBlock['ai_smart_speaker_multi_param'] = function(block, generator) {
|
|
|
|
|
+ const lightStatus = generator.valueToCode(block, 'LIGHT_STATUS', javascriptGenerator.ORDER_ATOMIC);
|
|
|
|
|
+ const curtainStatus = generator.valueToCode(block, 'CURTAIN_STATUS', javascriptGenerator.ORDER_ATOMIC);
|
|
|
|
|
+ const tvStatus = generator.valueToCode(block, 'TV_STATUS', javascriptGenerator.ORDER_ATOMIC);
|
|
|
|
|
+
|
|
|
|
|
+ const code = `await aiService.controlSmartSpeakers(${lightStatus || 'false'}, ${curtainStatus || 'false'}, ${tvStatus || 'false'});`;
|
|
|
|
|
+ return code;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 智能音箱单参数控制
|
|
|
|
|
+ javascriptGenerator.forBlock['ai_smart_speaker_single_param'] = function(block, generator) {
|
|
|
|
|
+ const params = generator.valueToCode(block, 'COMMANDS', javascriptGenerator.ORDER_ATOMIC);
|
|
|
|
|
+
|
|
|
|
|
+ const code = `await aiService.controlSmartSpeaker(${params});`;
|
|
|
|
|
+ return code;
|
|
|
|
|
+ };
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 注册Python代码生成器
|
|
// 注册Python代码生成器
|
|
@@ -1515,39 +1498,37 @@ function registerPythonGenerators() {
|
|
|
return [code, pythonGenerator.ORDER_ATOMIC];
|
|
return [code, pythonGenerator.ORDER_ATOMIC];
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- // 智能台灯控制(单参数)
|
|
|
|
|
- pythonGenerator.forBlock['ai_smart_lamp_single_param'] = function(block, generator) {
|
|
|
|
|
- const params = generator.valueToCode(block, 'PARAMS', pythonGenerator.ORDER_ATOMIC);
|
|
|
|
|
- const code = `ai_service.control_lamp_with_single_param(${params || "'白,0,平静'"})\n`;
|
|
|
|
|
|
|
+ // 音乐播放
|
|
|
|
|
+ pythonGenerator.forBlock['ai_music_play'] = function(block, generator) {
|
|
|
|
|
+ const musicType = block.getFieldValue('MUSIC_TYPE');
|
|
|
|
|
+ const code = `ai_service.play_music('${musicType}')\n`;
|
|
|
return code;
|
|
return code;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- // 智能台灯控制
|
|
|
|
|
- pythonGenerator.forBlock['ai_smart_lamp'] = function(block, generator) {
|
|
|
|
|
- const brightness = generator.valueToCode(block, 'BRIGHTNESS', pythonGenerator.ORDER_ATOMIC);
|
|
|
|
|
- const color = generator.valueToCode(block, 'COLOR', pythonGenerator.ORDER_ATOMIC);
|
|
|
|
|
- const code = `ai_service.control_lamp(${brightness || '0'}, ${color || "'白'"})\n`;
|
|
|
|
|
|
|
+ // 控制顶灯状态
|
|
|
|
|
+ pythonGenerator.forBlock['ai_control_top_lamp'] = function(block, generator) {
|
|
|
|
|
+ const isOn = generator.valueToCode(block, 'IS_ON', pythonGenerator.ORDER_ATOMIC);
|
|
|
|
|
+ const code = `ai_service.control_top_lamp(${isOn || 'False'})`;
|
|
|
return code;
|
|
return code;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- // 设置台灯亮度
|
|
|
|
|
- pythonGenerator.forBlock['ai_lamp_set_brightness'] = function(block, generator) {
|
|
|
|
|
- const brightness = generator.valueToCode(block, 'BRIGHTNESS', pythonGenerator.ORDER_ATOMIC);
|
|
|
|
|
- const code = `ai_service.set_lamp_brightness(${brightness || '0'})\n`;
|
|
|
|
|
|
|
+ // 打开顶灯
|
|
|
|
|
+ pythonGenerator.forBlock['ai_top_lamp_open'] = function(block, generator) {
|
|
|
|
|
+ const code = `ai_service.open_top_lamp()\n`;
|
|
|
return code;
|
|
return code;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- // 设置台灯颜色
|
|
|
|
|
- pythonGenerator.forBlock['ai_lamp_set_color'] = function(block, generator) {
|
|
|
|
|
- const color = generator.valueToCode(block, 'COLOR', pythonGenerator.ORDER_ATOMIC);
|
|
|
|
|
- const code = `ai_service.set_lamp_color(${color || "'白'"})\n`;
|
|
|
|
|
|
|
+ // 关闭顶灯
|
|
|
|
|
+ pythonGenerator.forBlock['ai_top_lamp_close'] = function(block, generator) {
|
|
|
|
|
+ const code = `ai_service.close_top_lamp()\n`;
|
|
|
return code;
|
|
return code;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- // 音乐播放
|
|
|
|
|
- pythonGenerator.forBlock['ai_music_play'] = function(block, generator) {
|
|
|
|
|
- const musicType = block.getFieldValue('MUSIC_TYPE');
|
|
|
|
|
- const code = `ai_service.play_music('${musicType}')\n`;
|
|
|
|
|
|
|
+ // 控制电视状态
|
|
|
|
|
+ pythonGenerator.forBlock['ai_control_tv'] = function(block, generator) {
|
|
|
|
|
+ const isOn = generator.valueToCode(block, 'IS_ON', pythonGenerator.ORDER_ATOMIC);
|
|
|
|
|
+ const code = `ai_service.control_tv(${isOn || 'False'})
|
|
|
|
|
+`;
|
|
|
return code;
|
|
return code;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -1563,6 +1544,13 @@ function registerPythonGenerators() {
|
|
|
return code;
|
|
return code;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ // 控制窗帘状态
|
|
|
|
|
+ pythonGenerator.forBlock['ai_control_curtain'] = function(block, generator) {
|
|
|
|
|
+ const isOn = generator.valueToCode(block, 'IS_ON', pythonGenerator.ORDER_ATOMIC);
|
|
|
|
|
+ const code = `ai_service.control_curtain(${isOn || 'False'})`;
|
|
|
|
|
+ return code;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
// 打开窗帘
|
|
// 打开窗帘
|
|
|
pythonGenerator.forBlock['ai_curtain_open'] = function(block, generator) {
|
|
pythonGenerator.forBlock['ai_curtain_open'] = function(block, generator) {
|
|
|
const code = `ai_service.open_curtain()\n`;
|
|
const code = `ai_service.open_curtain()\n`;
|
|
@@ -1574,6 +1562,24 @@ function registerPythonGenerators() {
|
|
|
const code = `ai_service.close_curtain()\n`;
|
|
const code = `ai_service.close_curtain()\n`;
|
|
|
return code;
|
|
return code;
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
|
|
+ // 智能音箱多参数控制
|
|
|
|
|
+ pythonGenerator.forBlock['ai_smart_speaker_multi_param'] = function(block, generator) {
|
|
|
|
|
+ const lightStatus = generator.valueToCode(block, 'LIGHT_STATUS', pythonGenerator.ORDER_ATOMIC);
|
|
|
|
|
+ const curtainStatus = generator.valueToCode(block, 'CURTAIN_STATUS', pythonGenerator.ORDER_ATOMIC);
|
|
|
|
|
+ const tvStatus = generator.valueToCode(block, 'TV_STATUS', pythonGenerator.ORDER_ATOMIC);
|
|
|
|
|
+
|
|
|
|
|
+ const code = `ai_service.control_smart_speaker(${lightStatus || 'False'}, ${curtainStatus || 'False'}, ${tvStatus || 'False'})\n`;
|
|
|
|
|
+ return code;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 智能音箱单参数控制
|
|
|
|
|
+ pythonGenerator.forBlock['ai_smart_speaker_single_param'] = function(block, generator) {
|
|
|
|
|
+ const commands = generator.valueToCode(block, 'COMMANDS', pythonGenerator.ORDER_ATOMIC);
|
|
|
|
|
+
|
|
|
|
|
+ const code = `ai_service.process_smart_speaker_commands(${commands})\n`;
|
|
|
|
|
+ return code;
|
|
|
|
|
+ };
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 从JSON加载工作区
|
|
// 从JSON加载工作区
|