Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mostly refactors on bee/toolcody #7341

Open
wants to merge 5 commits into
base: bee/toolcody
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 31 additions & 10 deletions vscode/src/chat/chat-view/ChatController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -731,13 +731,24 @@ export class ChatController implements vscode.Disposable, vscode.WebviewViewProv

this.chatBuilder.setSelectedModel(model)

const chatAgent = model.includes(DeepCodyAgentID)
? DeepCodyAgentID
: model.includes(ToolCodyModelName)
? ToolCodyModelRef
: manuallySelectedIntent === 'agentic' || model.includes('agentic')
? 'agentic'
: undefined
function getChatAgent(
model: string,
manuallySelectedIntent: string | null | undefined
): string | undefined {
if (model.includes(DeepCodyAgentID)) {
return DeepCodyAgentID
}
if (model.includes(ToolCodyModelName)) {
return ToolCodyModelRef
}
const AGENTIC_KEYWORD = 'agentic'
if (manuallySelectedIntent === AGENTIC_KEYWORD || model.includes(AGENTIC_KEYWORD)) {
return AGENTIC_KEYWORD
}
return undefined
}

const chatAgent = getChatAgent(model, manuallySelectedIntent)

const recorder = await OmniboxTelemetry.create({
requestID,
Expand All @@ -756,9 +767,19 @@ export class ChatController implements vscode.Disposable, vscode.WebviewViewProv

this.postEmptyMessageInProgress(model)

const agentName = ['search', 'edit', 'insert', 'agentic'].includes(manuallySelectedIntent ?? '')
? (manuallySelectedIntent as string)
: chatAgent ?? 'chat'
function getAgentName(
manuallySelectedIntent: ChatMessage['intent'] | undefined | null,
chatAgent: string | undefined
): string {
const selectedIntentOrEmptyString = manuallySelectedIntent ?? ''
if (['search', 'edit', 'insert', 'agentic'].includes(selectedIntentOrEmptyString)) {
return manuallySelectedIntent as string
}
return chatAgent ?? 'chat'
}

const agentName = getAgentName(manuallySelectedIntent, chatAgent)

const agent = getAgent(agentName, model, {
contextRetriever: this.contextRetriever,
editor: this.editor,
Expand Down
2 changes: 1 addition & 1 deletion vscode/src/chat/chat-view/handlers/ChatHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export class ChatHandler implements AgentHandler {
}
}

// TODO: Maybe we should replace computerContext with computeAgenticContext?
// TODO: Maybe we should replace computeContext with computeAgenticContext?
public async computeAgenticContext(
requestID: string,
{ text, mentions }: HumanInput,
Expand Down
13 changes: 7 additions & 6 deletions vscode/src/chat/tools/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,25 @@ export function getToolBlock(contentBlock: ToolUseBlockParam): string {
? 'Creating'
: 'Editing'
} File`,
text: `File: ${input.path}
${input.old_str ? `Old: "${input.old_str}"\nNew: "${input.new_str}"` : ''}`,
text: `Editing File: ${input.path}\n${
input.old_str ? `Old: "${input.old_str}"\nNew: "${input.new_str}"` : ''
}`,
}),
get_diagnostic: (input: GetDiagnosticInput) => ({
title: 'Scanning Diagnostics',
text: `File: ${input.name}`,
text: `Getting Diagnostics for: ${input.name}`,
}),
code_search: (input: CodeSearchInput) => ({
title: 'Searching Codebase',
text: `Query: ${input.query}`,
}),
get_file: (input: GetFileInput) => ({
title: 'Retrieving File',
text: `File: ${input.name}`,
text: `Retrieving File: ${input.name}`,
}),
run_terminal_command: (input: RunTerminalCommandInput) => ({
title: 'Executing Terminal_Command',
text: `Command: ${input.command}`,
title: 'Executing Terminal Command',
text: `Executing Command: ${input.command}`,
}),
}

Expand Down
Loading