mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
fix prompting that made void use pathname_search over regular search
This commit is contained in:
parent
4798bbdc86
commit
32bee63b50
6 changed files with 19 additions and 19 deletions
|
|
@ -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)
|
||||
// // }
|
||||
|
|
|
|||
|
|
@ -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'>,
|
||||
|
||||
// ---
|
||||
|
||||
|
|
|
|||
|
|
@ -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<T> } = {
|
|||
return <ToolHeaderWrapper {...componentParams} />
|
||||
}
|
||||
},
|
||||
'semantic_search': {
|
||||
'grep_search': {
|
||||
requestWrapper: null,
|
||||
resultWrapper: ({ toolMessage }) => {
|
||||
const accessor = useAccessor()
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
},
|
||||
// ---
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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<void>,
|
||||
'create_uri': {},
|
||||
|
|
|
|||
Loading…
Reference in a new issue