Skip to content
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

fix(frontend): Error when API key is not entered is not clear #4429

Merged
merged 14 commits into from
Oct 22, 2024

Conversation

Yashwanth-Chandrakumar
Copy link
Contributor

@Yashwanth-Chandrakumar Yashwanth-Chandrakumar commented Oct 16, 2024

Give a summary of what the PR does, explaining any non-trivial design decisions

Added a modal for prompting the user to input an API Key in settings during startup and in session.

Link of any specific issues this addresses

Resolves #4236

@Yashwanth-Chandrakumar
Copy link
Contributor Author

@amanape is this good

@amanape amanape self-requested a review October 16, 2024 18:41
@amanape amanape self-assigned this Oct 17, 2024
@amanape amanape changed the title fix(frontend): Error when API key is not entered is not clear #4236 fix(frontend): Error when API key is not entered is not clear Oct 17, 2024
@Yashwanth-Chandrakumar
Copy link
Contributor Author

@amanape i have solved the issue but why isnt it merged

@amanape
Copy link
Member

amanape commented Oct 17, 2024

I will give a proper review soon, sorry for the delay! In the meantime, I see that there are some linting issues on the frontend. Could you take care of it to pass the GitHub CI?

@Yashwanth-Chandrakumar
Copy link
Contributor Author

Yes i think the prettier in my code editor is causing the problem will solve it. @amanape

@Yashwanth-Chandrakumar
Copy link
Contributor Author

@amanape solved the lint issues perfect to merge

Copy link
Member

@amanape amanape left a comment

Choose a reason for hiding this comment

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

The functionality does not work when pressing "Save". The flow should look something like this:

  • User presses "Save"
  • If there is no API key, show modal
  • Otherwise, send the save settings action request (it currently only does this)

We are using Remix to handle form actions. Instead of keeping LLM_API_KEY changes in the hasEnteredKey state, we can access this setting from the formRef:

const formData = new FormData(formRef.current); // assuming formRef.current is not undefined
const apiKey = formData.get("api-key");

You should prefer using Remix / React Router (latest version) API to handle form data and navigation states. I recommend reading their documentation for more information!

@Yashwanth-Chandrakumar
Copy link
Contributor Author

@amanape ok i will implement the changes and come back

@Yashwanth-Chandrakumar
Copy link
Contributor Author

Hi @amanape corrected the flow and other eslint issues (removed all the console log statements).

@Yashwanth-Chandrakumar
Copy link
Contributor Author

@amanape all checks are done can we merge it

Copy link
Member

@amanape amanape left a comment

Choose a reason for hiding this comment

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

There seems to be just one bug:

  1. Set API key and save
  2. Open settings again
  3. Clear API key input and press "Save"
  4. Confirm warning modal

In this case, the API key is not actually removed, and still there.

@Yashwanth-Chandrakumar
Copy link
Contributor Author

@amanape solved the bug, ready to merge

Copy link
Member

@amanape amanape left a comment

Choose a reason for hiding this comment

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

Thanks for the changes! Bonus points for handling the zIndex, too.

@amanape amanape merged commit 6573304 into All-Hands-AI:main Oct 22, 2024
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.

[Bug]: Error when API key is not entered is not clear
2 participants