Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
petemill committed Aug 9, 2024
1 parent 6f984db commit 47485af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 7 additions & 3 deletions components/ai_chat/core/browser/conversation_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,13 @@ void ConversationHandler::SetAssociatedContentDelegate(
if (archive_content_) {
associated_content_delegate_ = nullptr;
archive_content_ = nullptr;
} else {
CHECK(chat_history_.empty()) << "Cannot associate new content with a "
"conversation which already has messages";
} else if (chat_history_.empty()) {
// Cannot associate new content with a conversation which already has
// messages but this is ok since we're probably just defaulting this
// conversation to be "alongside" this target content (e.g. sidebar). The
// service will do the association and we can ignore the request to
// associate content.
return;
}

associated_content_delegate_ = delegate;
Expand Down
10 changes: 5 additions & 5 deletions components/ai_chat/resources/page/state/ai_chat_context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ export function AIChatContextProvider(props: React.PropsWithChildren<Props>) {
const store: AIChatContext = {
...context,
...props,
goPremium: UIHandler.goPremium,
managePremium: UIHandler.managePremium,
dismissPremiumPrompt: Service.dismissPremiumPrompt,
userRefreshPremiumSession: UIHandler.refreshPremiumSession,
handleAgreeClick: Service.markAgreementAccepted,
goPremium: () => UIHandler.goPremium(),
managePremium: () => UIHandler.managePremium(),
dismissPremiumPrompt: () => Service.dismissPremiumPrompt(),
userRefreshPremiumSession: () => UIHandler.refreshPremiumSession(),
handleAgreeClick: () => Service.markAgreementAccepted(),
uiHandler: UIHandler
}

Expand Down

0 comments on commit 47485af

Please sign in to comment.