-
Notifications
You must be signed in to change notification settings - Fork 503
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
base: staging
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
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).
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.