diff options
Diffstat (limited to 'src/client/views/nodes/chatbot/tools/CreateAnyDocTool.ts')
-rw-r--r-- | src/client/views/nodes/chatbot/tools/CreateAnyDocTool.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/client/views/nodes/chatbot/tools/CreateAnyDocTool.ts b/src/client/views/nodes/chatbot/tools/CreateAnyDocTool.ts index 5cf858998..ef4bbbc47 100644 --- a/src/client/views/nodes/chatbot/tools/CreateAnyDocTool.ts +++ b/src/client/views/nodes/chatbot/tools/CreateAnyDocTool.ts @@ -6,13 +6,13 @@ import { parsedDoc } from '../chatboxcomponents/ChatBox'; import { ParametersType, ToolInfo } from '../types/tool_types'; import { Observation } from '../types/types'; import { BaseTool } from './BaseTool'; -import { supportedDocumentTypes } from './CreateDocumentTool'; +import { supportedDocTypes } from './CreateDocumentTool'; const standardOptions = ['title', 'backgroundColor']; /** * Description of document options and data field for each type. */ -const documentTypesInfo: { [key in supportedDocumentTypes]: { options: string[]; dataDescription: string } } = { +const documentTypesInfo: { [key in supportedDocTypes]: { options: string[]; dataDescription: string } } = { [supportedDocumentTypes.flashcard]: { options: [...standardOptions, 'fontColor', 'text_align'], dataDescription: 'an array of two strings. the first string contains a question, and the second string contains an answer', @@ -65,9 +65,9 @@ const documentTypesInfo: { [key in supportedDocumentTypes]: { options: string[]; options: standardOptions, dataDescription: 'The message content of the document.', }, - [supportedDocumentTypes.mermaid]: { + [supportedDocumentTypes.diagram]: { options: ['title', 'backgroundColor'], - dataDescription: 'The Mermaid diagram content.', + dataDescription: 'diagram content as a text string in Mermaid format.', }, [supportedDocumentTypes.script]: { options: ['title', 'backgroundColor'], @@ -79,7 +79,7 @@ const createAnyDocumentToolParams = [ { name: 'document_type', type: 'string', - description: `The type of the document to create. Supported types are: ${Object.values(supportedDocumentTypes).join(', ')}`, + description: `The type of the document to create. Supported types are: ${Object.values(supportedDocTypes).join(', ')}`, required: true, }, { @@ -105,7 +105,7 @@ const createAnyDocToolInfo: ToolInfo<CreateAnyDocumentToolParamsType> = { name: 'createAnyDocument', description: `Creates any type of document with the provided options and data. - Supported document types are: ${Object.values(supportedDocumentTypes).join(', ')}. + Supported document types are: ${Object.values(supportedDocTypes).join(', ')}. dataviz is a csv table tool, so for CSVs, use dataviz. Here are the options for each type: <supported_document_types>` + Object.entries(documentTypesInfo) @@ -134,11 +134,11 @@ export class CreateAnyDocumentTool extends BaseTool<CreateAnyDocumentToolParamsT async execute(args: ParametersType<CreateAnyDocumentToolParamsType>): Promise<Observation[]> { try { - const documentType = toLower(args.document_type) as unknown as supportedDocumentTypes; + const documentType = toLower(args.document_type) as unknown as supportedDocTypes; const info = documentTypesInfo[documentType]; if (info === undefined) { - throw new Error(`Unsupported document type: ${documentType}. Supported types are: ${Object.values(supportedDocumentTypes).join(', ')}.`); + throw new Error(`Unsupported document type: ${documentType}. Supported types are: ${Object.values(supportedDocTypes).join(', ')}.`); } if (!args.data) { |