From dc60f3c37f72874e9bee15c3571bc50ea5826c17 Mon Sep 17 00:00:00 2001 From: "A.J. Shulman" Date: Sun, 11 May 2025 17:30:18 -0400 Subject: cleaned up unused functions and also made available documents area json. --- .../nodes/chatbot/utils/AgentDocumentManager.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/client/views/nodes/chatbot/utils') diff --git a/src/client/views/nodes/chatbot/utils/AgentDocumentManager.ts b/src/client/views/nodes/chatbot/utils/AgentDocumentManager.ts index 82b7ed3df..e9d41efbd 100644 --- a/src/client/views/nodes/chatbot/utils/AgentDocumentManager.ts +++ b/src/client/views/nodes/chatbot/utils/AgentDocumentManager.ts @@ -965,11 +965,21 @@ export class AgentDocumentManager { * @returns An array of document IDs (strings). */ @computed - public get listDocs(): string[] { - console.log( - Array.from(this.documentsById.entries()).map(([id, agentDoc]) => JSON.stringify({ id, title: agentDoc.layoutDoc.title, type: agentDoc.layoutDoc.type, summary: agentDoc.layoutDoc.summary || 'No summary available for this document.' })) - ); - return Array.from(this.documentsById.entries()).map(([id, agentDoc]) => JSON.stringify({ id, title: agentDoc.layoutDoc.title, type: agentDoc.layoutDoc.type, summary: agentDoc.layoutDoc.summary || 'No summary available for this document.' })); + public get listDocs(): string { + const xmlDocs = Array.from(this.documentsById.entries()).map(([id, agentDoc]) => { + return ` + ${id} + ${this.escapeXml(StrCast(agentDoc.layoutDoc.title))} + ${this.escapeXml(StrCast(agentDoc.layoutDoc.type))} + ${this.escapeXml(StrCast(agentDoc.layoutDoc.summary))} +`; + }); + + return xmlDocs.join('\n'); + } + + private escapeXml(str: string): string { + return str.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, '''); } @computed -- cgit v1.2.3-70-g09d2