DialogFlow - Suggested update to detect_intent_stream.php sample script. Avoiding Exception when using OutputAudioConfig() #911
Labels
samples
Issues that are directly related to samples.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
Hello, Please can I suggest a change?
In this example script:
https://github.com/GoogleCloudPlatform/php-docs-samples/blob/master/dialogflow/src/detect_intent_stream.php
we have the following extract:
Which relies on using
$response
that is set from the last iteration of the loop and might not always be available.Suggestion:
In this example setting
$queryResult
has been moved into theforeach ($stream->closeWriteAndReadAll() as $response)
loop becausegetQueryResult()
isn't always available on the final iteration of the loop.For example when utilising
OutputAudioConfig()
it is set on the penultimate iteration. Which would throw an exception in the current example and result in the loss of results.Related issue:
googleapis/google-cloud-php#2026
The text was updated successfully, but these errors were encountered: