Skip to content

Commit 77cb447

Browse files
committed
only allow plots tool when there is a session and there are plots
1 parent 10c15ee commit 77cb447

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

extensions/positron-assistant/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,8 @@
357357
"modelDescription": "View the current active plot if one exists. Don't invoke this tool if there are no plots in the session.",
358358
"canBeReferencedInPrompt": false,
359359
"tags": [
360-
"positron-assistant"
360+
"positron-assistant",
361+
"requires-session"
361362
]
362363
},
363364
{
@@ -390,7 +391,8 @@
390391
]
391392
},
392393
"tags": [
393-
"positron-assistant"
394+
"positron-assistant",
395+
"requires-session"
394396
]
395397
},
396398
{

extensions/positron-assistant/src/participants.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,10 @@ abstract class PositronAssistantParticipant implements IPositronAssistantPartici
277277
// TODO: Remove this restriction when the tool is supported in R https://github.com/posit-dev/positron/issues/8343
278278
// The logic above with TOOL_TAG_REQUIRES_ACTIVE_SESSION will handle checking for active sessions once this is removed.
279279
return activeSessions.has('python');
280+
case PositronAssistantToolName.GetPlot:
281+
return positronContext.plots?.hasPlots === true;
282+
// case PositronAssistantToolName.InspectVariables:
283+
// TODO: only allow this tool when there are variables to inspect
280284
// Otherwise, include the tool if it is tagged for use with Positron Assistant.
281285
// Allow all tools in Agent mode.
282286
default:

0 commit comments

Comments
 (0)