API adoption for chat sample (#963)

This commit is contained in:
Rob Lourens
2024-02-22 02:35:31 +00:00
committed by GitHub
parent be3ef98e19
commit 335dc7d1b6
2 changed files with 9 additions and 17 deletions

View File

@ -68,7 +68,6 @@ export function activate(context: vscode.ExtensionContext) {
const agent = vscode.chat.createChatParticipant('cat', handler);
agent.iconPath = vscode.Uri.joinPath(context.extensionUri, 'cat.jpeg');
agent.description = vscode.l10n.t('Meow! What can I help you with?');
agent.fullName = vscode.l10n.t('Cat');
agent.commandProvider = {
provideCommands(token) {
return [

View File

@ -23,7 +23,7 @@ declare module 'vscode' {
/**
* The name of the chat participant and contributing extension to which this request was directed.
*/
readonly participant: { readonly extensionId: string; readonly participant: string };
readonly participant: { readonly extensionId: string; readonly name: string };
/**
* The name of the {@link ChatCommand command} that was selected for this request.
@ -35,7 +35,7 @@ declare module 'vscode' {
*/
readonly variables: ChatResolvedVariable[];
private constructor(prompt: string, command: string | undefined, variables: ChatResolvedVariable[], participant: { extensionId: string; participant: string });
private constructor(prompt: string, command: string | undefined, variables: ChatResolvedVariable[], participant: { extensionId: string; name: string });
}
/**
@ -56,14 +56,14 @@ declare module 'vscode' {
/**
* The name of the chat participant and contributing extension that this response came from.
*/
readonly participant: { readonly extensionId: string; readonly participant: string };
readonly participant: { readonly extensionId: string; readonly name: string };
/**
* The name of the command that this response came from.
*/
readonly command?: string;
private constructor(response: ReadonlyArray<ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart | ChatResponseCommandButtonPart>, result: ChatResult, participant: { extensionId: string; participant: string });
private constructor(response: ReadonlyArray<ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart | ChatResponseCommandButtonPart>, result: ChatResult, participant: { extensionId: string; name: string });
}
export interface ChatContext {
@ -83,7 +83,7 @@ declare module 'vscode' {
message: string;
/**
* If partial markdown content was sent over the `progress` callback before the response terminated, then this flag
* If partial markdown content was sent over the {@link ChatRequestHandler handler}'s response stream before the response terminated, then this flag
* can be set to true and it will be rendered with incomplete markdown features patched up.
*
* For example, if the response terminated after sending part of a triple-backtick code block, then the editor will
@ -183,8 +183,7 @@ declare module 'vscode' {
* @returns A list of commands. The lack of a result can be signaled by returning `undefined`, `null`, or
* an empty array.
*/
// TODO@API Q: should we provide the current history or last results for extra context?
provideCommands(token: CancellationToken): ProviderResult<ChatCommand[]>;
provideCommands(context: ChatContext, token: CancellationToken): ProviderResult<ChatCommand[]>;
}
/**
@ -240,16 +239,10 @@ declare module 'vscode' {
*/
readonly name: string;
/**
* The full name of this participant.
* TODO@API This is only used for the default participant, but it seems useful, so should we keep it so we can use it in the future?
*/
fullName: string;
/**
* A human-readable description explaining what this participant does.
*/
description: string;
description?: string;
/**
* Icon for the participant shown in UI.
@ -281,7 +274,7 @@ declare module 'vscode' {
followupProvider?: ChatFollowupProvider;
/**
* When the user clicks this participant in `/help`, this text will be submitted to this command
* When the user clicks this participant in `/help`, this text will be submitted to this participant.
*/
sampleRequest?: string;
@ -408,7 +401,7 @@ declare module 'vscode' {
* Push a progress part to this stream. Short-hand for
* `push(new ChatResponseProgressPart(value))`.
*
* @param value
* @param value A progress message
* @returns This stream.
*/
progress(value: string): ChatResponseStream;