-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(interactions): add audio type Uint8Array to lexV1 #10273
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ import { | |
Credentials, | ||
getAmplifyUserAgent, | ||
} from '@aws-amplify/core'; | ||
import { convert } from './AWSLexProviderHelper/convert'; | ||
import { convert } from './AWSLexProviderHelper/utils'; | ||
import { unGzipBase64AsJson } from './AWSLexProviderHelper/commonUtils'; | ||
|
||
const logger = new Logger('AWSLexV2Provider'); | ||
|
@@ -301,18 +301,7 @@ export class AWSLexV2Provider extends AbstractInteractionsProvider { | |
let params: RecognizeUtteranceCommandInput; | ||
|
||
// prepare params | ||
if (messageType === 'voice') { | ||
// voice input | ||
if ( | ||
!( | ||
content instanceof Blob || | ||
content instanceof ReadableStream || | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. RN does not support But if the guard clause is moved externally to a function Ts isn't able to detect it and cribs. |
||
content instanceof Uint8Array | ||
) | ||
) { | ||
return Promise.reject('invalid content type'); | ||
} | ||
|
||
if (messageType === 'voice' && typeof content === 'object') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question here |
||
const inputStream = | ||
content instanceof Uint8Array ? content : await convert(content); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure I'm just not thinking of it but what is the case in which an
InteractionsMessage
might be of typevoice
but not have anobject
type content?