aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/chatbot/utils/AgentDocumentManager.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/chatbot/utils/AgentDocumentManager.ts')
-rw-r--r--src/client/views/nodes/chatbot/utils/AgentDocumentManager.ts22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/client/views/nodes/chatbot/utils/AgentDocumentManager.ts b/src/client/views/nodes/chatbot/utils/AgentDocumentManager.ts
index 857cc859d..088891022 100644
--- a/src/client/views/nodes/chatbot/utils/AgentDocumentManager.ts
+++ b/src/client/views/nodes/chatbot/utils/AgentDocumentManager.ts
@@ -27,7 +27,7 @@ interface AgentDocument {
export class AgentDocumentManager {
@observable private documentsById: ObservableMap<string, AgentDocument>;
private chatBox: ChatBox;
- private parentView : DocumentView
+ private parentView: DocumentView;
private chatBoxDocument: Doc | null = null;
private fieldMetadata: Record<string, any> = {}; // bcz: CHANGE any to a proper type!
@observable private simplifiedChunks: ObservableMap<string, SimplifiedChunk>;
@@ -36,7 +36,7 @@ export class AgentDocumentManager {
* Creates a new DocumentManager
* @param templateDocument The document that serves as a template for new documents
*/
- constructor(chatBox: ChatBox, parentView : DocumentView) {
+ constructor(chatBox: ChatBox, parentView: DocumentView) {
makeObservable(this);
this.parentView = parentView;
const agentDoc = DocCast(chatBox.Document.agentDocument) ?? new Doc();
@@ -857,6 +857,7 @@ export class AgentDocumentManager {
try {
// Create simple document with just title and data
const simpleDoc: parsedDoc = {
+ ...(options as parsedDoc), // bcz: hack .. why do we need parsedDoc and not DocumentOptions here?
doc_type: docType,
title: options?.title ?? `Untitled Document ${this.documentsById.size + 1}`,
data: data,
@@ -1018,19 +1019,18 @@ export class AgentDocumentManager {
return docInfo?.dataDoc;
}
- // In AgentDocumentManager
- private descriptionCache = new Map<string,string>();
+ // In AgentDocumentManager
+ private descriptionCache = new Map<string, string>();
public async getDocDescription(id: string): Promise<string> {
- if (!this.descriptionCache.has(id)) {
- const doc = this.getDocument(id)!;
- const desc = await Doc.getDescription(doc);
- this.descriptionCache.set(id, desc.replace(/\n/g,' ').trim());
- }
- return this.descriptionCache.get(id)!;
+ if (!this.descriptionCache.has(id)) {
+ const doc = this.getDocument(id)!;
+ const desc = await Doc.getDescription(doc);
+ this.descriptionCache.set(id, desc.replace(/\n/g, ' ').trim());
+ }
+ return this.descriptionCache.get(id)!;
}
-
/**
* Adds simplified chunks to a document for citation handling
* @param doc The document to add simplified chunks to