跪拜 Guibai
← All articles
Backend

The Rokid AIUI Build Behind 'Say Clearly', a Voice-Practice Coach for AI Glasses

By 努力的小雨 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Rokid AIUI has a published, voice-driven AI glasses app to study, and the build shows how to solve three recurring problems: de-duplicating voice input, keeping context without a backend, and validating model output before showing it. The patterns transfer directly to other voice-first or on-device AI apps.

Summary

Rokid's AIUI Studio now supports a full development-to-publishing flow for AI glasses apps, and a recent walkthrough shows how to put it to work. The app built is 'Say Clearly', a voice-interactive coach that helps users practice self-introductions. It asks follow-up questions based on the user's stated identity, experience, and the help they can offer; when they stall, it offers sentence completions, and when time is tight it switches to a compact mode. At the end it generates a full summary and a draft introduction from the user's own statements.

The development process is deliberately incremental. After the platform generates a minimal project, the developer makes one checkable change at a time: first a welcome page, then voice input, then model calls, then error handling. Speech recognition uses the platform's SpeechRecognition API, and the code carefully prevents duplicate submissions by checking whether the current instance is still active. Context is managed manually in page state, storing every turn with its question and answer, keeping valid user facts for the final draft, and marking superseded answers rather than deleting them.

Model output goes through strict validation before it reaches the interface. The LanguageModel API is used per request, with a JSON contract that specifies question, feedback, action, stage, and mode. The app rejects outputs that don't conform, allows only valid moves between practice stages, and retries once with repair information if the format fails. Timeouts cap the wait at 35 seconds for coaching and 45 seconds for summary. After simulator testing and real-device packaging, the app was submitted and now shows as published in AIUI Studio.

Takeaways
— The app structures practice around identity, specific experience, and the help offered.
— AIUI CODING generates and modifies project files from natural language instructions, but it doesn't always produce complete code in one pass.
— The development workflow gives one checkable goal per iteration: first four files and a welcome page, then voice input, model calls, and exception handling.
— app.json must declare the exact platform-supported permission RECORD_AUDIO for voice input.
— SpeechRecognition is configured with zh-CN, continuous=false, and interimResults=true; only final text is committed to the practice flow.
— To prevent double submissions, every recognition callback verifies it still belongs to the current active instance, and page teardown clears callbacks and destroys the session.
— Context is kept entirely in page state: each turn stores question and answer pairs, valid user facts are extracted for the final draft, and history holds the most recent 24 non-superseded turns.
— Superseded answers are flagged rather than deleted, preserving traceability for debugging and summary generation.
— LanguageModel calls require an availability check, session creation with system prompts, and JSON parsing with validation of action, stage, and mode fields.
— Validation rules: a followup stays in the current practice goal, advance only moves to an adjacent goal, and finish requires being at the last goal with at least three valid answers.
— The phrase 'too hard' keeps the current goal and returns a sentence-completion frame, while 'only two minutes left' switches to compact mode and can advance to an adjacent goal.
— Summary generation runs as a separate job type and requires overview, strengths (with evidence), improvements, introduction, and nextPractice fields.
— Structured output can fail; the app retries at most twice, with the second attempt including outputRepair containing the prior error and truncated output.
— Timeouts are set at 35 seconds for coaching prompts and 45 seconds for summary generation, enforced via Promise.race.
— The publishing path is simulator debug, real-device packaging to an AIX file, then submission with description, screenshots, and a demo video.
Conclusions

The incremental build order is a direct response to AI-generated code that sometimes produces empty or incomplete files; checking one page at a time isolates whether the problem is generation, event handling, or model response.

Without a backend, the page itself acts as the session store; keeping question-answer pairs and valid facts in local state is how the model gets coherent context across turns.

Treating model output as untrusted until it passes a schema and business-rule check reduces the chance of nonsense or unsafe responses; the app rejects any response that isn't structurally valid or doesn't respect the practice-stage constraints.

Marking old answers as superseded instead of deleting them preserves the ability to trace why the model made a particular recommendation, which helps when debugging or explaining the final introduction.

The system prompt explicitly forbids the model from evaluating pronunciation, tone, or personality, and from inventing facts; this keeps the coach's output safe and grounded in the user's actual statements.

Concepts & terms
AIUI Studio
Rokid's development environment for AI glasses apps, providing a project workbench, simulator, code editor, and app submission flow.
AIUI CODING
A natural-language-driven code generation module inside AIUI Studio that creates and modifies project files from instructions, separate from the runtime LanguageModel.
LanguageModel
The runtime API in AIUI for invoking LLMs; supports availability checks, session creation with initial system prompts, and returns generated text, often JSON.
SpeechRecognition
AIUI's voice recognition API, configurable for language, continuous or single-shot recognition, and interim results, with callback-based final and interim text.
AIX
The app package format for Rokid glasses, built from a project for real-device testing and ultimately for submission to the store.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗