aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/nodes/chatbot/tools/CreateDocumentTool.ts65
1 files changed, 1 insertions, 64 deletions
diff --git a/src/client/views/nodes/chatbot/tools/CreateDocumentTool.ts b/src/client/views/nodes/chatbot/tools/CreateDocumentTool.ts
index 7d74c3b15..b14a57779 100644
--- a/src/client/views/nodes/chatbot/tools/CreateDocumentTool.ts
+++ b/src/client/views/nodes/chatbot/tools/CreateDocumentTool.ts
@@ -51,6 +51,7 @@ const example = [
height: 300,
},
],
+ backgroundColor: '#00ff00',
width: 600,
height: 600,
},
@@ -68,53 +69,6 @@ const docInstructions = {
description:
'A recursive collection of documents as a stringified array. Each document can be a "text", "flashcard", "image", "web", "image", "comparison", "equation", "noteboard", "simulation", "diagram", "map", "screengrab", "webcam", "button", or another "collection".',
example: finalJsonString,
- // example: [
- // {
- // doc_type: 'collection',
- // title: 'Science Collection',
- // data: [
- // {
- // doc_type: 'flashcard',
- // title: 'Photosynthesis',
- // data: { 'What is photosynthesis?': 'The process by which plants make food.' },
- // width: 300,
- // height: 300,
- // backgroundColor: '#0000FF',
- // },
- // {
- // doc_type: 'text',
- // title: 'Water Cycle',
- // data: 'The continuous movement of water on, above, and below the Earth’s surface.',
- // width: 300,
- // height: 300,
- // },
- // {
- // doc_type: 'collection',
- // title: 'Advanced Biology',
- // data: [
- // {
- // doc_type: 'flashcard',
- // title: 'Respiration',
- // data: { 'What is respiration?': 'Conversion of oxygen and glucose to energy.' },
- // width: 300,
- // height: 300,
- // },
- // {
- // doc_type: 'text',
- // title: 'Cell Structure',
- // data: 'Cells are the basic building blocks of all living organisms.',
- // width: 300,
- // height: 300,
- // },
- // ],
- // width: 600,
- // height: 600,
- // },
- // ],
- // width: 600,
- // height: 600,
- // },
- // ],
},
text: 'Provide text content as a plain string. Example: "This is a standalone text document."',
flashcard: 'Two text documents with content for the front and back.',
@@ -182,15 +136,11 @@ const createListDocToolParams = [
createDocToolParams +
'. Example: ' +
finalJsonString,
- //["{"doc_type":"collection","title":"Science Topics","data":"[\\"{\\\\"doc_type\\\\":\\\\"text\\\\",\\\\"title\\\\":\\\\"Photosynthesis\\\\",\\\\"background_color\\\\":\\\\""#0000FF"\\\\",\\\\"data\\\\":\\\\"Photosynthesis is the process by which plants make food.\\\\",\\\\"width\\\\":300,\\\\"height\\\\":300}\\",\\"{\\\\"doc_type\\\\":\\\\"collection\\\\",\\\\"title\\\\":\\\\"Advanced Biology\\\\",\\\\"data\\\\":\\\\"[\\\\"{\\\\"doc_type\\\\":\\\\"flashcard\\\\",\\\\"title\\\\":\\\\"Respiration\\\\",\\\\"data\\\\":{\\\\"What is respiration?\\\\":\\\\"Conversion of oxygen and glucose to energy.\\\\"},\\\\"width\\\\":300,\\\\"height\\\\":300}\\",\\\\"{\\\\"doc_type\\\\":\\\\"text\\\\",\\\\"title\\\\":\\\\"Cell Structure\\\\",\\\\"data\\\\":\\\\"Cells are the basic building blocks of all living organisms.\\\\",\\\\"width\\\\":300,\\\\"height\\\\":300}\\"]\\\\",\\\\"width\\\\":600,\\\\"height\\\\":600}\\"]","width":600,"height":600}"]',
-
- //["{"doc_type":"collection","title":"Science Topics","data":["{\\"doc_type\\":\\"text\\",\\"title\\":\\"Photosynthesis\\",\\"data\\":\\"Photosynthesis is the process by which plants make food.\\",\\"width\\":300,\\"height\\":300}","{\\"doc_type\\":\\"collection\\",\\"title\\":\\"Advanced Biology\\",\\"data\\":["{\\"doc_type\\":\\"flashcard\\",\\"title\\":\\"Respiration\\",\\"data\\":{\\"What is respiration?\\":\\"Conversion of oxygen and glucose to energy.\\"},\\"width\\":300,\\"height\\":300}","{\\"doc_type\\":\\"text\\",\\"title\\":\\"Cell Structure\\",\\"data\\":\\"Cells are the basic building blocks of all living organisms.\\",\\"width\\":300,\\"height\\":300}"],\\"width\\":600,\\"height\\":600}"],"width":600,"height":600}"]',
required: true,
},
] as const;
type CreateListDocToolParamsType = typeof createListDocToolParams;
-// type CreateDocToolParamsType = typeof createDocToolParams;
export class CreateDocTool extends BaseTool<CreateListDocToolParamsType> {
private _addLinkedDoc: (doc_type: string, data: string, options: DocumentOptions, id: string) => void;
@@ -209,23 +159,11 @@ export class CreateDocTool extends BaseTool<CreateListDocToolParamsType> {
}
async execute(args: ParametersType<CreateListDocToolParamsType>): Promise<Observation[]> {
- /**
- * loop through each collection calling the
- */
-
try {
console.log('EXE' + args.docs);
const parsedDoc = JSON.parse(args.docs);
console.log('parsed' + parsedDoc);
parsedDoc.forEach(doc => {
- // console.log('THIS DOC' + firstDoc);
- // console.log(typeof firstDoc);
- // const doc = JSON.parse(firstDoc);
- // console.log('NEW DOC' + doc);
- // console.log('TYPE' + doc['doc_type']);
- // console.log('WIDTH' + doc['width']);
- // console.log('HEIGHT' + doc['height']);
-
this._addLinkedDoc(
doc['doc_type'],
doc['data'],
@@ -233,7 +171,6 @@ export class CreateDocTool extends BaseTool<CreateListDocToolParamsType> {
uuidv4()
);
});
- // this._addLinkedDoc(args.doc_type, args.data, { title: args.title, backgroundColor: args.background_color, text_fontColor: args.font_color }, uuidv4());
return [{ type: 'text', text: 'Created document.' }];
} catch (error) {
return [{ type: 'text', text: 'Error creating text document, ' + error }];