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: Prevent 404 errors in vote API by checking for assistant responses #864

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RMNCLDYO
Copy link

This PR fixes an issue where the application was making unnecessary requests to the vote endpoint before an assistant responses existed. These premature API calls were resulting in 404 errors in the console since the chat ID wasn't fully registered yet.

Key change:

  • Modified components/chat.tsx to conditionally fetch votes only when assistant responses exist
  • Added a check using messages.some(m => m.role === 'assistant') to prevent API calls until there's something that can be voted on

Before this fix, the page was refreshing approximately every 20 seconds and attempting to fetch votes for a chat ID that didn't exist yet, resulting in repeated 404 errors.

This commit fixes an issue where the application was making unnecessary requests to the vote endpoint before any assistant responses existed. These premature API calls were resulting in 404 errors in the console since the chat ID wasn't fully registered yet.

Key change:
- Modified components/chat.tsx to conditionally fetch votes only when assistant responses exist
- Added a check using messages.some(m => m.role === 'assistant') to prevent API calls until there's something that can be voted on

Before this fix, the page was refreshing approximately every 20 seconds and attempting to fetch votes for a chat ID that didn't exist yet, resulting in repeated 404 errors.
Copy link

vercel bot commented Mar 12, 2025

@RMNCLDYO is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@RMNCLDYO
Copy link
Author

cc @jeremyphilemon

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.

1 participant