Pass file path of each doc reference in references returned by API

- Pass file path of reference along with the compiled reference in
  list of references returned by chat API converts
- Update the structure of references from list of strings to list of
  dictionary (containing 'compiled' and 'file' keys)
- Pull out the compiled reference from the new references data struct
  wherever it was is being used
This commit is contained in:
Debanjum Singh Solanky
2024-05-26 17:18:38 +05:30
parent ba330712f8
commit e24ca9ec28
9 changed files with 24 additions and 15 deletions

View File

@@ -247,7 +247,8 @@ export class KhojChatView extends KhojPaneView {
return referenceButton;
}
generateReference(messageEl: Element, reference: string, index: number) {
generateReference(messageEl: Element, referenceJson: any, index: number) {
let reference: string = referenceJson.hasOwnProperty("compiled") ? referenceJson.compiled : referenceJson;
// Escape reference for HTML rendering
let escaped_ref = reference.replace(/"/g, """)