From 9b4c554cca11f5c3105085b54646e684dd235f1d Mon Sep 17 00:00:00 2001 From: "A.J. Shulman" Date: Wed, 18 Dec 2024 20:46:27 -0500 Subject: image creation works but is weird --- .../nodes/chatbot/chatboxcomponents/ChatBox.tsx | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/client/views/nodes/chatbot/chatboxcomponents') 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() { 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() { 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); -- cgit v1.2.3-70-g09d2