From 32bee63b503c468c3b89e00b9668ec191936fc4e Mon Sep 17 00:00:00 2001 From: Mathew Pareles Date: Sun, 23 Mar 2025 22:26:09 -0700 Subject: [PATCH] fix prompting that made void use pathname_search over regular search --- src/vs/workbench/contrib/void/browser/aiRegexService.ts | 4 ++-- .../workbench/contrib/void/browser/chatThreadService.ts | 8 ++++---- .../void/browser/react/src/sidebar-tsx/SidebarChat.tsx | 8 ++++---- src/vs/workbench/contrib/void/browser/toolsService.ts | 6 +++--- src/vs/workbench/contrib/void/common/prompt/prompts.ts | 8 ++++---- src/vs/workbench/contrib/void/common/toolsServiceTypes.ts | 4 ++-- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/vs/workbench/contrib/void/browser/aiRegexService.ts b/src/vs/workbench/contrib/void/browser/aiRegexService.ts index f8b15e56..4e37f99c 100644 --- a/src/vs/workbench/contrib/void/browser/aiRegexService.ts +++ b/src/vs/workbench/contrib/void/browser/aiRegexService.ts @@ -34,7 +34,7 @@ // // const result = await new Promise((res, rej) => { // // sendLLMMessage({ // // messages, -// // tools: ['semantic_search'], +// // tools: ['grep_search'], // // onFinalMessage: ({ result: r, }) => { // // res(r) // // }, @@ -73,7 +73,7 @@ // // const result = new Promise((res, rej) => { // // sendLLMMessage({ // // messages, -// // tools: ['semantic_search'], +// // tools: ['grep_search'], // // onResult: (r) => { // // res(r) // // } diff --git a/src/vs/workbench/contrib/void/browser/chatThreadService.ts b/src/vs/workbench/contrib/void/browser/chatThreadService.ts index 90299f02..ca2f6369 100644 --- a/src/vs/workbench/contrib/void/browser/chatThreadService.ts +++ b/src/vs/workbench/contrib/void/browser/chatThreadService.ts @@ -392,7 +392,7 @@ class ChatThreadService extends Disposable implements IChatThreadService { { role: 'tool', - name: 'semantic_search', + name: 'grep_search', id: 'tool-4', paramsStr: '{"query": "function main"}', content: 'Found matches in 3 files', @@ -408,15 +408,15 @@ class ChatThreadService extends Disposable implements IChatThreadService { hasNextPage: false } }, - } satisfies ToolMessage<'semantic_search'>, + } satisfies ToolMessage<'grep_search'>, // { // role: 'tool_request', - // name: 'semantic_search', + // name: 'grep_search', // params: { queryStr: 'function main', pageNumber: 0 }, // paramsStr: '{"query": "function main"}', // id: 'request-4', - // } satisfies ToolRequestApproval<'semantic_search'>, + // } satisfies ToolRequestApproval<'grep_search'>, // --- diff --git a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx index b99dd266..18a40ac7 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx @@ -1178,7 +1178,7 @@ const titleOfToolName = { 'read_file': { done: 'Read file', proposed: 'Read file', running: loadingTitleWrapper('Reading file') }, 'list_dir': { done: 'Inspected folder', proposed: 'Inspect folder', running: loadingTitleWrapper('Inspecting folder') }, 'pathname_search': { done: 'Searched by file name', proposed: 'Search by file name', running: loadingTitleWrapper('Searching by file name') }, - 'semantic_search': { done: 'Semantic searched', proposed: 'Semantic search', running: loadingTitleWrapper('Searching') }, + 'grep_search': { done: 'Searched', proposed: 'Search', running: loadingTitleWrapper('Searching') }, 'create_uri': { done: (isFolder: boolean) => `Created ${folderFileStr(isFolder)}`, proposed: (isFolder: boolean | null) => isFolder === null ? 'Create URI' : `Create ${folderFileStr(isFolder)}`, @@ -1210,8 +1210,8 @@ const toolNameToDesc = (toolName: ToolName, _toolParams: ToolCallParams[ToolName } else if (toolName === 'pathname_search') { const toolParams = _toolParams as ToolCallParams['pathname_search'] return `"${toolParams.queryStr}"`; - } else if (toolName === 'semantic_search') { - const toolParams = _toolParams as ToolCallParams['semantic_search'] + } else if (toolName === 'grep_search') { + const toolParams = _toolParams as ToolCallParams['grep_search'] return `"${toolParams.queryStr}"`; } else if (toolName === 'create_uri') { const toolParams = _toolParams as ToolCallParams['create_uri'] @@ -1490,7 +1490,7 @@ const toolNameToComponent: { [T in ToolName]: ToolComponent } = { return } }, - 'semantic_search': { + 'grep_search': { requestWrapper: null, resultWrapper: ({ toolMessage }) => { const accessor = useAccessor() diff --git a/src/vs/workbench/contrib/void/browser/toolsService.ts b/src/vs/workbench/contrib/void/browser/toolsService.ts index 7c693d0c..ad773cd0 100644 --- a/src/vs/workbench/contrib/void/browser/toolsService.ts +++ b/src/vs/workbench/contrib/void/browser/toolsService.ts @@ -227,7 +227,7 @@ export class ToolsService implements IToolsService { return { queryStr, pageNumber } }, - semantic_search: async (params: string) => { + grep_search: async (params: string) => { const o = validateJSON(params) const { query: queryUnknown, pageNumber: pageNumberUnknown } = o @@ -314,7 +314,7 @@ export class ToolsService implements IToolsService { return { result: { uris, hasNextPage } } }, - semantic_search: async ({ queryStr, pageNumber }) => { + grep_search: async ({ queryStr, pageNumber }) => { const query = queryBuilder.text({ pattern: queryStr, isRegExp: true, @@ -388,7 +388,7 @@ export class ToolsService implements IToolsService { pathname_search: (params, result) => { return result.uris.map(uri => uri.fsPath).join('\n') + nextPageStr(result.hasNextPage) }, - semantic_search: (params, result) => { + grep_search: (params, result) => { return result.uris.map(uri => uri.fsPath).join('\n') + nextPageStr(result.hasNextPage) }, // --- diff --git a/src/vs/workbench/contrib/void/common/prompt/prompts.ts b/src/vs/workbench/contrib/void/common/prompt/prompts.ts index dbe123f5..29ac971a 100644 --- a/src/vs/workbench/contrib/void/common/prompt/prompts.ts +++ b/src/vs/workbench/contrib/void/common/prompt/prompts.ts @@ -69,16 +69,16 @@ export const voidTools = { pathname_search: { name: 'pathname_search', - description: `Returns all pathnames that match a given grep query. You should use this when looking for a file with a specific name or path. This does NOT search file content. ${paginationHelper.desc}`, + description: `Returns all pathnames that match a given \`find\`-style query (searches ONLY file names). You should use this when looking for a file with a specific name or path. ${paginationHelper.desc}`, params: { query: { type: 'string', description: undefined }, ...paginationHelper.param, }, }, - semantic_search: { - name: 'semantic_search', - description: `Returns pathnames of files with an exact match of the query. The query can be any regex. This does NOT search pathname. As a follow-up, you may want to use read_file to view the full file contents of the results. ${paginationHelper.desc}`, + grep_search: { + name: 'grep_search', + description: `Returns all pathnames that match a given \`grep\`-style query (searches ONLY file contents). The query can be any regex. This is often followed by the \`read_file\` tool to view the full file contents of results. ${paginationHelper.desc}`, params: { query: { type: 'string', description: undefined }, ...paginationHelper.param, diff --git a/src/vs/workbench/contrib/void/common/toolsServiceTypes.ts b/src/vs/workbench/contrib/void/common/toolsServiceTypes.ts index e7315718..90d34311 100644 --- a/src/vs/workbench/contrib/void/common/toolsServiceTypes.ts +++ b/src/vs/workbench/contrib/void/common/toolsServiceTypes.ts @@ -44,7 +44,7 @@ export type ToolCallParams = { 'read_file': { uri: URI, pageNumber: number }, 'list_dir': { rootURI: URI, pageNumber: number }, 'pathname_search': { queryStr: string, pageNumber: number }, - 'semantic_search': { queryStr: string, pageNumber: number }, + 'grep_search': { queryStr: string, pageNumber: number }, // --- 'edit': { uri: URI, changeDescription: string }, 'create_uri': { uri: URI, isFolder: boolean }, @@ -57,7 +57,7 @@ export type ToolResultType = { 'read_file': { fileContents: string, hasNextPage: boolean }, 'list_dir': { children: ToolDirectoryItem[] | null, hasNextPage: boolean, hasPrevPage: boolean, itemsRemaining: number }, 'pathname_search': { uris: URI[], hasNextPage: boolean }, - 'semantic_search': { uris: URI[], hasNextPage: boolean }, + 'grep_search': { uris: URI[], hasNextPage: boolean }, // --- 'edit': Promise, 'create_uri': {},