text_search

This commit is contained in:
Andrew Pareles 2025-03-18 04:56:59 -07:00
parent b9405a76cd
commit 86fddaa0e0
4 changed files with 15 additions and 15 deletions

View file

@ -34,7 +34,7 @@
// // const result = await new Promise((res, rej) => {
// // sendLLMMessage({
// // messages,
// // tools: ['search'],
// // tools: ['text_search'],
// // onFinalMessage: ({ result: r, }) => {
// // res(r)
// // },
@ -73,7 +73,7 @@
// // const result = new Promise((res, rej) => {
// // sendLLMMessage({
// // messages,
// // tools: ['search'],
// // tools: ['text_search'],
// // onResult: (r) => {
// // res(r)
// // }

View file

@ -324,7 +324,7 @@ class ChatThreadService extends Disposable implements IChatThreadService {
{
role: 'tool',
name: 'search',
name: 'text_search',
id: 'tool-4',
paramsStr: '{"query": "function main"}',
content: 'Found matches in 3 files',
@ -340,15 +340,15 @@ class ChatThreadService extends Disposable implements IChatThreadService {
hasNextPage: false
}
},
} satisfies ToolMessage<'search'>,
} satisfies ToolMessage<'text_search'>,
// {
// role: 'tool_request',
// name: 'search',
// name: 'text_search',
// params: { queryStr: 'function main', pageNumber: 0 },
// paramsStr: '{"query": "function main"}',
// id: 'request-4',
// } satisfies ToolRequestApproval<'search'>,
// } satisfies ToolRequestApproval<'text_search'>,
// ---

View file

@ -1100,7 +1100,7 @@ const toolNameToTitle = {
'read_file': { past: 'Read file', proposed: 'Read file' },
'list_dir': { past: 'Inspected folder', proposed: 'Inspect folder' },
'pathname_search': { past: 'Searched by file name', proposed: 'Search by file name' },
'search': { past: 'Searched', proposed: 'Search' },
'text_search': { past: 'Searched', proposed: 'Search text' },
'create_uri': { past: (isFolder: boolean) => `Created ${folderFileStr(isFolder)}`, proposed: (isFolder: boolean) => `Create ${folderFileStr(isFolder)}` },
'delete_uri': { past: (isFolder: boolean) => `Deleted ${folderFileStr(isFolder)}`, proposed: (isFolder: boolean) => `Delete ${folderFileStr(isFolder)}` },
'edit': { past: 'Edited file', proposed: 'Edit file' },
@ -1122,8 +1122,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 === 'search') {
const toolParams = _toolParams as ToolCallParams['search']
} else if (toolName === 'text_search') {
const toolParams = _toolParams as ToolCallParams['text_search']
return `"${toolParams.queryStr}"`;
} else if (toolName === 'create_uri') {
const toolParams = _toolParams as ToolCallParams['create_uri']
@ -1380,7 +1380,7 @@ const toolNameToComponent: { [T in ToolName]: {
return <ToolHeaderWrapper {...componentParams} />
}
},
'search': {
'text_search': {
requestWrapper: null,
resultWrapper: ({ toolMessage }) => {
const accessor = useAccessor()
@ -1881,7 +1881,7 @@ export const SidebarChat = () => {
>
<VoidInputBox2
className={`min-h-[81px] px-0.5 py-0.5`}
placeholder={`${keybindingString ? `${keybindingString} to select. ` : ''}Enter instructions...`}
placeholder={`${keybindingString ? `${keybindingString} to add a file. ` : ''}Enter instructions...`}
onChangeText={onChangeText}
onKeyDown={onKeyDown}
onFocus={() => { chatThreadsService.setCurrentlyFocusedMessageIdx(undefined) }}

View file

@ -69,8 +69,8 @@ export const voidTools = {
required: ['query'],
},
search: {
name: 'search',
text_search: {
name: 'text_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}`,
params: {
query: { type: 'string', description: undefined },
@ -145,7 +145,7 @@ export type ToolCallParams = {
'read_file': { uri: URI, pageNumber: number },
'list_dir': { rootURI: URI, pageNumber: number },
'pathname_search': { queryStr: string, pageNumber: number },
'search': { queryStr: string, pageNumber: number },
'text_search': { queryStr: string, pageNumber: number },
// ---
'edit': { uri: URI, changeDescription: string },
'create_uri': { uri: URI, isFolder: boolean },
@ -158,7 +158,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 },
'search': { uris: URI[], hasNextPage: boolean },
'text_search': { uris: URI[], hasNextPage: boolean },
// ---
'edit': {},
'create_uri': {},