forward participant information from chat sessions history (#263448)

forward participant information in chat sessions history
This commit is contained in:
Josh Spicer
2025-08-26 11:37:41 -07:00
committed by GitHub
parent d2ff8d1606
commit e7ae2cc2e1
5 changed files with 13 additions and 8 deletions
@@ -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
};
}));
@@ -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;
@@ -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
};
}
})
@@ -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
@@ -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<void>;
}
export interface IChatSessionItemProvider {
readonly chatSessionType: string;
readonly onDidChangeChatSessionItems: Event<void>;