fix: prevent unnecessary /api/speech calls causing 500 errors#2201
Open
Priyanka-Microsoft wants to merge 1 commit intoAzure-Samples:devfrom
Open
fix: prevent unnecessary /api/speech calls causing 500 errors#2201Priyanka-Microsoft wants to merge 1 commit intoAzure-Samples:devfrom
Priyanka-Microsoft wants to merge 1 commit intoAzure-Samples:devfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This pull request improves the speech synthesis feature in the
Answercomponent by making the initialization and error handling of the speech synthesizer more robust and testable. The main changes include refactoring synthesizer initialization, enhancing error handling, and updating related tests.Speech Synthesis Improvements:
initializeSynthesizerfunction to accept optionaltokenandregionparameters, and to returnnullif these are missing, making initialization more flexible and robust.startSpeechfunction to accept an optional synthesizer instance, improving flexibility in how speech playback is triggered.Testing and Error Handling:
console.errorinstead ofconsole.log, and added a test for clicking the speak button, ensuring error handling is properly tested. [1] [2]fetchSythesizerDatafunction to return a promise and handle errors more cleanly, removing unnecessary try/catch and logging.These changes make the speech synthesis feature more reliable and maintainable, and ensure that error scenarios are properly handled and tested.
BUG ID :
https://dev.azure.com/CSACTOSOL/CSA%20Solutioning/_workitems/edit/42243/
Does this introduce a breaking change?
How to Test
What to Check
Verify that the following are valid
Other Information