From 6640c7a14381b077831f3cf6423b580cbf144dc3 Mon Sep 17 00:00:00 2001 From: Andrea Brancaleoni Date: Wed, 18 Dec 2024 21:41:52 -0800 Subject: [PATCH] adjust naming --- browser/about_flags.cc | 8 +++++--- components/ai_chat/core/browser/conversation_handler.cc | 4 ++-- components/ai_chat/core/common/features.cc | 8 ++++---- components/ai_chat/core/common/features.h | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/browser/about_flags.cc b/browser/about_flags.cc index ac95c1a904d0..aa313ee7d857 100644 --- a/browser/about_flags.cc +++ b/browser/about_flags.cc @@ -410,11 +410,13 @@ FEATURE_VALUE_TYPE(ai_chat::features::kOpenAIChatFromBraveSearch), \ }, \ { \ - "brave-ai-chat-sidebar-page-context", \ + "brave-ai-chat-page-context", \ "Brave AI Chat Page Context", \ - "Use page context to improve AI chat responses in the sidebar", \ + "For AI Chat Conversations which are associated with web content, " \ + "allow the toggle for sending page content to be set to enabled " \ + "when the conversation is created.", \ kOsWin | kOsMac | kOsLinux | kOsAndroid, \ - FEATURE_VALUE_TYPE(ai_chat::features::kSidebarUsePageContext), \ + FEATURE_VALUE_TYPE(ai_chat::features::kPageContextEnabledInitially), \ }) #if BUILDFLAG(ENABLE_AI_REWRITER) diff --git a/components/ai_chat/core/browser/conversation_handler.cc b/components/ai_chat/core/browser/conversation_handler.cc index bafe2e841023..a03cea284c7f 100644 --- a/components/ai_chat/core/browser/conversation_handler.cc +++ b/components/ai_chat/core/browser/conversation_handler.cc @@ -431,7 +431,7 @@ void ConversationHandler::SetArchiveContent(std::string text_content, is_video); associated_content_delegate_ = archive_content->GetWeakPtr(); archive_content_ = std::move(archive_content); - should_send_page_contents_ = features::IsSidebarUsePageContextEnabled(); + should_send_page_contents_ = features::IsPageContextEnabledInitially(); } void ConversationHandler::SetAssociatedContentDelegate( @@ -465,7 +465,7 @@ void ConversationHandler::SetAssociatedContentDelegate( // This class should only be provided with a delegate when // it is allowed to use it (e.g. not internal WebUI content). // The user can toggle this via the UI. - should_send_page_contents_ = features::IsSidebarUsePageContextEnabled(); + should_send_page_contents_ = features::kPageContextEnabledInitially(); MaybeSeedOrClearSuggestions(); MaybeFetchOrClearContentStagedConversation(); diff --git a/components/ai_chat/core/common/features.cc b/components/ai_chat/core/common/features.cc index 02e8001afc5e..6f5eec5f03a9 100644 --- a/components/ai_chat/core/common/features.cc +++ b/components/ai_chat/core/common/features.cc @@ -90,12 +90,12 @@ bool IsOpenAIChatFromBraveSearchEnabled() { return base::FeatureList::IsEnabled(features::kOpenAIChatFromBraveSearch); } -BASE_FEATURE(kSidebarUsePageContext, - "SidebarUsePageContext", +BASE_FEATURE(kPageContextEnabledInitially, + "PageContextEnabledInitially", base::FEATURE_ENABLED_BY_DEFAULT); -bool IsSidebarUsePageContextEnabled() { - return base::FeatureList::IsEnabled(features::kSidebarUsePageContext); +bool IsPageContextEnabledInitially() { + return base::FeatureList::IsEnabled(features::kPageContextEnabledInitially); } } // namespace ai_chat::features diff --git a/components/ai_chat/core/common/features.h b/components/ai_chat/core/common/features.h index a8e615fee7af..86006dccc51b 100644 --- a/components/ai_chat/core/common/features.h +++ b/components/ai_chat/core/common/features.h @@ -60,8 +60,8 @@ BASE_DECLARE_FEATURE(kOpenAIChatFromBraveSearch); COMPONENT_EXPORT(AI_CHAT_COMMON) bool IsOpenAIChatFromBraveSearchEnabled(); COMPONENT_EXPORT(AI_CHAT_COMMON) -BASE_DECLARE_FEATURE(kSidebarUsePageContext); -COMPONENT_EXPORT(AI_CHAT_COMMON) bool IsSidebarUsePageContextEnabled(); +BASE_DECLARE_FEATURE(kPageContextEnabledInitially); +COMPONENT_EXPORT(AI_CHAT_COMMON) bool IsPageContextEnabledInitially(); } // namespace ai_chat::features