|
|
@@ -454,7 +454,7 @@ const state = reactive({
|
|
|
|
|
|
// 台灯状态
|
|
|
lamp: {
|
|
|
- isLightOn: false,// 台灯是否亮着
|
|
|
+ isLightOn: true,// 台灯是否亮着
|
|
|
brightness: 50, // 默认亮度50%
|
|
|
color: "#ffffff", // 默认颜色白色
|
|
|
colorLog: "白", // 默认颜色白色
|
|
|
@@ -899,13 +899,13 @@ const aiService = {
|
|
|
// 综合控制台灯(参数格式:"颜色, 亮度, 音乐")
|
|
|
controlLampWithSingleParam: withErrorHandling('智能台灯综合控制', async function(params) {
|
|
|
// 解析参数字符串
|
|
|
- let color = '白'; // 默认颜色
|
|
|
+ let color = ''; // 默认颜色
|
|
|
let brightness = 0; // 默认亮度
|
|
|
let music = ''; // 音乐信息
|
|
|
|
|
|
if (params && typeof params === 'string') {
|
|
|
// 根据逗号分割参数
|
|
|
- const paramArray = params.split(',').map(p => p.trim());
|
|
|
+ const paramArray = params.split(',').map(p => p.trim());
|
|
|
|
|
|
// 提取颜色(第一个参数)
|
|
|
if (paramArray.length > 0 && paramArray[0]) {
|
|
|
@@ -921,8 +921,10 @@ const aiService = {
|
|
|
if (paramArray.length > 2 && paramArray[2]) {
|
|
|
music = paramArray[2];
|
|
|
|
|
|
- // 调用音乐播放函数
|
|
|
- await this.playMusic(music);
|
|
|
+ if (music !== '不播放') {
|
|
|
+ // 调用音乐播放函数
|
|
|
+ await this.playMusic(music);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
// 调用控制台灯方法
|
|
|
@@ -931,11 +933,16 @@ const aiService = {
|
|
|
|
|
|
// 综合控制台灯(参数格式:"颜色, 亮度")
|
|
|
controlLamp: withErrorHandling('智能台灯控制', async function(brightness, color) {
|
|
|
+
|
|
|
// 先设置亮度
|
|
|
- await this.setLampBrightness(brightness);
|
|
|
+ if (brightness !== "-1") {
|
|
|
+ await this.setLampBrightness(brightness);
|
|
|
+ }
|
|
|
|
|
|
// 再设置颜色
|
|
|
- await this.setLampColor(color);
|
|
|
+ if (color !== '不处理') {
|
|
|
+ await this.setLampColor(color);
|
|
|
+ }
|
|
|
|
|
|
return { brightness: state.lamp.brightness, color: state.lamp.color };
|
|
|
}, '智能台灯控制失败'),
|