diff --git a/src/vs/workbench/api/browser/mainThreadChatSessions.ts b/src/vs/workbench/api/browser/mainThreadChatSessions.ts index 0c6041c724b..efbb3782c37 100644 --- a/src/vs/workbench/api/browser/mainThreadChatSessions.ts +++ b/src/vs/workbench/api/browser/mainThreadChatSessions.ts @@ -108,12 +108,13 @@ export class ObservableChatSession extends Disposable implements ChatSession { this.history.length = 0; this.history.push(...sessionContent.history.map((turn: IChatSessionHistoryItemDto) => { if (turn.type === 'request') { - return { type: 'request' as const, prompt: turn.prompt }; + return { type: 'request' as const, prompt: turn.prompt, participant: turn.participant }; } return { type: 'response' as const, - parts: turn.parts.map((part: IChatProgressDto) => revive(part) as IChatProgress) + parts: turn.parts.map((part: IChatProgressDto) => revive(part) as IChatProgress), + participant: turn.participant }; })); diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 113c2222af3..d05959cc904 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -3135,7 +3135,7 @@ export interface MainThreadChatStatusShape { $disposeEntry(id: string): void; } -export type IChatSessionHistoryItemDto = { type: 'request'; prompt: string } | { type: 'response'; parts: IChatProgressDto[] }; +export type IChatSessionHistoryItemDto = { type: 'request'; prompt: string; participant: string } | { type: 'response'; parts: IChatProgressDto[]; participant: string }; export interface ChatSessionDto { id: string; diff --git a/src/vs/workbench/api/common/extHostChatSessions.ts b/src/vs/workbench/api/common/extHostChatSessions.ts index 84219da6c1f..765fef20460 100644 --- a/src/vs/workbench/api/common/extHostChatSessions.ts +++ b/src/vs/workbench/api/common/extHostChatSessions.ts @@ -250,14 +250,15 @@ export class ExtHostChatSessions extends Disposable implements ExtHostChatSessio hasRequestHandler: !!session.requestHandler, history: session.history.map(turn => { if (turn instanceof extHostTypes.ChatRequestTurn) { - return { type: 'request' as const, prompt: turn.prompt }; + return { type: 'request' as const, prompt: turn.prompt, participant: turn.participant }; } else { const responseTurn = turn as extHostTypes.ChatResponseTurn2; const parts = coalesce(responseTurn.response.map(r => typeConvert.ChatResponsePart.from(r, this.commands.converter, sessionDisposables))); return { type: 'response' as const, - parts + parts, + participant: responseTurn.participant }; } }) diff --git a/src/vs/workbench/contrib/chat/common/chatServiceImpl.ts b/src/vs/workbench/contrib/chat/common/chatServiceImpl.ts index 4f1e5eb9ab8..d41a9b7d03f 100644 --- a/src/vs/workbench/contrib/chat/common/chatServiceImpl.ts +++ b/src/vs/workbench/contrib/chat/common/chatServiceImpl.ts @@ -656,11 +656,15 @@ export class ChatService extends Disposable implements IChatService { requestText )] }; + const agent = + message.participant + ? this.chatAgentService.getAgent(message.participant) // TODO(jospicer): Remove and always hardcode? + : this.chatAgentService.getAgent(chatSessionType); lastRequest = model.addRequest(parsedRequest, { variables: [] }, // variableData 0, // attempt undefined, - undefined, // chatAgent - will use default + agent, undefined, // slashCommand undefined, // confirmation undefined, // locationData diff --git a/src/vs/workbench/contrib/chat/common/chatSessionsService.ts b/src/vs/workbench/contrib/chat/common/chatSessionsService.ts index e07ffd17369..d6160d0b03c 100644 --- a/src/vs/workbench/contrib/chat/common/chatSessionsService.ts +++ b/src/vs/workbench/contrib/chat/common/chatSessionsService.ts @@ -43,7 +43,7 @@ export interface IChatSessionItem { }; } -export type IChatSessionHistoryItem = { type: 'request'; prompt: string } | { type: 'response'; parts: IChatProgress[] }; +export type IChatSessionHistoryItem = { type: 'request'; prompt: string; participant: string } | { type: 'response'; parts: IChatProgress[]; participant: string }; export interface ChatSession extends IDisposable { readonly sessionId: string; @@ -61,7 +61,6 @@ export interface ChatSession extends IDisposable { ) => Promise; } - export interface IChatSessionItemProvider { readonly chatSessionType: string; readonly onDidChangeChatSessionItems: Event;