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

feat(nx-dev): get the correct query for ai feedback #18961

Merged
merged 1 commit into from Sep 1, 2023

Conversation

mandarini
Copy link
Member

@mandarini mandarini commented Sep 1, 2023

Current Behavior

We have a list of messages, and each one has an index, which is generated by the loop that renders the messages. The messages are Queries (by the user) and Responses (by the assistant).

The 👍 / 👎 feedback buttons are "attached" to the Response message. So, whenever a user clicks on the feedback button, we know that they clicked on the message with index X. Using that index X we assume that the Query that resulted in that Response is the message with index X-1. Since this logic is based on an assumption that the messages list will always be consistent and "correct" and sorted, we think that it is brittle.

Expected Behavior

Now that we use the useChat from ai/react package, we get back a list of messages, and each message has its own id. So, when we get a Response, we tie the id of the Response with the Query that gave that Response. That way, we can be sure that when a user clicks the feedback button, their feedback will be for the correct Query.

@bcabanes

@mandarini mandarini requested a review from a team as a code owner September 1, 2023 07:36
@vercel
Copy link

vercel bot commented Sep 1, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 1, 2023 1:59pm

@mandarini mandarini self-assigned this Sep 1, 2023
@mandarini mandarini changed the title feat(nx-dev): get the correct question for feedback feat(nx-dev): get the correct query for ai feedback Sep 1, 2023
@mandarini mandarini requested review from FrozenPandaz and removed request for jaysoo September 1, 2023 07:57
@mandarini mandarini merged commit ed6d7f7 into nrwl:master Sep 1, 2023
15 checks passed
@github-actions
Copy link

github-actions bot commented Sep 7, 2023

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants