Tune is a Chrome Extension that lets the user choose the 'volume' of the conversation they wish to read. It uses the Perspective API to score comments, and lets the user specify what kinds types of comments they would like to see less of. To help improve the machine learning behind the API, the user can also provide feedback, and send suggested corrections.
Creating new credentials
The extension needs credentials to score comments with Perspective API.
manifest_creds_template.json file to
edit it. Replace the
key fields with the appropriate values.
See the Chrome documentation
for how to set this up. The
client_id typically looks like
Note that the Google Cloud project associated with the extension will need to have Perspective API enabled (see the first 2 steps from the Perspective API quickstart guide for how to enable the API for your Cloud project).
npm install then
npm run build to build a development version of the
extension. The build artifacts will be stored in the
You can install the extension from Chrome's extensions page
chrome://extensions/: click on the "Load Unpacked", and
select the directory
Note: to build a working extension, you'll need to have a correctly configured
manifest_creds_dev.json file from either the previous step, or a copy of the
There are 4 build targets:
- The popup (chrome extension UI). This is an Angular project.
- Background script.
- Content script (the DOM modifying script injected onto sites).
- Custom elements script. This is an Angular project script with custom angular elements to use in DOM manipulation. It is built with angular devkit as an app and then the output js files are injected into the document like the content script.
Unit tests and linting
npm test to execute the unit tests via
npm lint to lint.
This is not an official Google product; it is example code to illustrate how to develop a Chrome extension that uses the Perspective API.