diff options
author | A.J. Shulman <Shulman.aj@gmail.com> | 2024-10-20 15:01:14 -0400 |
---|---|---|
committer | A.J. Shulman <Shulman.aj@gmail.com> | 2024-10-20 15:01:14 -0400 |
commit | cd43a88affe04634045a1fcbce7123c10141ec8c (patch) | |
tree | ffc5b1f604b6731411c86cd8df1f703b9e8b41f9 /src/client/views/nodes/chatbot/tools/CreateTextDocumentTool.ts | |
parent | c933ae724c1bf77fa8bd83c3c9e27d0029ef5cb0 (diff) |
changed to generic addLinkedDoc
Diffstat (limited to 'src/client/views/nodes/chatbot/tools/CreateTextDocumentTool.ts')
-rw-r--r-- | src/client/views/nodes/chatbot/tools/CreateTextDocumentTool.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/client/views/nodes/chatbot/tools/CreateTextDocumentTool.ts b/src/client/views/nodes/chatbot/tools/CreateTextDocumentTool.ts index fa978bdc3..fae78aa49 100644 --- a/src/client/views/nodes/chatbot/tools/CreateTextDocumentTool.ts +++ b/src/client/views/nodes/chatbot/tools/CreateTextDocumentTool.ts @@ -2,8 +2,9 @@ import { v4 as uuidv4 } from 'uuid'; import { Networking } from '../../../../Network'; import { BaseTool } from './BaseTool'; import { Observation } from '../types/types'; -import { ParametersType } from './ToolTypes'; +import { ParametersType } from '../types/tool_types'; import { DocumentOptions } from '../../../../documents/Documents'; +import { RTFCast, StrCast } from '../../../../../fields/Types'; const createTextDocToolParams = [ { @@ -35,9 +36,9 @@ const createTextDocToolParams = [ type CreateTextDocToolParamsType = typeof createTextDocToolParams; export class CreateTextDocTool extends BaseTool<CreateTextDocToolParamsType> { - private _addLinkedTextDoc: (text_content: string, options: DocumentOptions, id: string) => void; + private _addLinkedDoc: (doc_type: string, data: string, options: DocumentOptions, id: string) => void; - constructor(addLinkedTextDoc: (text_content: string, options: DocumentOptions, id: string) => void) { + constructor(addLinkedDoc: (text_content: string, data: string, options: DocumentOptions, id: string) => void) { super( 'createTextDoc', 'Creates a text document with the provided content and title (and of specified other options if wanted)', @@ -45,12 +46,13 @@ export class CreateTextDocTool extends BaseTool<CreateTextDocToolParamsType> { 'Provide the text content and title (and optionally color) for the document.', 'Creates a text document with the provided content and title (and of specified other options if wanted). Use if the user wants to create a textbox or text document of some sort. Can use after a search or other tool to save information.' ); - this._addLinkedTextDoc = addLinkedTextDoc; + this._addLinkedDoc = addLinkedDoc; } async execute(args: ParametersType<CreateTextDocToolParamsType>): Promise<Observation[]> { try { - this._addLinkedTextDoc(args.text_content, { title: args.title, backgroundColor: args.background_color, text_fontColor: args.font_color }, uuidv4()); + console.log(RTFCast(args.text_content)); + this._addLinkedDoc('text', args.text_content, { title: args.title, backgroundColor: args.background_color, text_fontColor: args.font_color }, uuidv4()); return [{ type: 'text', text: 'Created text document.' }]; } catch (error) { return [{ type: 'text', text: 'Error creating text document, ' + error }]; |