Skip to content

Commit

Permalink
Add a setting to disable telemetry (#14)
Browse files Browse the repository at this point in the history
This adds a new `enableTelemetry` boolean JupyterLab setting that is checked before sending a POST call to `prompt/<id>/acceptance`.
The default value is `true`.
  • Loading branch information
ajbozarth authored Nov 5, 2024
1 parent 84ceea3 commit 98d89d5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
5 changes: 5 additions & 0 deletions GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ There are a few settings we recommend to edit in your user settings.
4. Keyboard shortcuts can be changed by searching for `completer` in the Keyboard Shortcuts
settings and adding new shortcuts for the relevant commands.

5. Telemetry can be disabled by unchecking the `enableTelemetry` setting.

> **NOTE**: The telemetry does not collect your code nor the suggested code completions.
> What is collected is whether a code suggestion was accepted or dismissed.
## Troubleshooting

If you are seeing the frontend extension, but it is not working, check that the server
Expand Down
5 changes: 5 additions & 0 deletions README-PyPi.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ There are a few settings we recommend to edit in your user settings.
4. Keyboard shortcuts can be changed by searching for `completer` in the Keyboard Shortcuts
settings and adding new shortcuts for the relevant commands.

5. Telemetry can be disabled by unchecking the `enableTelemetry` setting.

> **NOTE**: The telemetry does not collect your code nor the suggested code completions.
> What is collected is whether a code suggestion was accepted or dismissed.
## Terms of use

- [End User License Agreement (EULA)](/~https://github.com/Qiskit/qiskit-code-assistant-jupyterlab/blob/main/docs/EULA.md) acceptance required before starting to use the model acceptance required before starting to use the model
Expand Down
6 changes: 6 additions & 0 deletions schema/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
"description": "Whether to fetch completions for QiskitCodeAssistant:completer",
"type": "boolean",
"default": true
},
"enableTelemetry": {
"title": "Enable Telemetry",
"description": "Send telemetry to the Qiskit Code Assistant Service",
"type": "boolean",
"default": true
}
},
"additionalProperties": false
Expand Down
13 changes: 9 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,17 @@ const plugin: JupyterFrontEndPlugin<void> = {
category: 'Qiskit Code Assistant'
});

completionProviderManager.selected.connect((completer, selection) =>
provider.accept(selection.insertText)
);
completionProviderManager.selected.connect((completer, selection) => {
if (settings.composite['enableTelemetry'] as boolean) {
provider.accept(selection.insertText);
}
});

app.commands.commandExecuted.connect((registry, executed) => {
if (executed.id === CommandIDs.acceptInline) {
if (
executed.id === CommandIDs.acceptInline &&
(settings.composite['enableTelemetry'] as boolean)
) {
inlineProvider.accept();
}
});
Expand Down

0 comments on commit 98d89d5

Please sign in to comment.