mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-03 05:29:12 +00:00
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:
@@ -62,7 +62,10 @@
|
||||
return `${time_string}, ${date_string}`;
|
||||
}
|
||||
|
||||
function generateReference(reference, index) {
|
||||
function generateReference(referenceJson, index) {
|
||||
let reference = referenceJson.hasOwnProperty("compiled") ? referenceJson.compiled : referenceJson;
|
||||
let referenceFile = referenceJson.hasOwnProperty("file") ? referenceJson.file : null;
|
||||
|
||||
// Escape reference for HTML rendering
|
||||
let escaped_ref = reference.replaceAll('"', '"');
|
||||
|
||||
|
||||
@@ -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, """)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user