Remove the credentials check from our is_enabled check
#120
+0
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
Remove the check for valid AI credentials when checking if an Experiment is enabled.
Why?
In #100, I added checks that run on our settings screen to verify we have valid AI credentials set and if not, show an error message alerting the user. This is helpful for users first setting things up, as this will help guide them through the process of adding AI credentials before turning on an Experiment.
In addition, I added a similar check when we run our
is_enabledcheck at the Experiment level. The goal here was to avoid showing an Experiment if the AI credentials are no longer valid (for instance, if someone revoked their API key).The issue I just realized is that our
is_enabledcheck runs basically everywhere, so by running our validation check there, we end up making an API request to the models endpoint on each page load, including the front-end. While this request runs pretty quickly, it's not great for performance to have that always run.How?
I considered two different approaches here to fix the problem:
is_enabledcheck and ensure we have proper error handling in each Experiment for situations where the AI credentials no longer workOpen to thoughts but after thinking it over, actually feels like a better user experience to go with the former. So the Experiment stays enabled, the UI is still available but when triggered, an error message is shown that let's the user know something went wrong and hopefully prompts them to go check their credentials.
Testing Instructions