chat-with-your-data-solution-accelerator icon indicating copy to clipboard operation
chat-with-your-data-solution-accelerator copied to clipboard

Frontend crash due to invalid citations

Open cecheta opened this issue 1 year ago • 0 comments

Describe the bug

The frontend crashed after receiving a response from the /custom endpoint. I was not able to obtain the response, however the crash occurred at this line, as citation was undefined:

https://github.com/Azure-Samples/chat-with-your-data-solution-accelerator/blob/f755b8ec3c30c532347b456b49a1d5d48f80cf77/code/frontend/src/components/Answer/AnswerParser.tsx#L24

The error most likely occurred because the response contained a citation that did not exist, i.e. [doc6], even though there were only 5 source documents.

The following was observed in the API logs:

Source document 6 not provided, skipping doc
Source document 7 not provided, skipping doc
Source document 8 not provided, skipping doc
Source document 9 not provided, skipping doc

Expected behavior

The frontend application should not crash. Errors should be caught and an handled gracefully, or an appropriate error is returned to the user.


Debugging information

Steps to reproduce

Difficult to reproduce due to non-deterministic result.

Logs

Provided above.


Tasks

To be filled in by the engineer picking up the issue

cecheta avatar Apr 18 '24 14:04 cecheta