From ab6672a702986d9b22de4f2df7955a0297308cab Mon Sep 17 00:00:00 2001
From: "A.J. Shulman" <Shulman.aj@gmail.com>
Date: Thu, 7 Nov 2024 11:02:09 -0500
Subject: trying to add a new create any doc tool

---
 .../nodes/chatbot/chatboxcomponents/ChatBox.tsx    | 42 +++++++++++++++++++---
 1 file changed, 37 insertions(+), 5 deletions(-)

(limited to 'src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx')

diff --git a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
index fcbaf2e27..57d02a408 100644
--- a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
+++ b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
@@ -401,15 +401,47 @@ export class ChatBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
      * @param id The unique ID for the document.
      */
     @action
-    createDocInDash = async (doc_type: string, data: string, options: DocumentOptions, id: string) => {
+    createDocInDash = async (doc_type: string, data: string | undefined, options: DocumentOptions, id: string) => {
         let doc;
-        switch (doc_type) {
+
+        switch (doc_type.toLowerCase()) {
             case 'text':
-                doc = DocCast(Docs.Create.TextDocument(data, options));
+                doc = Docs.Create.TextDocument(data || '', options);
+                break;
+            case 'image':
+                doc = Docs.Create.ImageDocument(data || '', options);
+                break;
+            case 'pdf':
+                doc = Docs.Create.PdfDocument(data || '', options);
+                break;
+            case 'video':
+                doc = Docs.Create.VideoDocument(data || '', options);
+                break;
+            case 'audio':
+                doc = Docs.Create.AudioDocument(data || '', options);
+                break;
+            case 'web':
+                doc = Docs.Create.WebDocument(data || '', options);
+                break;
+            case 'equation':
+                doc = Docs.Create.EquationDocument(data || '', options);
+                break;
+            case 'functionplot':
+            case 'function_plot':
+                doc = Docs.Create.FunctionPlotDocument([], options);
+                break;
+            case 'dataviz':
+            case 'data_viz':
+                doc = Docs.Create.DataVizDocument(data || '', options);
+                break;
+            case 'chat':
+                doc = Docs.Create.ChatDocument(options);
+                break;
+            // Add more cases for other document types
             default:
-                doc = DocCast(Docs.Create.TextDocument(data, options));
+                console.error('Unknown or unsupported document type:', doc_type);
+                return;
         }
-
         const linkDoc = Docs.Create.LinkDocument(this.Document, doc);
         LinkManager.Instance.addLink(linkDoc);
 
-- 
cgit v1.2.3-70-g09d2

