-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: Integrated Optimizely Prompt Experiment #52
Conversation
10c5989
to
6c5aeb1
Compare
6c5aeb1
to
2fb1862
Compare
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.
Nice! Just a few questions.
@@ -0,0 +1,7 @@ | |||
const PROMPT_EXPERIMENT_FLAG = '_cosmo__xpert_gpt_4_0_prompt'; |
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.
Question: sorry if this is captured somewhere else already but is the naming of this flag based on what is set in optimizely?
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.
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.
that looks like the correct value to use
unitId, | ||
...customQueryParams, | ||
}; | ||
|
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.
Nice!
src/utils/index.jsx
Outdated
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.
Question: Should this file exist or was it deleted?
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.
It was empty. I don't think it should be here.
* feat: trigger survey monkey on chat close * fix: Fixed useOptimizelyExperiment() infinite updates * fix: read experiment state correctly * feat: add tests * fix: fix lint errors * fix: remove flaky test --------- Co-authored-by: Marcos <[email protected]>
@@ -19,7 +19,8 @@ | |||
"lint:fix": "fedx-scripts eslint --fix --ext .js --ext .jsx .", | |||
"snapshot": "fedx-scripts jest --updateSnapshot", | |||
"start": "fedx-scripts webpack-dev-server --progress", | |||
"test": "fedx-scripts jest --coverage --passWithNoTests" | |||
"test": "fedx-scripts jest --coverage --passWithNoTests", | |||
"test:ci": "fedx-scripts jest --silent --coverage --passWithNoTests" |
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.
This reduces CI checks log file size from 30KB to 8KB by silencing warnings.
At some point warnings should be reduced, but we are not taking them into account on the CI, so we just might just remove them.
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.
Also, some warnings are caused by external libraries, like @openedx/paragon
icons for example. When testing, the library renders the icons as <IconMock />
by the use of a string reference rather than a component causing the following warning:
Warning: <IconMock /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.
at IconMock
at button
at /Users/marcos/edx/src/frontend-lib-learning-assistant/node_modules/react-bootstrap/cjs/Button.js:28:23
at children (/Users/marcos/edx/src/frontend-lib-learning-assistant/node_modules/@openedx/paragon/src/Button/index.jsx:12:3)
at div
at isOpen (/Users/marcos/edx/src/frontend-lib-learning-assistant/src/components/ToggleXpertButton/index.jsx:20:3)
at Provider (/Users/marcos/edx/src/frontend-lib-learning-assistant/node_modules/react-redux/lib/components/Provider.js:21:20)
at IntlProvider (/Users/marcos/edx/src/frontend-lib-learning-assistant/node_modules/react-intl/src/components/provider.js:33:47)
at children (/Users/marcos/edx/src/frontend-lib-learning-assistant/src/utils/utils.test.jsx:19:22)
This warning stacks up for every render.
f4da8a6
to
8d96749
Compare
src/components/Disclosure/index.jsx
Outdated
{getConfig().PRIVACY_POLICY_URL ? ( | ||
<p className="disclaimer text-light-100 py-3"> | ||
<strong>Note: </strong> | ||
This chat is AI generated (powered by ChatGPT). Mistakes are possible. | ||
By using it you agree that edX may create a record of this chat. | ||
Your personal data will be used as described in our | ||
<Hyperlink | ||
className="privacy-policy-link text-light-100" | ||
destination={getConfig().PRIVACY_POLICY_URL} | ||
> | ||
privacy policy | ||
</Hyperlink> | ||
. | ||
</p> | ||
) : null } |
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.
This solves a warning in the tests. Since getConfig().PRIVACY_POLICY_URL
is undefined
on the test environment, it throws a warning since destination
is a required prop for <Hyperlink>
.
The full warning was:
Warning: Failed prop type: The prop `destination` is marked as required in `ForwardRef`, but its value is `undefined`.
at className (/Users/marcos/edx/src/frontend-lib-learning-assistant/node_modules/@openedx/paragon/src/Hyperlink/index.jsx:15:5)
at _classCallCheck (/Users/marcos/edx/src/frontend-lib-learning-assistant/node_modules/@openedx/paragon/src/withDeprecatedProps.tsx:28:27)
at p
at div
at children (/Users/marcos/edx/src/frontend-lib-learning-assistant/src/components/Disclosure/index.jsx:10:23)
at div
at courseId (/Users/marcos/edx/src/frontend-lib-learning-assistant/src/components/Sidebar/index.jsx:23:3)
at Provider (/Users/marcos/edx/src/frontend-lib-learning-assistant/node_modules/react-redux/lib/components/Provider.js:21:20)
at IntlProvider (/Users/marcos/edx/src/frontend-lib-learning-assistant/node_modules/react-intl/src/components/provider.js:33:47)
at children (/Users/marcos/edx/src/frontend-lib-learning-assistant/src/utils/utils.test.jsx:19:22)
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.
since it seems like this config value is effectively required for this component maybe we want to make use of ensureConfig()? https://github.com/openedx/frontend-platform/blob/b0ac45329f0ed9022541abea4fe30abf49fde0b1/src/config.js#L264
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.
Indeed. I wasn't familiar with all the config options. Updated and it's much cleaner now. Thanks for the suggestion.
@@ -0,0 +1,160 @@ | |||
import React from 'react'; |
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.
this is great! Thanks for improving our test coverage on this
This integrates Optimizely's hooks for the new XPert prompt experiment.