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

fix(context-agent): add status callbacks back #6479

Open
wants to merge 4 commits into
base: main
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
2 changes: 2 additions & 0 deletions vscode/src/chat/chat-view/handlers/ChatHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export class ChatHandler implements AgentHandler {
{ text: inputText, mentions },
editorState,
chatBuilder,
delegate,
signal
)
if (contextResult.error) {
Expand Down Expand Up @@ -223,6 +224,7 @@ export class ChatHandler implements AgentHandler {
{ text, mentions }: HumanInput,
editorState: SerializedPromptEditorState | null,
_chatBuilder: ChatBuilder,
_delegate: AgentHandlerDelegate,
signal?: AbortSignal
): Promise<{
contextItems?: ContextItem[]
Expand Down
12 changes: 9 additions & 3 deletions vscode/src/chat/chat-view/handlers/DeepCodyHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type { ChatControllerOptions } from '../ChatController'
import type { ContextRetriever } from '../ContextRetriever'
import type { HumanInput } from '../context'
import { ChatHandler } from './ChatHandler'
import type { AgentHandler } from './interfaces'
import type { AgentHandler, AgentHandlerDelegate } from './interfaces'

export class DeepCodyHandler extends ChatHandler implements AgentHandler {
constructor(
Expand All @@ -38,6 +38,7 @@ export class DeepCodyHandler extends ChatHandler implements AgentHandler {
{ text, mentions }: HumanInput,
editorState: SerializedPromptEditorState | null,
chatBuilder: ChatBuilder,
delegate: AgentHandlerDelegate,
signal: AbortSignal
): Promise<{
contextItems?: ContextItem[]
Expand All @@ -49,6 +50,7 @@ export class DeepCodyHandler extends ChatHandler implements AgentHandler {
{ text, mentions },
editorState,
chatBuilder,
delegate,
signal
)
const isEnabled = chatBuilder.getMessages().length < 4
Expand All @@ -66,13 +68,17 @@ export class DeepCodyHandler extends ChatHandler implements AgentHandler {
}

const baseContext = baseContextResult.contextItems ?? []
const codyAgent = new DeepCodyAgent(
const agent = new DeepCodyAgent(
chatBuilder,
this.chatClient,
this.toolProvider.getTools(),
baseContext
)
const agenticContext = await codyAgent.getContext(requestID, signal)
// Use delegate instead of callback
agent.setStatusCallback(model => {
delegate.postMessageInProgress({ speaker: 'assistant', model })
})
const agenticContext = await agent.getContext(requestID, signal)
return { contextItems: [...baseContext, ...agenticContext] }
}
}
Loading