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

Block sending empty messages to chat endpoint #344

Merged

Conversation

adamjarling
Copy link
Collaborator

@adamjarling adamjarling commented Jun 26, 2024

What does this do?

Handles a scenario where empty search values were being passed to the endpoint (causing issues in the API). The Chat component now guards against this by checking for a search term value.

How to test

  1. Open the Network tab of your browser and navigate to the Websocket (WS) tab to inspect traffic.
  2. Try searching with Gen AI enabled with both empty and non-empty search terms.
  3. Notice in the websocket logs, the question property will never be an empty string.

image

For developers, you can also do a quick console log, or put a breakpoint in this function to check as well:

const sendMessage = useCallback((data: object) => {
if (socketRef.current && socketRef.current.readyState === WebSocket.OPEN) {
socketRef.current.send(JSON.stringify(data));
}
}, []);

@adamjarling adamjarling self-assigned this Jun 26, 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.

👍

@adamjarling adamjarling merged commit aeb70c7 into preview/chat-integration Jun 26, 2024
1 check passed
@adamjarling adamjarling deleted the 5048-empty-chat-submission-block branch June 26, 2024 18:21
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.

None yet

2 participants