清泛IT社区App Inventor 2 中文社区

搜索

扫码访问移动社区 移动社区,您的掌上技术专家

关注我,精彩不错过! 关注我,精彩不错过!

扫码安装最新版AI伴侣 最新版AI伴侣v2.76

Aia StoreApp上架指南 .aia 源码一站式解决方案 发布日志AI2连接测试ai2Starter模拟器

AppInventor2离线版中文教育版接入DeepSeek VIP会员 享专有教程,免费赠送基础版*技术支持服务! AI2入门必读中文文档AI2拓展IoT专题

打印 上一主题 下一主题

[解决中] AI助手重构版问题记录

  • TA的每日心情
    开心
    13 小时前
  • 签到天数: 762 天

    [LV.10]以坛为家III

    1077

    主题

    1801

    帖子

    5万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    51211

    AI2中文网VIP弹球达人接水果达人撸猫达人

    11#
    发表于 2026-03-06 22:34:25 | 只看该作者
    ❌ 失败 1 项:
    • 嵌套块验证失败:组件 BluetoothLE1(BluetoothLE) 没有方法 "WriteString",已拒绝添加

    [{"action": "ADD_BLOCK_INTENT","intent":[{"var": "deviceList","init":{"list":[]}},{"var": "selectedDevice","init": ""},{"var": "connectedDevice","init": ""},{"event": "ScanButton.Click","do":[{"set_prop": "StatusLabel.Text","value": "状态:正在扫描设备..."},{"set_prop": "DeviceList.Elements","value":{"list":["扫描中..."]}},{"call": "BluetoothLE1.StartScanning","args":{}}]},{"event": "StopScanButton.Click","do":[{"call": "BluetoothLE1.StopScanning","args":{}},{"set_prop": "StatusLabel.Text","value": "状态:扫描已停止"}]},{"event": "BluetoothLE1.DeviceFound","do":[{"list_add":{"list":{"get_var": "deviceList"},"item":{"join":[{"get_var": "name"}," (",{"get_var": "address"},")"]}}},{"set_prop": "DeviceList.Elements","value":{"get_var": "deviceList"}},{"set_prop": "StatusLabel.Text","value":{"join":["状态:发现设备 ",{"get_var": "name"}]}}]},{"event": "DeviceList.AfterPicking","do":[{"set_var": "selectedDevice","value":{"select_item":{"list":{"get_prop": "DeviceList.Elements"},"index":{"get_prop": "DeviceList.SelectionIndex"}}}},{"set_prop": "StatusLabel.Text","value":{"join":["状态:已选择 ",{"get_var": "selectedDevice"}]}},{"set_prop": "ConnectButton.Enabled","value":true}]},{"event": "ConnectButton.Click","do":[{"call": "BluetoothLE1.Connect","args":{"address":{"text_split":{"text":{"get_var": "selectedDevice"},"at": "("}}}},{"set_prop": "StatusLabel.Text","value": "状态:正在连接..."}]},{"event": "BluetoothLE1.Connected","do":[{"set_var": "connectedDevice","value":{"get_var": "selectedDevice"}},{"set_prop": "ConnectedDeviceLabel.Text","value":{"join":["已连接设备:",{"get_var": "connectedDevice"}]}},{"set_prop": "DisconnectButton.Enabled","value":true},{"set_prop": "SendButton.Enabled","value":true},{"set_prop": "ConnectButton.Enabled","value":false},{"set_prop": "StatusLabel.Text","value": "状态:连接成功"}]},{"event": "DisconnectButton.Click","do":[{"call": "BluetoothLE1.Disconnect","args":{}},{"set_var": "connectedDevice","value": ""},{"set_prop": "ConnectedDeviceLabel.Text","value": "已连接设备:无"},{"set_prop": "DisconnectButton.Enabled","value":false},{"set_prop": "SendButton.Enabled","value":false},{"set_prop": "ConnectButton.Enabled","value":true},{"set_prop": "StatusLabel.Text","value": "状态:已断开连接"}]},{"event": "SendButton.Click","do":[{"call": "BluetoothLE1.WriteString","args":{"service": "0000ffe0-0000-1000-8000-00805f9b34fb","characteristic": "0000ffe1-0000-1000-8000-00805f9b34fb","text":{"get_prop": "DataInput.Text"}}},{"set_prop": "StatusLabel.Text","value": "状态:数据已发送"}]},{"event": "BluetoothLE1.StringReceived","do":[{"set_prop": "DataDisplay.Text","value":{"join":[{"get_prop": "DataDisplay.Text"},"\n",{"get_var": "text"}]}},{"set_prop": "StatusLabel.Text","value": "状态:收到数据"}]},{"event": "BluetoothLE1.ErrorOccurred","do":[{"call": "Notifier1.ShowAlert","args":{"message":{"join":["BLE错误:",{"get_var": "message"}]}}},{"set_prop": "StatusLabel.Text","value":{"join":["状态:错误 - ",{"get_var": "message"}]}}]}]},{"action": "CLEANUP_BLOCKS"}]
    App Inventor 2 中文网 - MIT同步更新的中文本土化平台!v2.76 支持Android 15 & iOS 更新日志
  • TA的每日心情
    开心
    13 小时前
  • 签到天数: 762 天

    [LV.10]以坛为家III

    1077

    主题

    1801

    帖子

    5万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    51211

    AI2中文网VIP弹球达人接水果达人撸猫达人

    12#
    发表于 2026-03-06 22:43:32 | 只看该作者
    ❌ 失败 1 项:
    • AI 生成的 JSON 格式有误(可能括号/引号不匹配),请重新发送需求让 AI 重新生成

    [{"action": "ADD_BLOCK_INTENT","intent":[{"function": "计算水仙花数","params":[],"return":{"do_return":{"do":[{"local_var": "result","value":{"list":[]},"do":[{"for_range":{"var": "i","from": 100,"to": 999,"step": 1,"do":[{"local_var": "百位","value":{"divide":[{"get_var": "i"},100]},"do":[]},{"local_var": "十位","value":{"modulo":[{"divide":[{"get_var": "i"},10]},10]},"do":[]},{"local_var": "个位","value":{"modulo":[{"get_var": "i"},10]},"do":[]},{"local_var": "立方和","value":{"add":[{"power":[{"get_var": "百位"},3]},{"power":[{"get_var": "十位"},3]},{"power":[{"get_var": "个位"},3]}]},"do":[]},{"if":{"eq":[{"get_var": "立方和"},{"get_var": "i"}]},"then":[{"list_add":{"list":{"get_var": "result"},"item":{"get_var": "i"}}}]}]}]}],"value":{"get_var": "result"}}}}]},{"action": "CLEANUP_BLOCKS"}]
    App Inventor 2 中文网 - MIT同步更新的中文本土化平台!v2.76 支持Android 15 & iOS 更新日志
  • TA的每日心情
    开心
    13 小时前
  • 签到天数: 762 天

    [LV.10]以坛为家III

    1077

    主题

    1801

    帖子

    5万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    51211

    AI2中文网VIP弹球达人接水果达人撸猫达人

    13#
    发表于 2026-03-06 22:45:18 | 只看该作者
    ❌ 失败 1 项:
    • AI 生成的 JSON 格式有误(可能括号/引号不匹配),请重新发送需求让 AI 重新生成

    [{"action": "ADD_BLOCK_INTENT","intent":[{"event": "SendButton.Click","do":[{"if":{"is_empty":{"get_prop": "MessageInput.Text"}},"then":[{"call": "Notifier1.ShowAlert","args":{"message": "请输入消息内容"}}],"else_do":[{"call_proc": "显示消息气泡","args":{"message":{"get_prop": "MessageInput.Text"},"isMine":true}},{"set_prop": "MessageInput.Text","value": ""}]}]},{"procedure": "显示消息气泡","params":["message","isMine"],"do":[{"local_var": "bubble","value":{"call": "VerticalArrangement1","args":{}},"do":[{"set_prop": "bubble.Width","value": -2},{"set_prop": "bubble.Height","value": -1},{"set_prop": "bubble.AlignHorizontal","value":{"choose":{"test":{"get_var": "isMine"},"then": 3,"else": 1}}},{"local_var": "bubbleContent","value":{"call": "HorizontalArrangement1","args":{}},"do":[{"set_prop": "bubbleContent.Width","value": -1},{"set_prop": "bubbleContent.Height","value": -1},{"set_prop": "bubbleContent.BackgroundColor","value":{"choose":{"test":{"get_var": "isMine"},"then": "&HFF2196F3","else": "&HFFFFFFFF"}}},{"set_prop": "bubbleContent.Shape","value": 1},{"set_prop": "bubbleContent.Margin","value": 5},{"local_var": "messageLabel","value":{"call": "Label1","args":{}},"do":[{"set_prop": "messageLabel.Width","value": -2},{"set_prop": "messageLabel.Height","value": -1},{"set_prop": "messageLabel.Text","value":{"get_var": "message"}},{"set_prop": "messageLabel.TextColor","value":{"choose":{"test":{"get_var": "isMine"},"then": "&HFFFFFFFF","else": "&HFF000000"}}},{"set_prop": "messageLabel.FontSize","value": 16},{"set_prop": "messageLabel.Margin","value": 10}]}]}]}]},{"action": "CLEANUP_BLOCKS"}]]

    执行失败: Expected ',' or '}' after property value in JSON at position 1600 (line 1 column 1601)
    App Inventor 2 中文网 - MIT同步更新的中文本土化平台!v2.76 支持Android 15 & iOS 更新日志
  • TA的每日心情
    开心
    13 小时前
  • 签到天数: 762 天

    [LV.10]以坛为家III

    1077

    主题

    1801

    帖子

    5万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    51211

    AI2中文网VIP弹球达人接水果达人撸猫达人

    14#
    发表于 2026-03-07 12:18:11 | 只看该作者
    ❌ 失败 1 项:
    • 代码块添加失败,工作区已恢复: 块 component_event: Connection checks failed.

    [{"action": "ADD_BLOCK_INTENT","intent":[{"var": "chatHistory","init":{"list":[]}},{"var": "isThinking","init":false},{"event": "SendButton.Click","do":[{"if":{"and":[{"not":{"is_empty":{"get_prop": "InputTextBox.Text"}}},{"not":{"get_var": "global isThinking"}}]},"then":[{"set_var": "global isThinking","value":true},{"set_prop": "SendButton.Text","value": "思考中..."},{"set_prop": "SendButton.BackgroundColor","value": "&HFF9E9E9E"},{"local_var": "userMessage","value":{"get_prop": "InputTextBox.Text"},"do":[{"list_add":{"list":{"get_var": "global chatHistory"},"item":{"dict":[{"dict_pair":{"key": "role","value": "user"}},{"dict_pair":{"key": "content","value":{"get_var": "userMessage"}}}]}}},{"call": "ChatListView.AddItem","args":{"mainText":{"join":["用户: ",{"get_var": "userMessage"}]},"detailText": "","imageName": ""}},{"set_prop": "InputTextBox.Text","value": ""},{"call": "LLMAI2Ext1.Chat","args":{"content":{"get_var": "userMessage"}}}]}],"else_do":[{"if":{"get_var": "global isThinking"},"then":[{"call": "Notifier1.ShowAlert","args":{"notice": "正在思考中,请稍候..."}}],"else_do":[{"call": "Notifier1.ShowAlert","args":{"notice": "请输入问题内容"}}]}]}]},{"event": "LLMAI2Ext1.GotText","do":[{"call": "ChatListView.AddItem","args":{"mainText":{"join":["AI: ",{"text": "text"}]},"detailText": "","imageName": ""}},{"set_var": "global isThinking","value":false},{"set_prop": "SendButton.Text","value": "发送"},{"set_prop": "SendButton.BackgroundColor","value": "&HFF4CAF50"}]},{"event": "Screen6.ErrorOccurred","do":[{"call": "Notifier1.ShowAlert","args":{"notice":{"join":["请求失败: ",{"get_var": "message"}]}}},{"set_var": "global isThinking","value":false},{"set_prop": "SendButton.Text","value": "发送"},{"set_prop": "SendButton.BackgroundColor","value": "&HFF4CAF50"}]},{"event": "ClearButton.Click","do":[{"call": "ChatListView.AddItems","args":{"itemsList":{"list":[]}}},{"set_var": "global chatHistory","value":{"list":[]}},{"call": "Notifier1.ShowAlert","args":{"notice": "聊天记录已清空"}}]},{"event": "InputTextBox.GotFocus","do":[{"call": "InputTextBox.HideKeyboard"}]},{"event": "Screen6.Initialize","do":[{"call": "Notifier1.ShowAlert","args":{"notice": "请先设置DeepSeek API密钥\n在组件属性中配置APIKey"}}]}]},{"action": "CLEANUP_BLOCKS"}]
    App Inventor 2 中文网 - MIT同步更新的中文本土化平台!v2.76 支持Android 15 & iOS 更新日志
  • TA的每日心情
    开心
    13 小时前
  • 签到天数: 762 天

    [LV.10]以坛为家III

    1077

    主题

    1801

    帖子

    5万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    51211

    AI2中文网VIP弹球达人接水果达人撸猫达人

    15#
    发表于 2026-03-07 14:25:07 | 只看该作者
    设置屏幕属性 没了? 设置了没效果,设置到component了,且把项目破坏了
    设置组件属性 要测试
    指令中空格又出现了?
    App Inventor 2 中文网 - MIT同步更新的中文本土化平台!v2.76 支持Android 15 & iOS 更新日志
  • TA的每日心情
    开心
    13 小时前
  • 签到天数: 762 天

    [LV.10]以坛为家III

    1077

    主题

    1801

    帖子

    5万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    51211

    AI2中文网VIP弹球达人接水果达人撸猫达人

    16#
    发表于 2026-03-07 20:51:25 | 只看该作者
    代码块添加失败,工作区已恢复: 块 component_event: Connection checks failed.

    [{"action": "ADD_BLOCK_INTENT","intent":[{"event": "DrawingCanvas.Dragged","do":[{"call": "DrawingCanvas.DrawLine","args":{"x1":{"get_var": "prevX"},"y1":{"get_var": "prevY"},"x2":{"get_var": "currentX"},"y2":{"get_var": "currentY"}}}]},{"event": "ClearButton.Click","do":[{"call": "DrawingCanvas.Clear","args":{}}]},{"event": "BlackButton.Click","do":[{"set_prop": "DrawingCanvas.PaintColor","value": "&HFF000000"}]},{"event": "RedButton.Click","do":[{"set_prop": "DrawingCanvas.PaintColor","value": "&HFFFF0000"}]},{"event": "BlueButton.Click","do":[{"set_prop": "DrawingCanvas.PaintColor","value": "&HFF0000FF"}]},{"event": "GreenButton.Click","do":[{"set_prop": "DrawingCanvas.PaintColor","value": "&HFF00FF00"}]},{"event": "EraserButton.Click","do":[{"set_prop": "DrawingCanvas.PaintColor","value": "&HFFFFFFFF"}]}]},{"action": "CLEANUP_BLOCKS"}]
    App Inventor 2 中文网 - MIT同步更新的中文本土化平台!v2.76 支持Android 15 & iOS 更新日志
  • TA的每日心情
    开心
    13 小时前
  • 签到天数: 762 天

    [LV.10]以坛为家III

    1077

    主题

    1801

    帖子

    5万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    51211

    AI2中文网VIP弹球达人接水果达人撸猫达人

    17#
    发表于 2026-03-07 21:09:56 | 只看该作者
    ❌ 失败 1 项:
    • 代码块添加失败,工作区已恢复: 块 component_event: Assertion failed: Next statement does not exist.

    [
      {"action": "ADD_BLOCK_INTENT","intent":[
        {"var": "客厅灯状态","init":false},
        {"var": "卧室灯状态","init":false},
        {"var": "走廊灯状态","init":false},
        {"var": "室内温度","init": 25},
        {"var": "室内湿度","init": 60},
        {"var": "安防状态","init": "已关闭"},
       
        {"event": "Screen6.Initialize","do":[
          {"call": "HomeClock.Now","args":{}},
          {"set_prop": "TimeLabel.Text","value":{"join":["时间:",{"call": "HomeClock.FormatTime","args":{"instant":{"call": "HomeClock.Now","args":{}}}}]}},
          {"set_prop": "DateLabel.Text","value":{"join":["日期:",{"call": "HomeClock.FormatDate","args":{"instant":{"call": "HomeClock.Now","args":{}},"pattern": "yyyy-MM-dd"}}]}}
        ]},
       
        {"event": "HomeClock.Timer","do":[
          {"set_prop": "TimeLabel.Text","value":{"join":["时间:",{"call": "HomeClock.FormatTime","args":{"instant":{"call": "HomeClock.Now","args":{}}}}]}}
        ]},
       
        {"event": "Light1Switch.Changed","do":[
          {"set_var": "global 客厅灯状态","value":{"get_prop": "Light1Switch.On"}},
          {"set_prop": "Light1Label.Text","value":{"choose":{"test":{"get_var": "global 客厅灯状态"},"then": "客厅主灯:开","else": "客厅主灯:关"}}}
        ]},
       
        {"event": "Light2Switch.Changed","do":[
          {"set_var": "global 卧室灯状态","value":{"get_prop": "Light2Switch.On"}},
          {"set_prop": "Light2Label.Text","value":{"choose":{"test":{"get_var": "global 卧室灯状态"},"then": "卧室灯:开","else": "卧室灯:关"}}}
        ]},
       
        {"event": "Light3Switch.Changed","do":[
          {"set_var": "global 走廊灯状态","value":{"get_prop": "Light3Switch.On"}},
          {"set_prop": "Light3Label.Text","value":{"choose":{"test":{"get_var": "global 走廊灯状态"},"then": "走廊灯:开","else": "走廊灯:关"}}}
        ]},
       
        {"event": "RefreshButton.Click","do":[
          {"set_prop": "TempValueLabel.Text","value":{"join":[{"get_var": "global 室内温度"},"°C"]}},
          {"set_prop": "HumidityValueLabel.Text","value":{"join":[{"get_var": "global 室内湿度"},"%"]}},
          {"set_prop": "SecurityStatusLabel.Text","value":{"get_var": "global 安防状态"}},
          {"set_prop": "SecurityStatusLabel.TextColor","value":{"choose":{"test":{"eq":[{"get_var": "global 安防状态"},"已关闭"]},"then": "&HFF4CAF50","else": "&HFFF44336"}}},
          {"call": "HomeClock.Now","args":{}},
          {"set_prop": "DateLabel.Text","value":{"join":["日期:",{"call": "HomeClock.FormatDate","args":{"instant":{"call": "HomeClock.Now","args":{}},"pattern": "yyyy-MM-dd"}}]}}
        ]},
       
        {"event": "AllLightsOnButton.Click","do":[
          {"set_prop": "Light1Switch.On","value":true},
          {"set_prop": "Light2Switch.On","value":true},
          {"set_prop": "Light3Switch.On","value":true},
          {"set_var": "global 客厅灯状态","value":true},
          {"set_var": "global 卧室灯状态","value":true},
          {"set_var": "global 走廊灯状态","value":true},
          {"set_prop": "Light1Label.Text","value": "客厅主灯:开"},
          {"set_prop": "Light2Label.Text","value": "卧室灯:开"},
          {"set_prop": "Light3Label.Text","value": "走廊灯:开"}
        ]},
       
        {"event": "AllLightsOffButton.Click","do":[
          {"set_prop": "Light1Switch.On","value":false},
          {"set_prop": "Light2Switch.On","value":false},
          {"set_prop": "Light3Switch.On","value":false},
          {"set_var": "global 客厅灯状态","value":false},
          {"set_var": "global 卧室灯状态","value":false},
          {"set_var": "global 走廊灯状态","value":false},
          {"set_prop": "Light1Label.Text","value": "客厅主灯:关"},
          {"set_prop": "Light2Label.Text","value": "卧室灯:关"},
          {"set_prop": "Light3Label.Text","value": "走廊灯:关"}
        ]}
      ]},
      {"action": "CLEANUP_BLOCKS"}
    ]
    App Inventor 2 中文网 - MIT同步更新的中文本土化平台!v2.76 支持Android 15 & iOS 更新日志
  • TA的每日心情
    开心
    13 小时前
  • 签到天数: 762 天

    [LV.10]以坛为家III

    1077

    主题

    1801

    帖子

    5万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    51211

    AI2中文网VIP弹球达人接水果达人撸猫达人

    18#
    发表于 2026-03-07 21:38:53 | 只看该作者
    ❌ 失败 1 项:
    • 代码块添加失败,工作区已恢复: 块 component_event: Connection checks failed.

    [{"action": "ADD_BLOCK_INTENT","intent":[{"var": "temperatureData","init":{"list":[{"list":["08: 00",22]},{"list":["10: 00",23]},{"list":["12: 00",24]},{"list":["14: 00",25]},{"list":["16: 00",24]},{"list":["18: 00",23]},{"list":["20: 00",22]}]}},{"var": "currentTemp","init": 22},{"event": "Screen8.Initialize","do":[{"call": "TemperatureChart.Init","args":{"layout": "{\"title\":{\"text\":\"温度变化曲线\"},\"tooltip\":{},\"xAxis\":{\"type\":\"category\"},\"yAxis\":{\"type\":\"value\"},\"series\":[{\"name\":\"温度\",\"type\":\"line\",\"data\":[]}]}"}},{"call_proc": "UpdateTemperatureChart"}]},{"procedure": "UpdateTemperatureChart","do":[{"set_var": "global labels","value":{"list":[]}},{"set_var": "global temps","value":{"list":[]}},{"foreach":{"var": "item","in":{"get_var": "global temperatureData"},"do":[{"list_add":{"list":{"get_var": "global labels"},"item":{"select_item":{"list":{"get_var": "item"},"index": 0}}}},{"list_add":{"list":{"get_var": "global temps"},"item":{"select_item":{"list":{"get_var": "item"},"index": 1}}}}]}},{"call": "TemperatureChart.Line","args":{"title": "室内温度","legends": "温度","labels":{"get_var": "global labels"},"datas":{"get_var": "global temps"},"smooth":true}}]},{"event": "LightSwitch1.Changed","do":[{"if":{"get_prop": "LightSwitch1.On"},"then":[{"call": "MainNotifier.ShowAlert","args":{"notice": "客厅主灯已打开"}}],"else_do":[{"call": "MainNotifier.ShowAlert","args":{"notice": "客厅主灯已关闭"}}]}]},{"event": "ACSwitch.Changed","do":[{"if":{"get_prop": "ACSwitch.On"},"then":[{"call": "MainNotifier.ShowAlert","args":{"notice": "卧室空调已开启"}}],"else_do":[{"call": "MainNotifier.ShowAlert","args":{"notice": "卧室空调已关闭"}}]}]},{"event": "MainClock.Timer","do":[{"set_var": "global currentTemp","value":{"add":[{"get_var": "global currentTemp"},{"choose":{"test":{"eq":[{"random_int":{"from": 0,"to": 1}},0]},"then": 0.1,"else": -0.1}}]}},{"list_add":{"list":{"get_var": "global temperatureData"},"item":{"list":[{"call": "MainClock.FormatTime","args":{"instant":{"call": "MainClock.Now"}}},{"get_var": "global currentTemp"}]}}},{"if":{"gt":[{"list_length":{"get_var": "global temperatureData"}},10]},"then":[{"list_remove":{"list":{"get_var": "global temperatureData"},"index": 0}}]},{"call_proc": "UpdateTemperatureChart"}]},{"event": "HomeBtn.Click","do":[{"call": "MainNotifier.ShowMessageDialog","args":{"message": "您已在主页","title": "提示","buttonText": "确定"}}]},{"event": "DevicesBtn.Click","do":[{"call": "MainNotifier.ShowMessageDialog","args":{"message": "设备管理功能开发中","title": "提示","buttonText": "确定"}}]},{"event": "SettingsBtn.Click","do":[{"call": "MainNotifier.ShowMessageDialog","args":{"message": "设置功能开发中","title": "提示","buttonText": "确定"}}]}]},{"action": "CLEANUP_BLOCKS"}]
    App Inventor 2 中文网 - MIT同步更新的中文本土化平台!v2.76 支持Android 15 & iOS 更新日志
  • TA的每日心情
    开心
    13 小时前
  • 签到天数: 762 天

    [LV.10]以坛为家III

    1077

    主题

    1801

    帖子

    5万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    51211

    AI2中文网VIP弹球达人接水果达人撸猫达人

    19#
    发表于 2026-03-07 22:14:42 | 只看该作者
    ❌ 失败 1 项:
    • AI 生成的 JSON 格式有误(可能括号/引号不匹配),请重新发送需求让 AI 重新生成

    [{"action": "ADD_BLOCK_INTENT","intent":[{"var": "currentInput","init": "0"},{"var": "previousInput","init": ""},{"var": "currentOperator","init": ""},{"var": "waitingForNewInput","init":false},{"event": "Btn0.Click","do":[{"call": "AppendNumber","args":{"num": "0"}}]},{"event": "Btn1.Click","do":[{"call": "AppendNumber","args":{"num": "1"}}]},{"event": "Btn2.Click","do":[{"call": "AppendNumber","args":{"num": "2"}}]},{"event": "Btn3.Click","do":[{"call": "AppendNumber","args":{"num": "3"}}]},{"event": "Btn4.Click","do":[{"call": "AppendNumber","args":{"num": "4"}}]},{"event": "Btn5.Click","do":[{"call": "AppendNumber","args":{"num": "5"}}]},{"event": "Btn6.Click","do":[{"call": "AppendNumber","args":{"num": "6"}}]},{"event": "Btn7.Click","do":[{"call": "AppendNumber","args":{"num": "7"}}]},{"event": "Btn8.Click","do":[{"call": "AppendNumber","args":{"num": "8"}}]},{"event": "Btn9.Click","do":[{"call": "AppendNumber","args":{"num": "9"}}]},{"event": "BtnDecimal.Click","do":[{"if":{"not":{"text_contains":{"text":{"get_var": "global currentInput"},"piece": "."}}},"then":[{"if":{"eq":[{"get_var": "global waitingForNewInput"},true]},"then":[{"set_var": "global currentInput","value": "0."},{"set_var": "global waitingForNewInput","value":false}],"else_do":[{"set_var": "global currentInput","value":{"join":[{"get_var": "global currentInput"},"."]}}]},{"set_prop": "DisplayLabel.Text","value":{"get_var": "global currentInput"}}]}]},{"event": "BtnAdd.Click","do":[{"call": "SetOperator","args":{"op": "+"}}]},{"event": "BtnSubtract.Click","do":[{"call": "SetOperator","args":{"op": "-"}}]},{"event": "BtnMultiply.Click","do":[{"call": "SetOperator","args":{"op": "×"}}]},{"event": "BtnDivide.Click","do":[{"call": "SetOperator","args":{"op": "÷"}}]},{"event": "BtnEquals.Click","do":[{"call": "CalculateResult","args":{}}]},{"event": "BtnClear.Click","do":[{"set_var": "global currentInput","value": "0"},{"set_var": "global previousInput","value": ""},{"set_var": "global currentOperator","value": ""},{"set_var": "global waitingForNewInput","value":false},{"set_prop": "DisplayLabel.Text","value": "0"}]},{"event": "BtnBackspace.Click","do":[{"if":{"and":[{"neq":[{"get_var": "global currentInput"},"0"]},{"gt":[{"text_length":{"get_var": "global currentInput"}},1]}]},"then":[{"set_var": "global currentInput","value":{"text_segment":{"text":{"get_var": "global currentInput"},"start": 1,"length":{"subtract":[{"text_length":{"get_var": "global currentInput"}},1]}}}},{"set_prop": "DisplayLabel.Text","value":{"get_var": "global currentInput"}}],"else_do":[{"set_var": "global currentInput","value": "0"},{"set_prop": "DisplayLabel.Text","value": "0"}]}]},{"procedure": "AppendNumber","params":["num"],"do":[{"if":{"eq":[{"get_var": "global waitingForNewInput"},true]},"then":[{"set_var": "global currentInput","value":{"get": "num"}},{"set_var": "global waitingForNewInput","value":false}],"else_do":[{"if":{"eq":[{"get_var": "global currentInput"},"0"]},"then":[{"set_var": "global currentInput","value":{"get": "num"}}],"else_do":[{"set_var": "global currentInput","value":{"join":[{"get_var": "global currentInput"},{"get": "num"}]}}]}]},{"set_prop": "DisplayLabel.Text","value":{"get_var": "global currentInput"}}]},{"procedure": "SetOperator","params":["op"],"do":[{"if":{"and":[{"neq":[{"get_var": "global previousInput"},""]},{"neq":[{"get_var": "global currentOperator"},""]}]},"then":[{"call": "CalculateResult","args":{}}]},{"set_var": "global previousInput","value":{"get_var": "global currentInput"}},{"set_var": "global currentOperator","value":{"get": "op"}},{"set_var": "global waitingForNewInput","value":true}]},{"procedure": "CalculateResult","do":[{"if":{"and":[{"neq":[{"get_var": "global previousInput"},""]},{"neq":[{"get_var": "global currentOperator"},""]}]},"then":[{"local_var": "result","value": 0,"do":[{"if":{"eq":[{"get_var": "global currentOperator"},"+"]},"then":[{"set_var": "local result","value":{"add":[{"get_var": "global previousInput"},{"get_var": "global currentInput"}]}}]},{"if":{"eq":[{"get_var": "global currentOperator"},"-"]},"then":[{"set_var": "local result","value":{"subtract":[{"get_var": "global previousInput"},{"get_var": "global currentInput"}]}}]},{"if":{"eq":[{"get_var": "global currentOperator"},"×"]},"then":[{"set_var": "local result","value":{"multiply":[{"get_var": "global previousInput"},{"get_var": "global currentInput"}]}}]},{"if":{"eq":[{"get_var": "global currentOperator"},"÷"]},"then":[{"if":{"eq":[{"get_var": "global currentInput"},0]},"then":[{"set_var": "local result","value": "错误:除零"}],"else_do":[{"set_var": "local result","value":{"divide":[{"get_var": "global previousInput"},{"get_var": "global currentInput"}]}}]}]},{"set_var": "global currentInput","value":{"get_var": "local result"}},{"set_prop": "DisplayLabel.Text","value":{"get_var": "local result"}},{"set_var": "global previousInput","value": ""},{"set_var": "global currentOperator","value": ""},{"set_var": "global waitingForNewInput","value":true}]}]}]},{"action": "CLEANUP_BLOCKS"}]
    App Inventor 2 中文网 - MIT同步更新的中文本土化平台!v2.76 支持Android 15 & iOS 更新日志
  • TA的每日心情
    开心
    13 小时前
  • 签到天数: 762 天

    [LV.10]以坛为家III

    1077

    主题

    1801

    帖子

    5万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    51211

    AI2中文网VIP弹球达人接水果达人撸猫达人

    20#
    发表于 2026-03-07 22:24:18 | 只看该作者
    AI伴侣出现错误: The operation TextAlignment cannot accept the arguments: , ["Right"]
    AI伴侣出现错误: The operation AlignHorizontal cannot accept the arguments: , ["Center"]

    我检查了组件元数据,发现Label组件没有TextAlignment属性。我需要移除这个属性设置,只设置其他属性。
    AI助手生成的代码,设置不存在的属性,一定要禁止这种,否则可能破坏项目                    
       我检查了组件元数据,发现Label组件没有TextAlignment属性  属性设置前要探测好


    App Inventor 2 中文网 - MIT同步更新的中文本土化平台!v2.76 支持Android 15 & iOS 更新日志
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    © 2026 tsingfun.com, Inc.  沪ICP备2020034476号-1  沪公网安备31011702000040号

    GMT+8, 2026-03-27 20:16 , Processed in 0.021496 second(s), 37 queries .