You can check the code for sec insight:
https://www.secinsights.ai/it basically shows the pdf from which the answer is pulled out on the right side.
In simple terms, you can keep the pdf location as a metadata and when bot answers use the metadata to get file location and display it there