-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bug] [Assistant API] - Do not allow empty conversation ID in chat/co…
…mplete route (#11783) (#213049) ## Summary BUG: elastic/security-team#11783 This PR fixes the behaviour of the `/api/security_ai_assistant/chat/complete` route where the `conversationId` can be passed as an empty string. This may lead to unexpected results described in elastic/security-team#11783 (comment). ### Expected behaviour We should throw a bad request (400) http error when empty `conversationId` has been passed. ### Testing * Use this `curl` command to test the endpoint. ``` curl --location 'http://localhost:5601/api/security_ai_assistant/chat/complete' \ --header 'kbn-xsrf: true' \ --header 'Content-Type: application/json' \ --data '{ "connectorId": "{{my-gpt4o-ai}}", "conversationId": "", "isStream": false, "messages": [ { "content": "Follow up", "role": "user" } ], "persist": true }' ``` You should see next error as a response: ``` { "statusCode": 400, "error": "Bad Request", "message": "[request body]: conversationId: String must contain at least 1 character(s), conversationId: No empty strings allowed" } ``` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 7db897a)
- Loading branch information
Showing
6 changed files
with
9 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters