## Project Template

Based on On-App AI on-device lighting scene capabilities, Tuya provides an efficient, low-cost, real-time responsive AI lighting solution for smart lighting products. This solution deploys a lightweight lighting scene generation model locally on mobile devices, achieving millisecond-level (< 10ms) generation of professional whole-home lighting effects. It supports one-tap preview and save without cloud inference, significantly reducing usage barriers and operational costs while comprehensively improving user experience and large-scale deployment efficiency.

### Core Features

<Image
  src='/images/solution/aiLightingScene/preview_en.jpg'
  style={{
    borderRadius: '10px',
    boxShadow: '0 0 5px rgba(0,0,0,0.3)',
    maxWidth: '240px',
    marginTop: '20px',
  }}
/>


- **On-Device AI Generated Lighting Scenes:** Based on room and lighting capabilities, generate 9 atmospheric lighting solutions with one tap, presented in real-time without cumbersome configuration.

- **AI Action Prediction Engine:** Automatically matches device control instructions (actions) for each lighting scene, ensuring executable effects.

- **Single and Batch Smart Refresh:** Supports replacing individual lighting solutions or refreshing only unselected solutions, while automatically preserving selected content.

- **Real-Time Lighting Preview:** Execute lighting actions with a tap, with instant device feedback for WYSIWYG results.

- **Multi-Select Save to Cloud Scenes:** Supports saving multiple AI-generated scenes at once for long-term retention and on-demand invocation.

- **Enhanced Interactive Experience:** Built-in loading animations, success feedback, and disabled state prompts to avoid mistouch and operation conflicts.

- **Scene Quantity and Permission Verification:** Supports limit control and administrator permission verification to ensure secure and compliant scene management.

- **Inspiration Replenishment Mechanism:** Provides gentle prompts when users refresh frequently, enhancing the warmth of AI interaction experience.

### Template

- [AI Generative Lighting Scene Template Source Code](https://github.com/Tuya-Community/tuya-ray-materials?path=template/AILightingSceneTemplate)

> Note: 

- The template's APIs depend on cloud capabilities and require authorization configuration in [Mini Program Developer Platform](https://platform.tuya.com/miniapp/) under `Development Settings` - `Cloud Capabilities`. Specific operation: Find the `Mini Program Lighting Scene Capability` card, click the `Authorize` button in the lower right corner of the card to complete the cloud capability authorization.
- If no specific room `roomId` is passed in the path, the template defaults to using the first room under the current home. Developers can adjust according to their needs.
- It is recommended to select SMB-related homes to experience the complete lighting scene creation process and more professional lighting features.


When creating a new smart mini program project in the IDE, select **AILightingSceneTemplate** to quickly create a project, as shown below:

<Image
  src='/images/solution/aiLightingScene/template-select_en.png'
  style={{
    borderRadius: '10px',
    boxShadow: '0 0 5px rgba(0,0,0,0.3)',
    maxWidth: '800px',
    marginTop: '20px',
  }}
/>
