aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
diff options
context:
space:
mode:
authorA.J. Shulman <Shulman.aj@gmail.com>2024-12-18 20:46:27 -0500
committerA.J. Shulman <Shulman.aj@gmail.com>2024-12-18 20:46:27 -0500
commit9b4c554cca11f5c3105085b54646e684dd235f1d (patch)
treeaa8e9b54dad2e13e33702bcb6072ad5fc89fe600 /src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
parent57e3c9b9977228a561e8972a469a67f17f4bcd9c (diff)
image creation works but is weird
Diffstat (limited to 'src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx')
-rw-r--r--src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
index baa4ad521..e5a90ab4a 100644
--- a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
+++ b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
@@ -39,6 +39,7 @@ import { AudioBox } from '../../AudioBox';
import { DiagramBox } from '../../DiagramBox';
import { ImageField } from '../../../../../fields/URLField';
import { DashUploadUtils } from '../../../../../server/DashUploadUtils';
+import { DocCreatorMenu, Field, FieldUtils } from '../../DataVizBox/DocCreatorMenu';
dotenv.config();
@@ -398,6 +399,23 @@ export class ChatBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
this.addCSVForAnalysis(doc, id);
};
+ @action
+ createImageInDash = async (url: string, title: string, id: string, data: string) => {
+ const doc = FieldUtils.ImageField(
+ {
+ tl: [0, 0],
+ br: [300, 300],
+ },
+ 300,
+ 300,
+ title,
+ url ?? '',
+ {}
+ );
+
+ return doc;
+ };
+
/**
* Creates a text document in the dashboard and adds it for analysis.
* @param title The title of the doc.
@@ -415,8 +433,7 @@ export class ChatBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
break;
case 'image':
console.log('imageURL: ' + data);
- //DashUploadUtils.UploadImage(data!);
- doc = Docs.Create.ImageDocument(data || '', options);
+ doc = await this.createImageInDash(data || '', options.title as string, '', data || '');
break;
case 'pdf':
doc = Docs.Create.PdfDocument(data || '', options);