Skip to content
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

Fetch staged entries from Brave Search before opt-in to Leo #26424

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yrliou
Copy link
Member

@yrliou yrliou commented Nov 6, 2024

  • This avoid us falling into the situation where users need to click on summarize the page from the welcome screen to continue the opt-in flow when user first open Leo from Brave Search. Instead, privacy message will be shown directly.
  • There are still no requests will be sent to AI chat server unless user opts in. This only allows the request to fetch from Brave Search backend to be happened when Leo is opened before user opts in.

Open via continue with Leo button from Brave Search:

Screen.Recording.2024-11-06.at.12.32.27.PM.mov

Open Leo manually:

Screen.Recording.2024-11-06.at.12.59.59.PM.mov

Note that this changes requirement 1.6 in https://docs.google.com/document/d/1idelFPpUEcKDNcyKYf3M5yw91tuIddjrlYfpaWEJjNk/edit?tab=t.0, tagging @diracdeltas and @ShivanKaul here to make sure it's okay from security and privacy perspective. Will update the spec once this change is approved.

Resolves brave/brave-browser#42112

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

  1. Open a fresh profile without opting in to Leo
  2. Enable experimental features on Brave Search
  3. Start a query and type a follow-up question on Brave Search
  4. After answers generated, click on the continue with Leo button in Brave Search
  5. Opt-in privacy message should be shown, and staged entries should be shown after opted-in.

… no entries

- This avoid us falling into the situation where users need to click on
  summarize the page to continue the opt-in flow when user first open Leo from
  Brave Search.
- There are still no requests will be sent to AI chat server unless user
  opts in. This only allows the request to fetch from Brave Search backend.
@yrliou yrliou self-assigned this Nov 6, 2024
@github-actions github-actions bot added the CI/storybook-url Deploy storybook and provide a unique URL for each build label Nov 6, 2024
@@ -1047,8 +1047,7 @@ void ConversationHandler::MaybeFetchOrClearContentStagedConversation() {
}

const bool can_check_for_staged_conversation =
ai_chat_service_->HasUserOptedIn() && IsContentAssociationPossible() &&
should_send_page_contents_;
IsContentAssociationPossible() && should_send_page_contents_;
Copy link
Member

Choose a reason for hiding this comment

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

are the staged entries just the local chat history? so nothing is fetched from any servers to get the staged conversation.

Copy link
Member Author

Choose a reason for hiding this comment

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

Staged entries are fetched from Brave Search server.

Copy link
Member

Choose a reason for hiding this comment

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

@yrliou that's the only case in which they are fetched from a server?

Copy link
Member Author

Choose a reason for hiding this comment

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

Currently, yes, our only source of staged entries is Brave Search server.

@yrliou yrliou changed the title Fetch staged entries before opt-in and only show welcome message when… Fetch staged entries from Brave Search before opt-in to Leo Nov 7, 2024
Copy link
Member

@diracdeltas diracdeltas left a comment

Choose a reason for hiding this comment

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

lgtm but @ShivanKaul should also look

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/storybook-url Deploy storybook and provide a unique URL for each build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Opening Leo from search should auto populate after user agrees to opt-in
4 participants