mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-04-27 16:55:44 +08:00
Merge pull request #965 from microsoft/isidorn/interior-cheetah
Chat Agent Sample -> Chat Sample
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
# Chat Agent Example
|
||||
# Chat Example
|
||||
|
||||
This sample shows
|
||||
|
||||
- How to contribute a chat agent.
|
||||
- How to contribute a chat participant.
|
||||
- How to use the chatRequestAccess API to request access to the chat.
|
||||
- How to respond with follow-ups.
|
||||
|
||||
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "chat-agent-sample",
|
||||
"name": "chat-sample",
|
||||
"version": "0.1.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "chat-agent-sample",
|
||||
"name": "chat-sample",
|
||||
"version": "0.1.0",
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.5.9",
|
||||
@ -15,7 +15,7 @@
|
||||
"typescript": "^4.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"vscode": "^1.84.0"
|
||||
"vscode": "^1.86.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@aashutoshrathi/word-wrap": {
|
||||
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "chat-agent-sample",
|
||||
"name": "chat-sample",
|
||||
"publisher": "vscode-samples",
|
||||
"displayName": "Copilot Chat Sample Agent",
|
||||
"description": "Sample chat agent extension, a trusty cat that will help you with your code.",
|
||||
"displayName": "Copilot Chat Sample",
|
||||
"description": "Sample chat extension, a trusty cat that will help you with your code.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Microsoft/vscode-extension-samples"
|
||||
@ -12,7 +12,7 @@ const LANGUAGE_MODEL_ID = 'copilot-gpt-4';
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
// Define a Cat chat agent handler.
|
||||
// Define a Cat chat handler.
|
||||
const handler: vscode.ChatRequestHandler = async (request: vscode.ChatRequest, context: vscode.ChatContext, stream: vscode.ChatResponseStream, token: vscode.CancellationToken): Promise<ICatChatResult> => {
|
||||
// To talk to an LLM in your subcommand handler implementation, your
|
||||
// extension can use VS Code's `requestChatAccess` API to access the Copilot API.
|
||||
@ -66,13 +66,13 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
}
|
||||
};
|
||||
|
||||
// Agents appear as top-level options in the chat input
|
||||
// Chat participants appear as top-level options in the chat input
|
||||
// when you type `@`, and can contribute sub-commands in the chat input
|
||||
// that appear when you type `/`.
|
||||
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.commandProvider = {
|
||||
const cat = vscode.chat.createChatParticipant('cat', handler);
|
||||
cat.iconPath = vscode.Uri.joinPath(context.extensionUri, 'cat.jpeg');
|
||||
cat.description = vscode.l10n.t('Meow! What can I help you with?');
|
||||
cat.commandProvider = {
|
||||
provideCommands(token) {
|
||||
return [
|
||||
{ name: 'teach', description: 'Pick at random a computer science concept then explain it in purfect way of a cat' },
|
||||
@ -81,7 +81,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
}
|
||||
};
|
||||
|
||||
agent.followupProvider = {
|
||||
cat.followupProvider = {
|
||||
provideFollowups(result: ICatChatResult, token: vscode.CancellationToken) {
|
||||
return [{
|
||||
prompt: 'let us play',
|
||||
@ -114,7 +114,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
});
|
||||
|
||||
context.subscriptions.push(
|
||||
agent,
|
||||
cat,
|
||||
// Register the command handler for the /meow followup
|
||||
vscode.commands.registerCommand(MEOW_COMMAND_ID, async () => {
|
||||
vscode.window.showInformationMessage('Meow!');
|
||||
Reference in New Issue
Block a user