Chat: Add STT / SpeechToText Integration (d.ts)#32517
Chat: Add STT / SpeechToText Integration (d.ts)#32517mpreyskurantov merged 5 commits intoDevExpress:26_1from
Conversation
There was a problem hiding this comment.
Pull request overview
Adds new Chat API surface for controlling the message input text and configuring speech-to-text (STT), and wires these options through the wrapper packages/types so consumers can use the feature across frameworks.
Changes:
- Added
dxChatOptions.inputFieldTextanddxChatOptions.speechToTextOptionsto DevExtreme typings. - Refactored
dxSpeechToTextoption typings to exposedxSpeechToTextOptions(deprecated) and aliasPropertiesto it. - Updated Angular/Vue/React Chat wrappers to expose
speechToTextOptionsand add nested configuration components for STT.
Reviewed changes
Copilot reviewed 8 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/devextreme/ts/dx.all.d.ts | Adds inputFieldText/speechToTextOptions to dxChatOptions; refactors dxSpeechToText properties typing. |
| packages/devextreme/js/ui/speech_to_text_types.d.ts | Re-exports dxSpeechToTextOptions from speech_to_text. |
| packages/devextreme/js/ui/speech_to_text.d.ts | Introduces dxSpeechToTextOptions interface (deprecated) and aliases Properties to it. |
| packages/devextreme/js/ui/chat.d.ts | Adds Chat inputFieldText and speechToTextOptions typings. |
| packages/devextreme-vue/src/chat.ts | Exposes inputFieldText/speechToTextOptions and adds STT nested config components. |
| packages/devextreme-react/src/chat.ts | Adds STT nested config components for Chat. |
| packages/devextreme-metadata/make-angular-metadata.ts | Adjusts Angular metadata filtering for Chat members. |
| packages/devextreme-angular/src/ui/chat/nested/speech-to-text-options.ts | Adds Angular nested option component for Chat STT options. |
| packages/devextreme-angular/src/ui/chat/nested/speech-recognition-config.ts | Adds Angular nested option component for STT recognition config. |
| packages/devextreme-angular/src/ui/chat/nested/custom-speech-recognizer.ts | Adds Angular nested option component for custom recognizer config. |
| packages/devextreme-angular/src/ui/chat/nested/index.ts | Exports the new nested option components. |
| packages/devextreme-angular/src/ui/chat/index.ts | Exposes inputFieldText and speechToTextOptions on the Angular Chat component and wires change emitters/modules. |
| speechToTextOptions: Object as PropType<dxSpeechToTextOptions | Record<string, any>>, | ||
| typingUsers: Array as PropType<Array<User>>, |
There was a problem hiding this comment.
The Vue wrapper types speechToTextOptions as dxSpeechToTextOptions, but dxChatOptions.speechToTextOptions is Omit<SpeechToTextProperties, 'stylingMode' | 'type'>. Please align the Vue prop type with the core Chat typings (and avoid accepting stylingMode/type here).
| stylingMode: String as PropType<ButtonStyle>, | ||
| tabIndex: Number, | ||
| type: String as PropType<ButtonType | string>, | ||
| visible: Boolean, |
There was a problem hiding this comment.
DxSpeechToTextOptions currently exposes stylingMode and type, but dxChatOptions.speechToTextOptions omits these fields. Please remove these props from the nested option config (and drop the related ButtonStyle/ButtonType imports if they become unused) to keep wrapper API consistent with core typings.
| stylingMode?: ButtonStyle; | ||
| tabIndex?: number; | ||
| type?: ButtonType | string; |
There was a problem hiding this comment.
ISpeechToTextOptionsProps includes stylingMode and type, but core dxChatOptions.speechToTextOptions is Omit<SpeechToTextProperties, 'stylingMode' | 'type'>. Please remove these props (and the ButtonStyle/ButtonType imports if they become unused) so the React nested option can’t set fields that Chat’s public API intentionally excludes.
| stylingMode?: ButtonStyle; | |
| tabIndex?: number; | |
| type?: ButtonType | string; | |
| tabIndex?: number; |
| get speechToTextOptions(): dxSpeechToTextOptions { | ||
| return this._getOption('speechToTextOptions'); | ||
| } | ||
| set speechToTextOptions(value: dxSpeechToTextOptions) { | ||
| this._setOption('speechToTextOptions', value); |
There was a problem hiding this comment.
speechToTextOptions is typed as dxSpeechToTextOptions, but the core dxChatOptions.speechToTextOptions type is Omit<SpeechToTextProperties, 'stylingMode' | 'type'>. The Angular wrapper should use the same omitted type (and update the corresponding speechToTextOptionsChange output type as well) so consumers can’t pass unsupported stylingMode/type values.
| @Input() | ||
| get stylingMode(): ButtonStyle { | ||
| return this._getOption('stylingMode'); | ||
| } | ||
| set stylingMode(value: ButtonStyle) { | ||
| this._setOption('stylingMode', value); | ||
| } |
There was a problem hiding this comment.
stylingMode is exposed on the dxo-chat-speech-to-text-options nested option, but dxChatOptions.speechToTextOptions intentionally omits stylingMode (and type). Please remove these inputs from the nested option (or otherwise prevent them from being set) to match the Chat public API typings.
| @Input() | ||
| get type(): ButtonType | string { | ||
| return this._getOption('type'); | ||
| } | ||
| set type(value: ButtonType | string) { | ||
| this._setOption('type', value); | ||
| } |
There was a problem hiding this comment.
type is exposed on the dxo-chat-speech-to-text-options nested option, but dxChatOptions.speechToTextOptions omits type (and stylingMode) in the core typings. Please remove this input (or block it from being set) so Angular wrapper matches the supported Chat option surface.
| "update:stopIcon": null, | ||
| "update:stopText": null, | ||
| "update:stylingMode": null, | ||
| "update:tabIndex": null, | ||
| "update:type": null, | ||
| "update:visible": null, |
There was a problem hiding this comment.
DxSpeechToTextOptions exposes stylingMode/type updates, but dxChatOptions.speechToTextOptions omits these fields. Remove these emits (and related props) so the nested configuration surface matches the underlying Chat option type.
| get speechToTextOptions(): dxSpeechToTextOptions { | ||
| return this._getOption('speechToTextOptions'); | ||
| } | ||
| set speechToTextOptions(value: dxSpeechToTextOptions) { |
There was a problem hiding this comment.
dxChatOptions.speechToTextOptions is typed in core as Omit<dxSpeechToTextOptions, 'stylingMode' | 'type'> (see packages/devextreme/js/ui/chat.d.ts). The Angular wrapper exposes it as full dxSpeechToTextOptions, which allows unsupported options to be passed in and diverges from the runtime API. Align the type here with the core option (omit stylingMode and type).
| get speechToTextOptions(): dxSpeechToTextOptions { | |
| return this._getOption('speechToTextOptions'); | |
| } | |
| set speechToTextOptions(value: dxSpeechToTextOptions) { | |
| get speechToTextOptions(): Omit<dxSpeechToTextOptions, 'stylingMode' | 'type'> { | |
| return this._getOption('speechToTextOptions'); | |
| } | |
| set speechToTextOptions(value: Omit<dxSpeechToTextOptions, 'stylingMode' | 'type'>) { |
| * This member supports the internal infrastructure and is not intended to be used directly from your code. | ||
|
|
||
| */ | ||
| @Output() speechToTextOptionsChange: EventEmitter<dxSpeechToTextOptions>; |
There was a problem hiding this comment.
speechToTextOptionsChange should match the actual option type exposed by the component (Omit<dxSpeechToTextOptions, 'stylingMode' | 'type'>). Using dxSpeechToTextOptions here makes the event type broader than the supported option surface.
| @Output() speechToTextOptionsChange: EventEmitter<dxSpeechToTextOptions>; | |
| @Output() speechToTextOptionsChange: EventEmitter<Omit<dxSpeechToTextOptions, 'stylingMode' | 'type'>>; |
ReOpen: