Overview
Generate React/TSX page code from scratch, supporting material references (images/videos) and prompt expansion. Suitable for landing pages, campaign pages, data visualization pages, interface prototypes, and rapid construction of React components. Not handled: modifying existing source code, non-React/HTML frameworks, back-end code (Python/Java, etc.), pixel-perfect restoration of design mockups, and complex back-end integration.
API Mapping
| Scenario | Backend API |
|---|---|
| React/TSX page code generation | text_code |
model mapping:
auto(default) / not passed → decide according to routing rulespretzel_pro/pretzel_lite→ directly specify the model- Model fallback chain:
pretzel_pro→pretzel_lite
Dependencies
- meitu-cli:
>=2.0.6 - Credentials:CONFIG AKSK →
meitu tools update; EXEC AKSK → run the command (see rootCONFIG.md) - Environment variables:
MEITU_OPENAPI_TOOL_TASK_MODE=command
Core Workflow
Preflight → Execute → Deliver
Preflight
meitu --version≥ 2.0.6, if not installed thennpm install -g meitu-cli@latestmeitu auth verify --json→ invalid credentials, follow CONFIG.md SOP- Confirm that the local
~/.meitu/tool-registry.jsonalready includestext-code, otherwisemeitu tools update - Resolve output_dir:
openclaw.yaml→./output/;else →~/.openclaw/workspace/visual/output/text-code/;mkdir -p {output_dir}
Execute
Trigger signals / routing rules
| Scenario | Decision keywords | Routing |
|---|---|---|
| Generate a React page from scratch | make a page, generate a webpage, landing page, campaign page, data visualization, generate a component | text_code |
| Short prompt + has prompt_name | prompt < 10 characters |
Call after automatic expansion |
| Provide source_code_url + modification intent | modify code, add button, adjust styles | Not part of this tool (use text-code-edit) |
| Request to generate non-React/HTML code | backend, Python, Java | Inform that only React/TSX is supported |
Parameter definitions
| Parameter | Type | Required | Range | Default value | Description |
|---|---|---|---|---|---|
prompt |
STRING | Yes | -- | -- | Page description, as detailed as possible. Missing → ask follow-up questions |
model |
ENUM | No | auto / pretzel_pro / pretzel_lite | pretzel_pro | Model selection; invalid values fall back to pretzel_pro |
image_list |
ARRAY | No | -- | [] | List of reference image URLs; invalid items are silently filtered out |
video_list |
ARRAY | No | -- | [] | List of reference video URLs; invalid items are silently filtered out |
prompt_name |
STRING | No | -- | -- | System prompt name |
Tool invocation
Basic generation:
meitu text-code --prompt "{page_description}" --json --download-dir {output_dir} --skill_name skill_text-code
Specify model + reference materials:
meitu text-code \
--skill_name skill_text-code \
--prompt "{page_description}" \
--model pretzel_pro \
--image_list "{url1}" --image_list "{url2}" \
--json --download-dir {output_dir}
Short prompt + prompt_name (automatic expansion):
meitu text-code --prompt "做个页面" --prompt_name "{template_name}" --json --download-dir {output_dir} --skill_name skill_text-code
Error fallback
| Scenario | Handling method |
|---|---|
prompt missing |
Prompt "Please describe the webpage you want to generate" |
prompt < 10 characters + has prompt_name |
Automatic expansion |
prompt < 10 characters + no prompt_name |
Pass through as-is |
model invalid value |
Fall back to pretzel_pro |
image_list All invalid but the user has reference intent |
Prompt "Please provide a valid image link" |
| Request non-React/HTML code | Inform that only React/TSX is supported |
| Timeout | Along pretzel_pro → pretzel_lite retry, return error when chain is exhausted |
| Incomplete code | Original model retries once → return error |
| Content compliance interception | Directly return compliance prompt, no retry |
Deliver
Parse --json:
ok: true→downloaded_files[0].saved_pathas local.tsxsource code; ormedia_urls[0]as code_urlok: false→ outputcode+hint
Write to disk:mv {file} {output_dir}/{YYYY-MM-DD}_{descriptive-name}.tsx, record code_url for subsequent text-code-edit automatic reference.
Output
- Format:
.tsx/.jsxsource code file - Naming:
{YYYY-MM-DD}_{descriptive-name}.tsx - Location: determined by the Deliver step (project →
./output/, one-time →~/.openclaw/workspace/visual/output/text-code/)
Baseline Task ID
See root directory references/task-id-baseline.md in text-code entry.