Skip to content

Commit

Permalink
Changes for PR
Browse files Browse the repository at this point in the history
  • Loading branch information
fallaciousreasoning committed Nov 12, 2024
1 parent 365b1b2 commit e23bff1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion components/ai_chat/core/browser/conversation_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ void ConversationHandler::MaybeSeedOrClearSuggestions() {
suggestions_.clear();
}

if (is_page_associated && suggestions_.empty() &&
if (suggestions_.empty() &&
suggestion_generation_status_ !=
mojom::SuggestionGenerationStatus::IsGenerating &&
suggestion_generation_status_ !=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "base/functional/overloaded.h"
#include "base/memory/scoped_refptr.h"
#include "base/ranges/algorithm.h"
#include "base/run_loop.h"
#include "base/scoped_observation.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
Expand Down Expand Up @@ -1326,14 +1327,15 @@ TEST_F(ConversationHandlerUnitTest_NoAssociatedContent,
MockEngineConsumer* engine = static_cast<MockEngineConsumer*>(
conversation_handler_->GetEngineForTesting());

base::RunLoop loop;
// The prompt should be submitted to the engine, not the title.
EXPECT_CALL(*engine,
GenerateAssistantResponse(false, StrEq(""), _, "do the thing!",
StrEq(""), _, _));
StrEq(""), _, _))
.WillOnce(testing::InvokeWithoutArgs(&loop, &base::RunLoop::Quit));

testing::Sequence s;
conversation_handler_->SubmitHumanConversationEntry("the thing");
task_environment_.RunUntilIdle();
loop.Run();
testing::Mock::VerifyAndClearExpectations(engine);

// Suggestion should be removed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import { useConversation } from "../../state/conversation_context";
import styles from './style.module.scss'

export default function SuggestedQuestion({ question }: { question: string }) {
const context = useConversation()
const handleQuestionSubmit = (question: string) => {
context.conversationHandler?.submitHumanConversationEntry(question)
}
const context = useConversation()
const handleQuestionSubmit = (question: string) => {
context.conversationHandler?.submitHumanConversationEntry(question)
}

return <Button
kind='outline'
size='small'
onClick={() => handleQuestionSubmit(question)}
isDisabled={context.shouldDisableUserInput}>
<span className={styles.buttonText}>{question}</span>
</Button>
return <Button
kind='outline'
size='small'
onClick={() => handleQuestionSubmit(question)}
isDisabled={context.shouldDisableUserInput}>
<span className={styles.buttonText}>{question}</span>
</Button>
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// You can obtain one at https://mozilla.org/MPL/2.0/.

.buttonText {
display: flex;
align-items: flex-start;
text-align: left;
font: var(--leo-font-default-regular);
}
display: flex;
align-items: flex-start;
text-align: left;
font: var(--leo-font-default-regular);
}

0 comments on commit e23bff1

Please sign in to comment.