Issue #214481: Add option to filter code from copilot chat text to speech#230012
Closed
burkus wants to merge 12 commits intomicrosoft:mainfrom
Closed
Issue #214481: Add option to filter code from copilot chat text to speech#230012burkus wants to merge 12 commits intomicrosoft:mainfrom
burkus wants to merge 12 commits intomicrosoft:mainfrom
Conversation
Author
|
@bpasero thanks for your help! |
Author
|
@microsoft-github-policy-service agree |
bpasero
requested changes
Oct 1, 2024
Member
There was a problem hiding this comment.
This seems not needed for this task?
| localize('accessibility.voice.autoSynthesize.on', "Enable the feature. When a screen reader is enabled, note that this will disable aria updates."), | ||
| localize('accessibility.voice.autoSynthesize.off', "Disable the feature."), | ||
| localize('accessibility.voice.autoSynthesize.auto', "When a screen reader is detected, disable the feature. Otherwise, enable the feature.") | ||
| localize('accessibility.voice.autoSynthesize.auto', "When a screen reader is detected, disable the feature. Otherwise, enable the feature."), |
| SpeechTimeout = 'accessibility.voice.speechTimeout', | ||
| AutoSynthesize = 'accessibility.voice.autoSynthesize', | ||
| SpeechLanguage = 'accessibility.voice.speechLanguage', | ||
| FilterCode = 'accessibility.voice.filterCode' |
Member
There was a problem hiding this comment.
How about accessibility.voice.ignoreCodeBlocks
| let chunk: string | undefined = undefined; | ||
|
|
||
| const text = response.response.toString(); | ||
| const filter = this.configurationService.getValue<boolean>(AccessibilityVoiceSettingId.FilterCode); |
Member
There was a problem hiding this comment.
Actually now that I see this, I would suggest to filter code blocks here in voiceChatActions and not introduce changes to chatModel.
One thing to address: we receive chunks from the chat model and we may actually be inside a code block, so the logic to filter out code blocks needs to track if we are currently inside a code block I think and then keep ignoring the chunk until the code block is exited.
burkus
commented
Oct 3, 2024
Comment on lines
+859
to
+876
| const ignoreCodeBlocks = this.configurationService.getValue<boolean>(AccessibilityVoiceSettingId.IgnoreCodeBlocks); | ||
| let text = response.response.toString(); | ||
| const delimiter = '```'; | ||
| let codeBlockTerminates = false; | ||
| const firstDelimiterIndex = text.indexOf(delimiter); | ||
|
|
||
| if (ignoreCodeBlocks && isWithinCodeBlock && firstDelimiterIndex === -1) { | ||
| text = ''; | ||
| } else if (ignoreCodeBlocks && !isWithinCodeBlock) { | ||
| const [filteredText, terminated] = this.withoutCodeBlocks(text); | ||
| text = filteredText; | ||
| codeBlockTerminates = terminated; | ||
| } else if (ignoreCodeBlocks && isWithinCodeBlock && firstDelimiterIndex >= 0) { | ||
| text = text.substring(firstDelimiterIndex + 1); | ||
| const [filteredText, terminated] = this.withoutCodeBlocks(text); | ||
| text = filteredText; | ||
| codeBlockTerminates = terminated; | ||
| } |
Member
|
Going with #235697, thanks though, much appreciated! |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This is an implementation of a requested feature issued here: #214481
I've added a new option to the
accessibility.voice.*options, called 'FilterCode'.It is enabled by default.
When on, it filters out code blocks delimited by triple backticks "```" so that text to speech doesn't sound spammy/annoying when it contains large amounts of code.
I was hoping to do this as part of Hacktoberfest