Skip to content

Commit

Permalink
feat: rename tools
Browse files Browse the repository at this point in the history
  • Loading branch information
Neet-Nestor committed Oct 13, 2024
1 parent dacd6b6 commit bd75ec9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
export * as Overleaf from "./page/overleaf";
12 changes: 6 additions & 6 deletions src/page/overleaf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ export class PageHandler implements IPageHandler {
}

toolImplementations: Record<ToolName, (...args: any[]) => 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",
];
28 changes: 14 additions & 14 deletions src/tool.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
const tools: Record<string, ToolInfo> = {
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: {
Expand All @@ -35,16 +35,16 @@ const tools: Record<string, ToolInfo> = {
},
},
},
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: {
Expand Down

0 comments on commit bd75ec9

Please sign in to comment.