Skip to content
Merged
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
5 changes: 3 additions & 2 deletions src/vs/workbench/api/browser/mainThreadChatSessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,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
};
}));

Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHost.protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions src/vs/workbench/api/common/extHostChatSessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,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
};
}
})
Expand Down
6 changes: 5 additions & 1 deletion src/vs/workbench/contrib/chat/common/chatServiceImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/vs/workbench/contrib/chat/common/chatSessionsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,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;
Expand All @@ -65,7 +65,6 @@ export interface ChatSession extends IDisposable {
) => Promise<void>;
}


export interface IChatSessionItemProvider {
readonly chatSessionType: string;
readonly onDidChangeChatSessionItems: Event<void>;
Expand Down
Loading