Skip to content

Commit 5a6d587

Browse files
authored
Provide summary of code to be executed (#7748)
Quick change to replace the generic "Run in Console" label with a short summary generated by the model. <img width="291" alt="image" src="https://github.com/user-attachments/assets/9a939cbe-974a-49d0-8a8e-e870680dd7ba" /> Addresses #7746.
1 parent ec3e413 commit 5a6d587

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

extensions/positron-assistant/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@
182182
"language": {
183183
"type": "string",
184184
"description": "The programming language of the code."
185+
},
186+
"summary": {
187+
"type": "string",
188+
"description": "A very short summary of the task the code is performing, beginning with a verb and not to exceed 7 words. Shown to the user to help them understand what the code will do."
185189
}
186190
}
187191
},

extensions/positron-assistant/src/tools.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,11 @@ export function registerAssistantTools(
122122

123123
context.subscriptions.push(selectionEditTool);
124124

125-
const executeCodeTool = vscode.lm.registerTool<{ code: string; language: string }>(PositronAssistantToolName.ExecuteCode, {
125+
const executeCodeTool = vscode.lm.registerTool<{
126+
code: string;
127+
language: string;
128+
summary: string;
129+
}>(PositronAssistantToolName.ExecuteCode, {
126130
/**
127131
* Called by Positron to prepare for tool invocation. We use this hook
128132
* to show the user the code that we are about to run, and ask for
@@ -145,7 +149,7 @@ export function registerAssistantTools(
145149

146150
/// The message shown to confirm that the user wants to run the code.
147151
confirmationMessages: {
148-
title: vscode.l10n.t('Run in Console'),
152+
title: options.input.summary ?? vscode.l10n.t('Run in Console'),
149153
message: ''
150154
},
151155
};

0 commit comments

Comments
 (0)