When valueField/textField are not explicitly set in opts, the auto-select logic (line 1140) and nullable empty-option creation (lines 1144-1145) used data[0][undefined] which returned undefined, causing: - Single-option selects to show blank (auto-select failed) - nullable empty options to have undefined keys Now extracts vf/tf local variables with ||'value'/||'text' fallback at the top of build_options(), used consistently throughout.
16 lines
1.2 KiB
Markdown
16 lines
1.2 KiB
Markdown
# VadText
|
|
|
|
**Control Functionality**: A composite control that integrates voice capture, audio playback, and speech recognition text display. The user clicks a button to start recording. When speech termination is detected, the audio is automatically converted into WAV format and sent to the backend for speech recognition. The recognition result is then displayed in real time within the text area.
|
|
**Type**: Container Control
|
|
**Parent Control**: `bricks.VBox`
|
|
|
|
## Initialization Parameters
|
|
|
|
- `opts.name` *(Optional)*: Name of the control; defaults to `'asr_text'`.
|
|
- `opts.height`: Defaults to `'100%'`, occupying the full height of the parent container.
|
|
- Other common layout parameters inherited from `VBox` (such as `width`, `align`, etc.) can also be passed in.
|
|
|
|
## Main Events
|
|
|
|
- `audio_ready`: Triggered when voice activity detection (VAD) captures a complete utterance and generates audio data. The event carries `Float32Array` type audio sample data.
|
|
- `changed`: Triggered after recording stops, when speech recognition is completed and returns non-empty text content. Carries the current control's value object `{ [name]: text }`, which can be used for form submission or state synchronization. |