Skip to content

Move AI Tutor model log to useEffect #67175

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

Open
wants to merge 3 commits into
base: staging
Choose a base branch
from

Conversation

edcodedotorg
Copy link
Contributor

@edcodedotorg edcodedotorg commented Jul 17, 2025

AI Tutor uses query params to allow AI model selection but otherwise does not provide any user interface to select or see the selected model. A console log was added to give users (testers) feedback as to which model was actually selected (e.g. if the query param is entered incorrectly or an unavailable model is selected, it will default to gemini 2.0 flash).

Screenshot 2025-07-17 at 12 21 28 PM

This PR moves this log from the module that calculates the model ID (from query param or default) to a useEffect in the highest level AI Tutor component, since the module was being imported even if AI Tutor wasn't enabled, leading to a confusing console log message.

Links

This was reported by @molly-moen in slack.

Testing story

This was tested manually and it correctly logs in an AI Tutor enabled level and does not log in a level where AI Tutor is disabled.

@edcodedotorg edcodedotorg requested review from breville, molly-moen and a team July 17, 2025 16:22
@edcodedotorg edcodedotorg changed the title Move AI Tutor model log to UseEffect Move AI Tutor model log to useEffect Jul 17, 2025
@edcodedotorg edcodedotorg marked this pull request as ready for review July 17, 2025 16:28
Copy link
Contributor

@molly-moen molly-moen left a comment

Choose a reason for hiding this comment

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

Looks good!

@@ -21,6 +21,10 @@ const AiTutor2Chat: React.FunctionComponent<AiTutor2ChatProps> = ({
}) => {
const dispatch = useAppDispatch();

useEffect(() => {
console.log('🤖: aiTutorModelId:', aiTutorModelId);
Copy link
Contributor

Choose a reason for hiding this comment

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

mind adding a comment explaining this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure and done! I guess it's self explanatory what it's doing but not why. Basically added the PR description as a comment explaining the why.

Copy link
Contributor

@cnbrenci cnbrenci left a comment

Choose a reason for hiding this comment

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

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants