Skip to main content

Custom UI Interactions

This example explains how to customize plugin UI interactions when using the dobot-plus skill in an AI Agent via function descriptions in Requirements.md. The Skill generates function.json and ui/Main.tsx from your requirements; this page focuses on page layout conventions, available component types, and how to specify UI explicitly or rely on default inference.

Example Workflow

The UI page is one step in the Skill workflow, generated alongside Lua, HTTP, and block/script configs:

For the full development flow, see Adapting Modbus Devices, Adapting TCP Devices, or Adapting I/O Devices. After generation, you can manually edit ui/Main.tsx to refine interactions before rebuilding.

Page Layout

When generating pages, the dobot-plus skill uses a fixed left-right split layout:

AreaPositionContent
Device statusLeftRead-only status display (read functions)
Control panelRightParameter inputs and action buttons (write / control functions)

The screenshot below shows the OnRobot VG10 plugin: channel vacuum levels and product model on the left; vacuum grip parameters and grip/release controls on the right.

layout

Do not change this layout rule in Requirements.md. Changing the left-right split to stacked layouts, multiple tabs, or other structures makes Agent behavior unstable and produces unpredictable pages.

Pages use antd as the base component library. You can reference the antd component library and specify UI types for each function in Requirements.md.

Specifying UI in Requirements.md

Add a UI interaction description line under each function. The Agent maps it to the ui field in function.json.

Append a UI interaction description line under each function in Requirements.md.

For example, a set-speed function can be described as:

### SetSpeed — set speed

- Action: write speed register, range 0~100
- Parameter: speed (number, default 50)
- UI: Slider

When Requirements.md is written this way, the generated UI renders the set-speed function as a slider.

Function Type vs UI Mapping

Function typeTypical namingSuggested UIPlacement
No-parameter controlStartDevice, OpenGripperButtonRight
Parameterized writeSetSpeed, SetForceSlider / Input / SelectRight
Enum selectionSetMode, SetChannelSelect / Radio / DropdownRight
Boolean toggleEnableVacuumSwitch / CheckboxRight
Status readGetStartStatus, GetPositionTag / Text / TableLeft
File operationImportConfigUploadRight

Component Types

Display Components

Used in the left Device status area for read-only, no-input functions.

Componentui valueUse caseRequirements.md example
Read-only textNo fixed enum; Agent may use tag or StatisticSingle numeric or string statusUI: read-only text / UI: read-only status
TagtagBoolean or enum status with color distinctionUI: Tag (1=running, 0=stopped)
TabletableMulti-row, multi-field status listUI: table showing channel status

Control Components

Used in the right Control panel area. Parameterized functions render controls in the form; functions with ui: button are grouped in the bottom button area.

Componentui valueUse caseRequirements.md example
InputinputNumeric or text parameter inputUI: input (range 0~255)
SlidersliderContinuous value adjustment (speed, force, etc.)UI: slider (0~100)
SelectselectSingle choice from many optionsUI: select (options: A / B / C)
DropdowndropdownDropdown menu selectionUI: Dropdown menu
RadioradioFew mutually exclusive optionsUI: radio (on / off / auto)
SwitchswitchBoolean toggleUI: switch
CheckboxcheckboxBoolean checkboxUI: checkbox
ButtonbuttonNo-parameter immediate action (start, stop, reset)UI: button
UploaduploadFile importUI: file upload

Default Inference Rules

If a function description does not specify a UI type, the Agent infers from semantics and parameter types:

Function characteristicDefault UI
No-parameter control / triggerButton
number parameter with a clear rangeSlider
number / string parameter without range or needing precise inputInput
Enum or limited optionsSelect or Radio
boolean parameterSwitch
Read-only status returning boolean or discrete enumTag
Read-only status returning number / stringRead-only text (Statistic)
Multi-row structured dataTable

Explicitly writing UI types in Requirements.md is recommended, especially for edge cases (e.g. "force as slider, mode as radio, status as Tag") to reduce mismatches.

Full Example Snippet

The following snippet is from the I/O control example, showing buttons paired with read-only status:

# I/O Control Example

> Send commands to an external device via controller digital outputs (DO) and read status via digital inputs (DI).

## 1. Device overview

This plugin controls an external processing device over controller I/O—no Modbus or TCP.

## 2. Communication method

| Item | Description |
| --- | --- |
| Protocol | Controller I/O |
| Output ports | DO (digital output) |
| Input ports | DI (digital input) |
| Lua API | `DO(index, ON\|OFF)`, `DI(index)`, `GetDO(index)` |

## 3. I/O ports

| Port | Direction | High level | Low level |
| --- | --- | --- | --- |
| DO-1 | Output | Start command | Idle / not started |
| DO-2 | Output | Stop command | Idle / not stopped |
| DI-1 | Input | Device started | Device not started |
| DI-2 | Input | Device stopped | Device not stopped |

## 4. Functions

### 4.1 StartDevice — start external device

- Action: `DO(1, ON)` — high level on DO-1
- UI: button

### 4.2 GetStartStatus — read start status

- Action: read `DI(1)`
- Return: `1` if DI-1 is high (started); `0` if not ready or failed
- UI: read-only status

### 4.3 StopDevice — stop external device

- Action: `DO(2, ON)` — high level on DO-2
- UI: button

### 4.4 GetStopStatus — read stop status

- Action: read `DI(2)`
- Return: `1` if DI-2 is high (stopped); `0` if not ready or failed
- UI: read-only status

## 5. Operation flow

### Start

1. Call `StartDevice` — DO-1 high
2. Wait for device response (1–3 s recommended)
3. Call `GetStartStatus` — confirm DI-1 is high

### Stop

1. Call `StopDevice` — DO-2 high
2. Wait for device response (1–3 s recommended)
3. Call `GetStopStatus` — confirm DI-2 is high

## 6. Safety notes

- Confirm DO wiring before operation to avoid unintended device triggers
- After stop command, confirm safe shutdown via DI feedback
- If DI stays low, check external device fault or wiring

Generated Result

After the Skill finishes, the UI looks like this:

io

FAQ

Manual build when Agent packaging fails

When development and debugging are complete, run from the project root:

dpt build

Outputs:

  • dist/ — built plugin sources for inspection
  • output/ — zip package named <plugin-name>-<version>.zip for import

Generated UI component type does not match expectations

Add an explicit UI: line under the function in Requirements.md, remove ambiguous wording, and re-run /dobot-plus. For a single control tweak, edit ui/Main.tsx manually.

Buttons and parameter controls are misplaced

By convention, controls with ui: button render at the bottom of the right form; other control components render in the form field area. Do not request custom layout in Requirements.md.

Need custom components or complex pages

The current Skill targets standard Dobot+ plugin scenarios with the antd components and fixed left-right layout above. For complex interactions, manually rewrite ui/Main.tsx after /dobot-plus.