Skip to content
Closed
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
15 changes: 13 additions & 2 deletions src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1777,8 +1777,19 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
} else if (content.kind === 'markdownContent') {
return this.renderMarkdown(content, templateData, context);
} else if (content.kind === 'references') {
if (isResponseVM(context.element) && context.element.model.request?.modeInfo?.modeId === ChatModeKind.Agent) {
return this.renderNoContent(other => other.kind === content.kind);
if (isResponseVM(context.element)) {
const request = context.element.model.request;
let isAgent = false;
if (request) {
if (request.modeInfo) {
isAgent = request.modeInfo.modeId === ChatModeKind.Agent;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not quite right because you can send a request to a participant while being "in agent mode". I'm going to do a slightly different fix, it's my fault this is messy

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, knew this didn't feel good

} else {
isAgent = this.delegate.currentChatMode() === ChatModeKind.Agent;
}
}
if (isAgent) {
return this.renderNoContent(other => other.kind === content.kind);
}
}
return this.renderContentReferencesListData(content, undefined, context, templateData);
} else if (content.kind === 'codeCitations') {
Expand Down
23 changes: 23 additions & 0 deletions src/vs/workbench/contrib/chat/common/model/chatModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1446,6 +1446,17 @@ export interface ISerializableChatRequestData extends ISerializableChatResponseD
confirmation?: string;
editedFileEvents?: IChatAgentEditedFileEvent[];
modelId?: string;
modeInfo?: ISerializableModeInfo;
}

/**
* Reduced shape of {@link IChatRequestModeInfo} for serialization.
* Only persists fields needed for UI decisions, avoiding large modeInstructions content.
*/
export interface ISerializableModeInfo {
modeId: IChatRequestModeInfo['modeId'];
kind: ChatModeKind | undefined;
isBuiltin: boolean;
}

export interface ISerializableMarkdownInfo {
Expand Down Expand Up @@ -2297,6 +2308,13 @@ export class ChatModel extends Disposable implements IChatModel {
confirmation: raw.confirmation,
editedFileEvents: raw.editedFileEvents,
modelId: raw.modelId,
modeInfo: raw.modeInfo ? {
modeId: raw.modeInfo.modeId,
kind: raw.modeInfo.kind,
isBuiltin: raw.modeInfo.isBuiltin,
modeInstructions: undefined,
applyCodeBlockSuggestionId: undefined,
} : undefined,
});
request.shouldBeRemovedOnSend = raw.isHidden ? { requestId: raw.requestId } : raw.shouldBeRemovedOnSend;
// eslint-disable-next-line @typescript-eslint/no-explicit-any, local/code-no-any-casts
Expand Down Expand Up @@ -2639,6 +2657,11 @@ export class ChatModel extends Disposable implements IChatModel {
confirmation: r.confirmation,
editedFileEvents: r.editedFileEvents,
modelId: r.modelId,
modeInfo: r.modeInfo ? {
modeId: r.modeInfo.modeId,
kind: r.modeInfo.kind,
isBuiltin: r.modeInfo.isBuiltin,
} : undefined,
...r.response?.toJSON(),
};
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const requestSchema = Adapt.object<IChatRequestModel, ISerializableChatRequestDa
shouldBeRemovedOnSend: Adapt.v(m => m.shouldBeRemovedOnSend, objectsEqual),
agent: Adapt.v(m => m.response?.agent, (a, b) => a?.id === b?.id),
modelId: Adapt.v(m => m.modelId),
modeInfo: Adapt.v(m => m.modeInfo ? { modeId: m.modeInfo.modeId, kind: m.modeInfo.kind, isBuiltin: m.modeInfo.isBuiltin } : undefined, objectsEqual),
editedFileEvents: Adapt.t(m => m.editedFileEvents, Adapt.array(agentEditedFileEventSchema)),
variableData: Adapt.t(m => m.variableData, chatVariableSchema),
isHidden: Adapt.v(() => undefined), // deprecated, always undefined for new data
Expand Down
Loading