diff options
Diffstat (limited to 'src/client/views/nodes/chatbot/utils/AgentDocumentManager.ts')
| -rw-r--r-- | src/client/views/nodes/chatbot/utils/AgentDocumentManager.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/client/views/nodes/chatbot/utils/AgentDocumentManager.ts b/src/client/views/nodes/chatbot/utils/AgentDocumentManager.ts index c954226e4..4eeac3c6a 100644 --- a/src/client/views/nodes/chatbot/utils/AgentDocumentManager.ts +++ b/src/client/views/nodes/chatbot/utils/AgentDocumentManager.ts @@ -90,7 +90,7 @@ export class AgentDocumentManager { */ public initializeFindDocsFreeform() { // Reset collections - this.documentsById.clear(); + //this.documentsById.clear(); try { // Use the LinkManager approach which is proven to work in ChatBox @@ -109,6 +109,7 @@ export class AgentDocumentManager { linkedDocs.forEach((doc: Doc) => { if (doc) { this.processDocument(doc); + console.log('Processed linked document:', doc.id, doc.title, doc.type); } }); @@ -164,6 +165,11 @@ export class AgentDocumentManager { } } + public addCustomId(doc: Doc, id: string) { + doc.id = id; + doc.DOCUMENT_ID_FIELD = id; + } + /** * Process a document by ensuring it has an ID and adding it to the appropriate collections * @param doc The document to process @@ -730,7 +736,7 @@ export class AgentDocumentManager { // Get metadata for all documents const documentsMetadata: Record<string, any> = {}; for (const doc of this.documentsById.values()) { - documentsMetadata.add(this.extractDocumentMetadata(doc)); + documentsMetadata.add(this.extractDocumentMetadata(doc) ?? { documentId: doc.layoutDoc.id, title: doc.layoutDoc.title, type: doc.layoutDoc.type }); } return { |
