Skip to content

Commit 4b7bb4d

Browse files
authored
Merge pull request microsoft#210350 from microsoft/roblou/worried-termite
Chat API tweaks and /help fixes
2 parents 6f91cdc + bdf19f9 commit 4b7bb4d

File tree

3 files changed

+17
-28
lines changed

3 files changed

+17
-28
lines changed

src/vs/workbench/api/common/extHostChatAgents2.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,6 @@ class ExtHostChatAgent {
405405
private _helpTextPrefix: string | vscode.MarkdownString | undefined;
406406
private _helpTextVariablesPrefix: string | vscode.MarkdownString | undefined;
407407
private _helpTextPostfix: string | vscode.MarkdownString | undefined;
408-
private _sampleRequest?: string;
409408
private _isSecondary: boolean | undefined;
410409
private _onDidReceiveFeedback = new Emitter<vscode.ChatResultFeedback>();
411410
private _onDidPerformAction = new Emitter<vscode.ChatUserActionEvent>();
@@ -510,7 +509,6 @@ class ExtHostChatAgent {
510509
helpTextPrefix: (!this._helpTextPrefix || typeof this._helpTextPrefix === 'string') ? this._helpTextPrefix : typeConvert.MarkdownString.from(this._helpTextPrefix),
511510
helpTextVariablesPrefix: (!this._helpTextVariablesPrefix || typeof this._helpTextVariablesPrefix === 'string') ? this._helpTextVariablesPrefix : typeConvert.MarkdownString.from(this._helpTextVariablesPrefix),
512511
helpTextPostfix: (!this._helpTextPostfix || typeof this._helpTextPostfix === 'string') ? this._helpTextPostfix : typeConvert.MarkdownString.from(this._helpTextPostfix),
513-
sampleRequest: this._sampleRequest,
514512
supportIssueReporting: this._supportIssueReporting,
515513
requester: this._requester
516514
});
@@ -598,13 +596,6 @@ class ExtHostChatAgent {
598596
that._isSecondary = v;
599597
updateMetadataSoon();
600598
},
601-
get sampleRequest() {
602-
return that._sampleRequest;
603-
},
604-
set sampleRequest(v) {
605-
that._sampleRequest = v;
606-
updateMetadataSoon();
607-
},
608599
get supportIssueReporting() {
609600
checkProposedApiEnabled(that.extension, 'chatParticipantAdditions');
610601
return that._supportIssueReporting;

src/vs/workbench/contrib/chat/browser/chat.contribution.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,15 +265,18 @@ class ChatSlashStaticSlashCommandsContribution extends Disposable {
265265
// Report agent list
266266
const agentText = (await Promise.all(agents
267267
.filter(a => a.id !== defaultAgent?.id)
268+
.filter(a => a.locations.includes(ChatAgentLocation.Panel))
268269
.map(async a => {
269270
const agentWithLeader = `${chatAgentLeader}${a.name}`;
270271
const actionArg: IChatExecuteActionContext = { inputValue: `${agentWithLeader} ${a.metadata.sampleRequest}` };
271272
const urlSafeArg = encodeURIComponent(JSON.stringify(actionArg));
272-
const agentLine = `* [\`${agentWithLeader}\`](command:${SubmitAction.ID}?${urlSafeArg}) - ${a.description}`;
273+
const description = a.description ? `- ${a.description}` : '';
274+
const agentLine = `* [\`${agentWithLeader}\`](command:${SubmitAction.ID}?${urlSafeArg}) ${description}`;
273275
const commandText = a.slashCommands.map(c => {
274276
const actionArg: IChatExecuteActionContext = { inputValue: `${agentWithLeader} ${chatSubcommandLeader}${c.name} ${c.sampleRequest ?? ''}` };
275277
const urlSafeArg = encodeURIComponent(JSON.stringify(actionArg));
276-
return `\t* [\`${chatSubcommandLeader}${c.name}\`](command:${SubmitAction.ID}?${urlSafeArg}) - ${c.description}`;
278+
const description = c.description ? `- ${c.description}` : '';
279+
return `\t* [\`${chatSubcommandLeader}${c.name}\`](command:${SubmitAction.ID}?${urlSafeArg}) ${description}`;
277280
}).join('\n');
278281

279282
return (agentLine + '\n' + commandText).trim();

src/vscode-dts/vscode.proposed.chatParticipant.d.ts

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ declare module 'vscode' {
99
* Represents a user request in chat history.
1010
*/
1111
export class ChatRequestTurn {
12-
1312
/**
1413
* The prompt as entered by the user.
1514
*
@@ -21,7 +20,7 @@ declare module 'vscode' {
2120
readonly prompt: string;
2221

2322
/**
24-
* The id of the chat participant and contributing extension to which this request was directed.
23+
* The id of the chat participant to which this request was directed.
2524
*/
2625
readonly participant: string;
2726

@@ -32,6 +31,7 @@ declare module 'vscode' {
3231

3332
/**
3433
* The variables that were referenced in this message.
34+
* TODO@API ensure that this will be compatible with future changes to chat variables.
3535
*/
3636
readonly variables: ChatResolvedVariable[];
3737

@@ -42,9 +42,8 @@ declare module 'vscode' {
4242
* Represents a chat participant's response in chat history.
4343
*/
4444
export class ChatResponseTurn {
45-
4645
/**
47-
* The content that was received from the chat participant. Only the stream parts that represent actual content (not metadata) are represented.
46+
* The content that was received from the chat participant. Only the stream parts that represent actual content (not metadata) are represented.
4847
*/
4948
readonly response: ReadonlyArray<ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart | ChatResponseCommandButtonPart>;
5049

@@ -54,7 +53,7 @@ declare module 'vscode' {
5453
readonly result: ChatResult;
5554

5655
/**
57-
* The id of the chat participant and contributing extension that this response came from.
56+
* The id of the chat participant that this response came from.
5857
*/
5958
readonly participant: string;
6059

@@ -132,8 +131,8 @@ declare module 'vscode' {
132131
*/
133132
export interface ChatResultFeedback {
134133
/**
135-
* The ChatResult that the user is providing feedback for.
136-
* This instance has the same properties as the result returned from the participant callback, including `metadata`, but is not the same instance.
134+
* The ChatResult for which the user is providing feedback.
135+
* This object has the same properties as the result returned from the participant callback, including `metadata`, but is not the same instance.
137136
*/
138137
readonly result: ChatResult;
139138

@@ -175,7 +174,7 @@ declare module 'vscode' {
175174
export interface ChatFollowupProvider {
176175
/**
177176
* Provide followups for the given result.
178-
* @param result This instance has the same properties as the result returned from the participant callback, including `metadata`, but is not the same instance.
177+
* @param result This object has the same properties as the result returned from the participant callback, including `metadata`, but is not the same instance.
179178
* @param token A cancellation token.
180179
*/
181180
provideFollowups(result: ChatResult, context: ChatContext, token: CancellationToken): ProviderResult<ChatFollowup[]>;
@@ -197,7 +196,7 @@ declare module 'vscode' {
197196
readonly id: string;
198197

199198
/**
200-
* Icon for the participant shown in UI.
199+
* An icon for the participant shown in UI.
201200
*/
202201
iconPath?: Uri | {
203202
/**
@@ -220,11 +219,6 @@ declare module 'vscode' {
220219
*/
221220
followupProvider?: ChatFollowupProvider;
222221

223-
/**
224-
* When the user clicks this participant in `/help`, this text will be submitted to this participant.
225-
*/
226-
sampleRequest?: string;
227-
228222
/**
229223
* An event that fires whenever feedback for a result is received, e.g. when a user up- or down-votes
230224
* a result.
@@ -293,9 +287,7 @@ declare module 'vscode' {
293287
* in the prompt. That means the last variable in the prompt is the first in this list. This simplifies
294288
* string-manipulation of the prompt.
295289
*/
296-
// TODO@API Q? are there implicit variables that are not part of the prompt?
297290
readonly variables: readonly ChatResolvedVariable[];
298-
299291
}
300292

301293
/**
@@ -373,8 +365,11 @@ declare module 'vscode' {
373365
}
374366

375367
export class ChatResponseMarkdownPart {
376-
/** Note: The boolean form of {@link MarkdownString.isTrusted} is NOT supported. */
377368
value: MarkdownString;
369+
370+
/**
371+
* @param value Note: The boolean form of {@link MarkdownString.isTrusted} is NOT supported.
372+
*/
378373
constructor(value: string | MarkdownString);
379374
}
380375

0 commit comments

Comments
 (0)