Skip to content

feat(ai-ui): add guided WeChat UI - #711

Merged
yingtao450 merged 4 commits into
tuya:masterfrom
jianning773:feature/guided-wechat-ui
Sep 18, 2026
Merged

yingtao450 merged 4 commits into
tuya:masterfrom
jianning773:feature/guided-wechat-ui

Conversation

@jianning773

Copy link
Copy Markdown
Contributor

Overview

This PR adds an SDK-native Guided WeChat UI for the your_chat_bot application on T5AI touch-screen boards.

The new UI combines the existing WeChat-style chat experience with a guided first-run flow for language selection, device authorization, and network configuration.

New Features

Guided onboarding flow

  • Add a three-step onboarding flow:
    1. Language
    2. Authorization
    3. Network connection
  • Support switching between Chinese and English.
  • Display localized status messages and chat mode names.
  • Show the correct state when the device is not authorized.
  • Display “Waiting for device authorization” instead of “Waiting for phone network configuration” when authorization is missing.
  • Add refresh and retry actions for authorization and network states.
  • Add device settings, language selection, about, and reset/re-provision pages.

Authorization status and device information

  • Read and display the device authorization state.
  • Support authorization information from:
    • SDK authorization storage
    • Compiled Tuya client configuration as fallback
  • Mask UUID and AuthKey values before displaying them.
  • Display device ID, product ID, firmware version, SDK version, current network, activation state, and cloud connection state.
  • Track the pairing lifecycle through:
    • TUYA_EVENT_BIND_START
    • TUYA_EVENT_BIND_TOKEN_ON
    • TUYA_EVENT_MQTT_CONNECTED
    • TUYA_EVENT_RESET

Localized QR-code guidance

  • Add LVGL QR-code support.
  • Show an authorization help QR code when the device is unauthorized:
    • English: https://tuyaopen.ai/pricing
    • Chinese: https://tuyaopen.ai/zh/pricing
  • Show localized network-configuration help QR codes on the network page.

WeChat-style chat UI

  • Add a complete Guided WeChat chat page.
  • Add localized status-bar text for standby, listening, speaking, and uploading states.
  • Add localized chat-mode names:
    • Hold to talk
    • Push to talk
    • Wake word
    • Free talk
  • Add language refresh support so the current UI state is re-rendered after changing language.
  • Unify the bottom-left and bottom-right action button shadow and pressed-state behavior.

Camera and image functions

When the corresponding camera/image components are enabled, the new UI supports:

  • Opening the camera from the chat page.
  • Live camera preview.
  • Taking photos.
  • Camera thumbnail preview.
  • AI vision enable/disable control.
  • Opening the image album.
  • Browsing images with previous/next gestures.
  • Viewing a single image.
  • Selecting images for chat attachments.
  • Batch image selection and deletion.
  • Image deletion.
  • Optional printer actions when printer support is enabled.
  • Image attachment list management.

SDK and configuration changes

  • Add the new guided_wechat UI module.
  • Add Guided WeChat UI registration to ai_chat_ui.c.
  • Keep the existing WeChat, Chatbot, and OLED UI options available.
  • Add CONFIG_ENABLE_AI_CHAT_GUI_GUIDED_WECHAT.
  • Add CONFIG_LV_USE_QRCODE.
  • Add the Guided UI configuration to the following T5AI touch-screen profiles:
    • TUYA_T5AI_BOARD_LCD_3.5.config
    • TUYA_T5AI_BOARD_LCD_3.5_CAMERA.config
    • TUYA_T5AI_BOARD_LCD_3.5_CAM_PRINTER.config
    • TUYA_T5AI_BOARD_LCD_3.5_WITH_L511.config
    • TUYA_T5AI_BOARD_LCD_3.5_v101.config
  • Keep app_default.config unchanged.

Expected Impact

  • The Guided WeChat UI is enabled only when
    CONFIG_ENABLE_AI_CHAT_GUI_GUIDED_WECHAT=y is selected.
  • The change is primarily scoped to the your_chat_bot application and T5AI touch-screen board profiles.
  • Existing WeChat, Chatbot, and OLED UI configurations remain available.
  • Existing applications that do not select the new configuration should not enter the Guided UI code path.
  • Camera and album code remain conditionally compiled based on the existing camera, picture, album, and printer configuration options.
  • Guided UI builds will increase firmware size and resource usage because they include additional onboarding, QR-code, camera, and album pages.
  • The T5AI target build completed successfully with the new configuration enabled.

Validation

  • Ran a full clean with tos.py clean -f.
  • Regenerated using.cmake, tuya_kconfig.h, and related build files.
  • Confirmed the generated configuration enables:
    • ENABLE_AI_CHAT_GUI_GUIDED_WECHAT
    • ENABLE_COMP_AI_VIDEO
    • ENABLE_COMP_AI_PICTURE
    • ENABLE_IMAGE_ALBUM
    • LV_USE_QRCODE
  • Rebuilt the T5AI CP/AP firmware successfully.
  • Flashed the resulting firmware to T5AI hardware.
  • Confirmed the device rebooted and the your_chat_bot application started normally.

jianning773 and others added 4 commits September 17, 2026 15:09
The app layer called guided_wechat_pairing_*() directly behind
ENABLE_AI_CHAT_GUI_GUIDED_WECHAT guards, coupling your_chat_bot to one
specific GUI variant. Add AI_UI_DISP_NETCFG_BEGIN / _TOKEN_RECEIVED /
_COMPLETE / _RESET display commands and translate them inside the
guided WeChat UI via its disp_other_msg handler, so the application
stays GUI-agnostic: any UI variant can implement (or ignore) the
pairing notifications without app-level #if churn.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Mirror the v9 Kconfig plumbing into liblvgl v8: the shared LV_USE_QRCODE
option now defaults to y when LVGL_VERSION_8 is selected (preserving the
previous hardcoded "#define LV_USE_QRCODE 1" behavior for existing v8
users) and n otherwise. The conf-level fallback stays 0 on both versions
so an explicit CONFIG_LV_USE_QRCODE=n is always honored.

- liblvgl/Kconfig: default y if LVGL_VERSION_8
- v8/CMakeLists.txt: bridge CONFIG_LV_USE_QRCODE to -DLV_USE_QRCODE=1
- v8/conf/lv_conf.h: replace the hardcode with the v9-style wrapper

Verified on DNESP32S3_BOX (esp32s3, LVGL v8): default build keeps qrcode
compiled in (lv_qrcode.c.o carries lv_qrcode_create), and an explicit
"# CONFIG_LV_USE_QRCODE is not set" produces an empty translation unit.

Co-Authored-By: Claude Code <noreply@anthropic.com>
The guided WeChat shell's bottom-left menu button stayed visible on top
of the full-screen camera and album pages because those overlays bypass
the guided page state machine that owns its visibility.

Add a shell-owned helper guided_wechat_menu_btn_set_hidden() and call it
from the camera/album display callbacks: hide on open (including the
select-mode entry that skips disp_open) and restore on close, only when
the chat surface is active so guided pages keep it hidden.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@yingtao450
yingtao450 merged commit bdadea4 into tuya:master Sep 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants