From bd75ec947a446d5f196f77d1a591d534c89aafb9 Mon Sep 17 00:00:00 2001 From: Nestor Qin Date: Sat, 12 Oct 2024 23:11:42 -0400 Subject: [PATCH] feat: rename tools --- src/index.ts | 2 +- src/page/overleaf.ts | 12 ++++++------ src/tool.ts | 28 ++++++++++++++-------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/index.ts b/src/index.ts index 90b74c8..f87efb5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -32,4 +32,4 @@ export const getAvailableTools = () => { console.error("[Web Agent Interface] No tools found for the current page"); }; -export * as Overleaf from './page/overleaf'; \ No newline at end of file +export * as Overleaf from "./page/overleaf"; diff --git a/src/page/overleaf.ts b/src/page/overleaf.ts index 75f1dd9..10099a6 100644 --- a/src/page/overleaf.ts +++ b/src/page/overleaf.ts @@ -80,14 +80,14 @@ export class PageHandler implements IPageHandler { } toolImplementations: Record any> = { - getSelection: this.getSelectionImpl, - replaceSelection: this.replaceSelectionImpl, - appendText: this.appendTextImpl, + getSelectedText: this.getSelectionImpl, + replaceSelectedText: this.replaceSelectionImpl, + appendTextToDocument: this.appendTextImpl, }; } export const availableTools: ToolName[] = [ - "getSelection", - "replaceSelection", - "appendText", + "getSelectedText", + "replaceSelectedText", + "appendTextToDocument", ]; diff --git a/src/tool.ts b/src/tool.ts index 69f619b..6eadd42 100644 --- a/src/tool.ts +++ b/src/tool.ts @@ -1,30 +1,30 @@ const tools: Record = { - getSelection: { - name: "getSelection", + getSelectedText: { + name: "getSelectedText", displayName: "Get Selected Text", description: "Get the user's current selected text content on the document.", schema: { type: "function", function: { - name: "getSelection", + name: "getSelectedText", description: - "getSelection() -> str - Get the user's current selected text content on the document, no parameter is needed.\\n\\n Returns:\\n str: The user's current selected text content on the document.", + "getSelectedText() -> str - Get the user's current selected text content on the document, no parameter is needed.\\n\\n Returns:\\n str: The user's current selected text content on the document.", parameters: { type: "object", properties: {}, required: [] }, }, }, }, - replaceSelection: { - name: "replaceSelection", + replaceSelectedText: { + name: "replaceSelectedText", displayName: "Replace Selected Text", description: "Replace the user's current selected text content on the document with new text content.", schema: { type: "function", function: { - name: "replaceSelection", + name: "replaceSelectedText", description: - "replaceSelection(newText: str) - Replace the user's current selected text content on the document with new text content.\\n\\n Args:\\n newText (str): New text content to replace the user's current selected text content.", + "replaceSelectedText(newText: str) - Replace the user's current selected text content on the document with new text content.\\n\\n Args:\\n newText (str): New text content to replace the user's current selected text content.", parameters: { type: "object", properties: { @@ -35,16 +35,16 @@ const tools: Record = { }, }, }, - appendText: { - name: "appendText", - displayName: "Append New Text", - description: "Add some text content to the end of the document.", + appendTextToDocument: { + name: "appendTextToDocument", + displayName: "Append Text To Document", + description: "Append text content to the end of the document.", schema: { type: "function", function: { - name: "appendText", + name: "appendTextToDocument", description: - "appendText(text: str) - Add some text content to the end of the document.\\n\\n Args:\\n text (str): Text content to be added to the end of the document.", + "appendTextToDocument(text: str) - Add some text content to the end of the document.\\n\\n Args:\\n text (str): Text content to be added to the end of the document.", parameters: { type: "object", properties: {