mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
text_search
This commit is contained in:
parent
b9405a76cd
commit
86fddaa0e0
4 changed files with 15 additions and 15 deletions
|
|
@ -34,7 +34,7 @@
|
||||||
// // const result = await new Promise((res, rej) => {
|
// // const result = await new Promise((res, rej) => {
|
||||||
// // sendLLMMessage({
|
// // sendLLMMessage({
|
||||||
// // messages,
|
// // messages,
|
||||||
// // tools: ['search'],
|
// // tools: ['text_search'],
|
||||||
// // onFinalMessage: ({ result: r, }) => {
|
// // onFinalMessage: ({ result: r, }) => {
|
||||||
// // res(r)
|
// // res(r)
|
||||||
// // },
|
// // },
|
||||||
|
|
@ -73,7 +73,7 @@
|
||||||
// // const result = new Promise((res, rej) => {
|
// // const result = new Promise((res, rej) => {
|
||||||
// // sendLLMMessage({
|
// // sendLLMMessage({
|
||||||
// // messages,
|
// // messages,
|
||||||
// // tools: ['search'],
|
// // tools: ['text_search'],
|
||||||
// // onResult: (r) => {
|
// // onResult: (r) => {
|
||||||
// // res(r)
|
// // res(r)
|
||||||
// // }
|
// // }
|
||||||
|
|
|
||||||
|
|
@ -324,7 +324,7 @@ class ChatThreadService extends Disposable implements IChatThreadService {
|
||||||
|
|
||||||
{
|
{
|
||||||
role: 'tool',
|
role: 'tool',
|
||||||
name: 'search',
|
name: 'text_search',
|
||||||
id: 'tool-4',
|
id: 'tool-4',
|
||||||
paramsStr: '{"query": "function main"}',
|
paramsStr: '{"query": "function main"}',
|
||||||
content: 'Found matches in 3 files',
|
content: 'Found matches in 3 files',
|
||||||
|
|
@ -340,15 +340,15 @@ class ChatThreadService extends Disposable implements IChatThreadService {
|
||||||
hasNextPage: false
|
hasNextPage: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
} satisfies ToolMessage<'search'>,
|
} satisfies ToolMessage<'text_search'>,
|
||||||
|
|
||||||
// {
|
// {
|
||||||
// role: 'tool_request',
|
// role: 'tool_request',
|
||||||
// name: 'search',
|
// name: 'text_search',
|
||||||
// params: { queryStr: 'function main', pageNumber: 0 },
|
// params: { queryStr: 'function main', pageNumber: 0 },
|
||||||
// paramsStr: '{"query": "function main"}',
|
// paramsStr: '{"query": "function main"}',
|
||||||
// id: 'request-4',
|
// id: 'request-4',
|
||||||
// } satisfies ToolRequestApproval<'search'>,
|
// } satisfies ToolRequestApproval<'text_search'>,
|
||||||
|
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1100,7 +1100,7 @@ const toolNameToTitle = {
|
||||||
'read_file': { past: 'Read file', proposed: 'Read file' },
|
'read_file': { past: 'Read file', proposed: 'Read file' },
|
||||||
'list_dir': { past: 'Inspected folder', proposed: 'Inspect folder' },
|
'list_dir': { past: 'Inspected folder', proposed: 'Inspect folder' },
|
||||||
'pathname_search': { past: 'Searched by file name', proposed: 'Search by file name' },
|
'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)}` },
|
'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)}` },
|
'delete_uri': { past: (isFolder: boolean) => `Deleted ${folderFileStr(isFolder)}`, proposed: (isFolder: boolean) => `Delete ${folderFileStr(isFolder)}` },
|
||||||
'edit': { past: 'Edited file', proposed: 'Edit file' },
|
'edit': { past: 'Edited file', proposed: 'Edit file' },
|
||||||
|
|
@ -1122,8 +1122,8 @@ const toolNameToDesc = (toolName: ToolName, _toolParams: ToolCallParams[ToolName
|
||||||
} else if (toolName === 'pathname_search') {
|
} else if (toolName === 'pathname_search') {
|
||||||
const toolParams = _toolParams as ToolCallParams['pathname_search']
|
const toolParams = _toolParams as ToolCallParams['pathname_search']
|
||||||
return `"${toolParams.queryStr}"`;
|
return `"${toolParams.queryStr}"`;
|
||||||
} else if (toolName === 'search') {
|
} else if (toolName === 'text_search') {
|
||||||
const toolParams = _toolParams as ToolCallParams['search']
|
const toolParams = _toolParams as ToolCallParams['text_search']
|
||||||
return `"${toolParams.queryStr}"`;
|
return `"${toolParams.queryStr}"`;
|
||||||
} else if (toolName === 'create_uri') {
|
} else if (toolName === 'create_uri') {
|
||||||
const toolParams = _toolParams as ToolCallParams['create_uri']
|
const toolParams = _toolParams as ToolCallParams['create_uri']
|
||||||
|
|
@ -1380,7 +1380,7 @@ const toolNameToComponent: { [T in ToolName]: {
|
||||||
return <ToolHeaderWrapper {...componentParams} />
|
return <ToolHeaderWrapper {...componentParams} />
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'search': {
|
'text_search': {
|
||||||
requestWrapper: null,
|
requestWrapper: null,
|
||||||
resultWrapper: ({ toolMessage }) => {
|
resultWrapper: ({ toolMessage }) => {
|
||||||
const accessor = useAccessor()
|
const accessor = useAccessor()
|
||||||
|
|
@ -1881,7 +1881,7 @@ export const SidebarChat = () => {
|
||||||
>
|
>
|
||||||
<VoidInputBox2
|
<VoidInputBox2
|
||||||
className={`min-h-[81px] px-0.5 py-0.5`}
|
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}
|
onChangeText={onChangeText}
|
||||||
onKeyDown={onKeyDown}
|
onKeyDown={onKeyDown}
|
||||||
onFocus={() => { chatThreadsService.setCurrentlyFocusedMessageIdx(undefined) }}
|
onFocus={() => { chatThreadsService.setCurrentlyFocusedMessageIdx(undefined) }}
|
||||||
|
|
|
||||||
|
|
@ -69,8 +69,8 @@ export const voidTools = {
|
||||||
required: ['query'],
|
required: ['query'],
|
||||||
},
|
},
|
||||||
|
|
||||||
search: {
|
text_search: {
|
||||||
name: '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}`,
|
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: {
|
params: {
|
||||||
query: { type: 'string', description: undefined },
|
query: { type: 'string', description: undefined },
|
||||||
|
|
@ -145,7 +145,7 @@ export type ToolCallParams = {
|
||||||
'read_file': { uri: URI, pageNumber: number },
|
'read_file': { uri: URI, pageNumber: number },
|
||||||
'list_dir': { rootURI: URI, pageNumber: number },
|
'list_dir': { rootURI: URI, pageNumber: number },
|
||||||
'pathname_search': { queryStr: string, pageNumber: number },
|
'pathname_search': { queryStr: string, pageNumber: number },
|
||||||
'search': { queryStr: string, pageNumber: number },
|
'text_search': { queryStr: string, pageNumber: number },
|
||||||
// ---
|
// ---
|
||||||
'edit': { uri: URI, changeDescription: string },
|
'edit': { uri: URI, changeDescription: string },
|
||||||
'create_uri': { uri: URI, isFolder: boolean },
|
'create_uri': { uri: URI, isFolder: boolean },
|
||||||
|
|
@ -158,7 +158,7 @@ export type ToolResultType = {
|
||||||
'read_file': { fileContents: string, hasNextPage: boolean },
|
'read_file': { fileContents: string, hasNextPage: boolean },
|
||||||
'list_dir': { children: ToolDirectoryItem[] | null, hasNextPage: boolean, hasPrevPage: boolean, itemsRemaining: number },
|
'list_dir': { children: ToolDirectoryItem[] | null, hasNextPage: boolean, hasPrevPage: boolean, itemsRemaining: number },
|
||||||
'pathname_search': { uris: URI[], hasNextPage: boolean },
|
'pathname_search': { uris: URI[], hasNextPage: boolean },
|
||||||
'search': { uris: URI[], hasNextPage: boolean },
|
'text_search': { uris: URI[], hasNextPage: boolean },
|
||||||
// ---
|
// ---
|
||||||
'edit': {},
|
'edit': {},
|
||||||
'create_uri': {},
|
'create_uri': {},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue