Skip to content

Commit

Permalink
adjust naming
Browse files Browse the repository at this point in the history
  • Loading branch information
thypon committed Dec 19, 2024
1 parent 2a17b1e commit 6640c7a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
8 changes: 5 additions & 3 deletions browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions components/ai_chat/core/browser/conversation_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions components/ai_chat/core/common/features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions components/ai_chat/core/common/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 6640c7a

Please sign in to comment.