aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ChatBox/tools/GetDocsTool.ts
diff options
context:
space:
mode:
authorA.J. Shulman <Shulman.aj@gmail.com>2024-09-07 12:43:05 -0400
committerA.J. Shulman <Shulman.aj@gmail.com>2024-09-07 12:43:05 -0400
commit4791cd23af08da70895204a3a7fbaf889d9af2d5 (patch)
treec4c2534e64724d62bae9152763f1a74cd5a963e0 /src/client/views/nodes/ChatBox/tools/GetDocsTool.ts
parent210f8f5f1cd19e9416a12524cce119b273334fd3 (diff)
completely restructured, added comments, and significantly reduced the length of the prompt (~72% shorter and cheaper)
Diffstat (limited to 'src/client/views/nodes/ChatBox/tools/GetDocsTool.ts')
-rw-r--r--src/client/views/nodes/ChatBox/tools/GetDocsTool.ts29
1 files changed, 0 insertions, 29 deletions
diff --git a/src/client/views/nodes/ChatBox/tools/GetDocsTool.ts b/src/client/views/nodes/ChatBox/tools/GetDocsTool.ts
deleted file mode 100644
index f970ca8ee..000000000
--- a/src/client/views/nodes/ChatBox/tools/GetDocsTool.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { DocCast } from '../../../../../fields/Types';
-import { DocServer } from '../../../../DocServer';
-import { Docs } from '../../../../documents/Documents';
-import { DocumentView } from '../../DocumentView';
-import { OpenWhere } from '../../OpenWhere';
-import { BaseTool } from './BaseTool';
-
-export class GetDocsTool extends BaseTool<{ title: string; document_ids: string[] }> {
- private _docView: DocumentView;
- constructor(docView: DocumentView) {
- super(
- 'retrieveDocs',
- 'Retrieves the contents of all Documents that the user is interacting with in Dash',
- {},
- 'No need to provide anything. Just run the tool and it will retrieve the contents of all Documents that the user is interacting with in Dash.',
- 'Returns the the documents in Dash in JSON form. This will include the title of the document, the location in the FreeFormDocument, and the content of the document, any applicable data fields, the layout of the document, etc.'
- );
- this._docView = docView;
- }
-
- async execute(args: { title: string; document_ids: string[] }): Promise<any> {
- // Note: Using eval() can be dangerous. Consider using a safer alternative.
- const docs = args.document_ids.map(doc_id => DocCast(DocServer.GetCachedRefField(doc_id)));
- const collection = Docs.Create.FreeformDocument(docs, { title: args.title });
- this._docView._props.addDocTab(collection, OpenWhere.addRight); //in future, create popup prompting user where to add
- return [{ type: 'text', text: 'Collection created in Dash called ' + args.title }];
- }
-}
-//export function create_collection(docView: DocumentView, document_ids: string[], title: string): string {}