mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
rm id and add tool_use_id
This commit is contained in:
parent
93c0bb1d04
commit
75ef9d5528
5 changed files with 35 additions and 20 deletions
|
|
@ -769,8 +769,6 @@ export class AutocompleteService extends Disposable implements IAutocompleteServ
|
|||
|
||||
|
||||
|
||||
// console.log('B')
|
||||
|
||||
// create a new autocompletion and add it to cache
|
||||
const newAutocompletion: Autocompletion = {
|
||||
id: this._autocompletionId++,
|
||||
|
|
|
|||
|
|
@ -547,9 +547,9 @@ class ChatThreadService extends Disposable implements IChatThreadService {
|
|||
if (llmCancelToken === null) break
|
||||
this._setStreamState(threadId, { streamingToken: llmCancelToken })
|
||||
|
||||
console.log('awaiting agentloop')
|
||||
console.log('awaiting agentloop...')
|
||||
await awaitable
|
||||
console.log('done')
|
||||
console.log('done with agentloop!')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1231,7 +1231,9 @@ const toolNameToComponent: { [T in ToolName]: {
|
|||
const { params } = toolRequest
|
||||
return <DropdownComponent title={title} desc1={getBasename(params.uri.fsPath)} icon={<Dot className={`stroke-orange-500`} />}
|
||||
onClick={() => { commandService.executeCommand('vscode.open', params.uri, { preview: true }) }}
|
||||
/>
|
||||
>
|
||||
<ChatMarkdownRender string={params.changeDescription} />
|
||||
</DropdownComponent>
|
||||
},
|
||||
resultWrapper: ({ toolMessage }) => {
|
||||
const accessor = useAccessor()
|
||||
|
|
@ -1392,6 +1394,9 @@ export const SidebarChat = () => {
|
|||
|
||||
// send message to LLM
|
||||
const userMessage = textAreaRef.current?.value ?? ''
|
||||
|
||||
// getModelCapabilities() // TODO!!! check if can go into agent mode
|
||||
|
||||
await chatThreadsService.addUserMessageAndStreamResponse({ userMessage, chatMode: 'agent' })
|
||||
|
||||
setSelections([]) // clear staging
|
||||
|
|
|
|||
|
|
@ -376,6 +376,7 @@ export class ToolsService implements IToolsService {
|
|||
const uri = validateURI(uriStr)
|
||||
const changeDescription = validateStr('changeDescription', changeDescriptionUnknown)
|
||||
|
||||
console.log('done validating!!!')
|
||||
return { uri, changeDescription }
|
||||
},
|
||||
|
||||
|
|
@ -453,8 +454,6 @@ export class ToolsService implements IToolsService {
|
|||
from: 'ClickApply',
|
||||
type: 'searchReplace',
|
||||
}) ?? []
|
||||
console.log('B')
|
||||
|
||||
await p
|
||||
return {}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -166,8 +166,7 @@ type PrepareMessagesToolsOpenAI = (
|
|||
}[]
|
||||
} | {
|
||||
role: 'tool',
|
||||
id: string; // old val
|
||||
tool_call_id: string; // new val
|
||||
tool_call_id: string;
|
||||
content: string;
|
||||
}
|
||||
)[]
|
||||
|
|
@ -199,9 +198,8 @@ const prepareMessages_tools_openai = ({ messages }: { messages: InternalLLMChatM
|
|||
// add the tool
|
||||
newMessages.push({
|
||||
role: 'tool',
|
||||
id: currMsg.id,
|
||||
content: currMsg.content || EMPTY_TOOL_CONTENT,
|
||||
tool_call_id: currMsg.id,
|
||||
content: currMsg.content || EMPTY_TOOL_CONTENT,
|
||||
})
|
||||
}
|
||||
return { messages: newMessages }
|
||||
|
|
@ -344,16 +342,31 @@ const prepareMessages_anthropicContent = ({ messages, supportsAnthropicReasoning
|
|||
const prepareMessages_noEmptyMessage = ({ messages }: { messages: PrepareMessagesTools }): { messages: PrepareMessagesTools } => {
|
||||
for (const currMsg of messages) {
|
||||
|
||||
if (currMsg.role === 'assistant' || currMsg.role === 'user') {
|
||||
if (typeof currMsg.content === 'string') {
|
||||
currMsg.content = currMsg.content || EMPTY_MESSAGE
|
||||
// don't do this for tools
|
||||
if (currMsg.role === 'tool') continue
|
||||
|
||||
// don't do this for assistant or user messages that have tool_calls or tool_results
|
||||
const oai = currMsg as PrepareMessagesToolsOpenAI[0]
|
||||
if (oai.role === 'assistant') {
|
||||
if (oai.tool_calls) continue
|
||||
}
|
||||
const anth = currMsg as PrepareMessagesToolsAnthropic[0]
|
||||
if (anth.role === 'assistant' || anth.role === 'user') {
|
||||
if (typeof anth.content !== 'string') {
|
||||
const hasContent = anth.content.find(c => c.type === 'tool_use' || c.type === 'tool_result')
|
||||
if (hasContent) continue
|
||||
}
|
||||
else {
|
||||
for (const c of currMsg.content) {
|
||||
if (c.type === 'text') c.text = c.text || EMPTY_MESSAGE
|
||||
else if (c.type === 'tool_use') { }
|
||||
else if (c.type === 'tool_result') { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (typeof currMsg.content === 'string') {
|
||||
currMsg.content = currMsg.content || EMPTY_MESSAGE
|
||||
}
|
||||
else {
|
||||
for (const c of currMsg.content) {
|
||||
if (c.type === 'text') c.text = c.text || EMPTY_MESSAGE
|
||||
else if (c.type === 'tool_use') { }
|
||||
else if (c.type === 'tool_result') { }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue