Skip to content

[Local AI] [WebSpeech] Serve Web Speech sessions from Brave's own model - #39398

Draft
yrliou wants to merge 1 commit into
stt-pr1-componentfrom
stt-pr2-engine
Draft

[Local AI] [WebSpeech] Serve Web Speech sessions from Brave's own model#39398
yrliou wants to merge 1 commit into
stt-pr1-componentfrom
stt-pr2-engine

Conversation

@yrliou

@yrliou yrliou commented Aug 25, 2026

Copy link
Copy Markdown
Member

Upstream decides a session is on-device in two places, and failing either sends it to SODA or to the speech recognition service, bypassing the browser. Both now accept the qualities Brave's model serves, and that path builds a subclass taking its stream from Brave's worker rather than a ModelBroker session.

AudioChunksEnded closes the input stream but keeps the responder bound, since the worker emits its final result on that close and upstream's immediate empty result would end recognition first. No UI thread Core is built, because it would ask the optimization guide broker for assets nothing here uses.

ContentBrowserClient gains GetAsrSession so content can reach the embedder without depending on Brave. The controller refuses a session when no model is installed, surfacing as a recognition failure rather than a worker that cannot load.

@yrliou yrliou self-assigned this Aug 25, 2026
@yrliou yrliou added the CI/skip Do not run CI builds (except noplatform) label Aug 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor


if (enable_local_ai) {
brave_content_browser_sources += [
"//brave/content/browser/speech/brave_on_device_speech_recognition_engine.cc",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
[opengrep] New source files should not be added to sources.gni. Please see https://github.com/brave/brave-core/blob/master/docs/gni_sources.md for details


Source: https://github.com/brave/security-action/blob/main/assets/opengrep_rules/client/sources_gni.yaml


Cc @brave/sources-gni-reviewers

if (enable_local_ai) {
brave_content_browser_sources += [
"//brave/content/browser/speech/brave_on_device_speech_recognition_engine.cc",
"//brave/content/browser/speech/brave_on_device_speech_recognition_engine.h",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
[opengrep] New source files should not be added to sources.gni. Please see https://github.com/brave/brave-core/blob/master/docs/gni_sources.md for details


Source: https://github.com/brave/security-action/blob/main/assets/opengrep_rules/client/sources_gni.yaml


Cc @brave/sources-gni-reviewers

@yrliou
yrliou force-pushed the stt-pr2-engine branch 3 times, most recently from 1a21c45 to 212a87c Compare August 26, 2026 23:37
Upstream decides a session is on-device in two places, and failing either sends
it to SODA or to the speech recognition service, bypassing the browser. Both now
accept the qualities Brave's model serves, and that path builds a subclass
taking its stream from Brave's worker rather than a ModelBroker session.

`AudioChunksEnded` closes the input stream but keeps the responder bound, since
the worker emits its final result on that close and upstream's immediate empty
result would end recognition first. No UI thread Core is built, because it would
ask the optimization guide broker for assets nothing here uses.

`ContentBrowserClient` gains `GetAsrSession` so content can reach the embedder
without depending on Brave. The controller refuses a session when no model is
installed, surfacing as a recognition failure rather than a worker that cannot
load.
@brave-builds

Copy link
Copy Markdown
Collaborator

Warning

You have got a presubmit warning. Please address it if possible.

A banned pattern was used.
    content/browser/speech/brave_on_device_speech_recognition_engine_unittest.cc:38:
      Avoid suppressing gn checks with `nogncheck` comments, and only do it if it is absolutely necessary. Make sure that this is not the case that the exclusion for the inclusion line has in the C++ source has a mismatch with what is being included/excluded in the gn file.

@brave-builds

Copy link
Copy Markdown
Collaborator

Warning

You have got a presubmit warning. Please address it if possible.

A banned pattern was used.
    content/browser/speech/brave_on_device_speech_recognition_engine_unittest.cc:39:
      Avoid suppressing gn checks with `nogncheck` comments, and only do it if it is absolutely necessary. Make sure that this is not the case that the exclusion for the inclusion line has in the C++ source has a mismatch with what is being included/excluded in the gn file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/skip Do not run CI builds (except noplatform)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants