kibana/oas_docs/output
Ievgen Sorokopud 7db897a539
[Bug] [Assistant API] - Do not allow empty conversation ID in chat/complete route (#11783) (#213049)
## Summary

BUG: https://github.com/elastic/security-team/issues/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
https://github.com/elastic/security-team/issues/11783#issuecomment-2696529040.

### 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>
2025-03-04 13:05:51 +01:00
..
kibana.serverless.yaml [Bug] [Assistant API] - Do not allow empty conversation ID in chat/complete route (#11783) (#213049) 2025-03-04 13:05:51 +01:00
kibana.yaml [Bug] [Assistant API] - Do not allow empty conversation ID in chat/complete route (#11783) (#213049) 2025-03-04 13:05:51 +01:00