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

Move Gen AI toggle tab state to localStorage #343

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

adamjarling
Copy link
Contributor

@adamjarling adamjarling commented Jun 25, 2024

What does this do?

  • Defaults the active tab on Search page to show Chat streaming response when a user enters the Search route with the Gen AI checkbox checked.
  • Moves Gen AI checkbox state from URL query params, to localStorage
  • Removes active tab state from Search Context
  • Attempts to handle faceting/filtering UX when Gen AI checkbox state is active

This PR moves the ball down the field, however there is one last piece which I'm not sure of the proper direction?

When a user is search w/ Gen AI, switches to the View Results tab, actively filters the results, and then clicks on the "AI Response" tab, the AI stream creates a new websocket request and doesn't render the cached result. Is this an expected outcome or no? Does faceting or filtering items change the nature of the original AI response, I guess is the question.

How to test

Basically just click around the app, searching, toggling the Gen AI check box on off at various places and times. Try logging in / out, see how the UX responds. Anything which seems out of the ordinary should be noted and addressed.

@adamjarling adamjarling self-assigned this Jun 25, 2024
Copy link
Member

@mathewjordan mathewjordan left a comment

Choose a reason for hiding this comment

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

This works great aside from one point of complexity. What should the user expect when the do the following?

  1. Check Use Generative AI
  2. Do their query/question, "Music"
  3. Click View n Results tab
  4. Select any facet (Image)

Right now, this will select the facet however it will also send them back to the AI Response tab. I think this is where we keep falling back an forth. This bit of complexity makes it where we can't necessarily rely on the Checkbox solely for deciding the current tab -- but some other current state knowledge is necessary as well.

@adamjarling
Copy link
Contributor Author

This works great aside from one point of complexity. What should the user expect when the do the following?

  1. Check Use Generative AI
  2. Do their query/question, "Music"
  3. Click View n Results tab
  4. Select any facet (Image)

Right now, this will select the facet however it will also send them back to the AI Response tab. I think this is where we keep falling back an forth. This bit of complexity makes it where we can't necessarily rely on the Checkbox solely for deciding the current tab -- but some other current state knowledge is necessary as well.

@mathewjordan I've been really trying to avoid suggested browser localStorage to track whether a user has opted into Gen AI, but your point above aligns with some other scenarios which might be pointing in that direction. We can't really store it in top level Context (page refresh wipes it), seems clunky to force it into a URL param on every route... Thoughts? I can do a quick test and gauge how big a refactor this might be.

@mathewjordan
Copy link
Member

This works great aside from one point of complexity. What should the user expect when the do the following?

  1. Check Use Generative AI
  2. Do their query/question, "Music"
  3. Click View n Results tab
  4. Select any facet (Image)

Right now, this will select the facet however it will also send them back to the AI Response tab. I think this is where we keep falling back an forth. This bit of complexity makes it where we can't necessarily rely on the Checkbox solely for deciding the current tab -- but some other current state knowledge is necessary as well.

@mathewjordan I've been really trying to avoid suggested browser localStorage to track whether a user has opted into Gen AI, but your point above aligns with some other scenarios which might be pointing in that direction. We can't really store it in top level Context (page refresh wipes it), seems clunky to force it into a URL param on every route... Thoughts? I can do a quick test and gauge how big a refactor this might be.

I'm all for it if it simplifies handling.

@adamjarling adamjarling changed the title Search page active tab defaults to streaming when user checks the Gen AI toggle Move Gen AI toggle tab state to localStorage Jul 1, 2024
@mathewjordan mathewjordan self-requested a review July 1, 2024 23:59
Copy link
Member

@mathewjordan mathewjordan left a comment

Choose a reason for hiding this comment

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

I'm not sure if I'm missing something. I see the ai key in local storage now, however it doesn't seem to be defaulting to the AI Response as expected. Maybe we can check it out together?

image

@mathewjordan mathewjordan self-requested a review July 2, 2024 18:51
Copy link
Member

@mathewjordan mathewjordan left a comment

Choose a reason for hiding this comment

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

💯

@adamjarling adamjarling merged commit 3881cd2 into preview/chat-integration Jul 2, 2024
1 check passed
@adamjarling adamjarling deleted the 4803-default-ai-tab branch July 2, 2024 19:58
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.

2 participants