aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorA.J. Shulman <Shulman.aj@gmail.com>2025-05-11 17:30:18 -0400
committerA.J. Shulman <Shulman.aj@gmail.com>2025-05-11 17:30:18 -0400
commitdc60f3c37f72874e9bee15c3571bc50ea5826c17 (patch)
tree134d5b5ff95c2b4edf7ee2133c550b9df265e76f /src
parent1ba55505d65af9b98a7a16e424d51119e4254c53 (diff)
cleaned up unused functions and also made available documents area json.
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx13
-rw-r--r--src/client/views/nodes/chatbot/utils/AgentDocumentManager.ts20
2 files changed, 15 insertions, 18 deletions
diff --git a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
index 867e78860..00077d68d 100644
--- a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
+++ b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
@@ -970,14 +970,6 @@ export class ChatBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
componentWillUnmount() {
this.removeScrollListener();
}
- /**
- * Getter that retrieves document IDs of linked documents that have PDF_chunker–parsed content.
- */
- @computed
- get docIds(): string[] {
- // Use the document manager to get all document IDs
- return Array.from(this.docManager.listDocs);
- }
/**
* Getter that retrieves all linked CSV files for analysis.
@@ -1004,11 +996,6 @@ export class ChatBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
// Other helper methods for retrieving document data and processing
- retrieveSummaries = (): string => {
- console.log(this.docManager.listDocs);
- return JSON.stringify(this.docManager.listDocs);
- };
-
retrieveCSVData = () => {
return this.linkedCSVs;
};
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 `<document>
+ <id>${id}</id>
+ <title>${this.escapeXml(StrCast(agentDoc.layoutDoc.title))}</title>
+ <type>${this.escapeXml(StrCast(agentDoc.layoutDoc.type))}</type>
+ <summary>${this.escapeXml(StrCast(agentDoc.layoutDoc.summary))}</summary>
+</document>`;
+ });
+
+ return xmlDocs.join('\n');
+ }
+
+ private escapeXml(str: string): string {
+ return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;');
}
@computed