Chrome extension to transform natural language queries into advanced search queries.
Currently supports:
- Gmail
-
Install the extension
-
Go to the extension options
-
Configure the OpenAI API key
-
Press
?
in the search bar to enable the OpenAI mode -
Write your query in natural language
-
Press
Enter
to convert the query into an advanced search query
To exit the OpenAI mode while writting, press Esc
.
-
Clone the repository
-
Install dependencies
npm install
- Build the extension
npm run build
# or npm run watch to build on file changes
-
Go to
chrome://extensions/
in your browser -
Enable developer mode
-
Click on "Load unpacked extension"
-
Select the repository folder
- Create a new file in
src/providers/
with the following structure:
export default class YourProvider {
getName() {
return "The provider name. It will be used to tell OpenAI for which provider the query is intended";
}
getUrl() {
return "A regex pattern to match the provider url";
}
getLogo() {
return 'The path of the provider logo: the image shown in the search bar';
}
getSearchSelector() {
return 'The query selector to find the search bar in the website';
}
getLogoSelector() {
return 'The query selector to find the provider logo in the website';
}
onEnterPressedWhileOpenAIMode(e) {
// Stop the propagation of the original event. Usually, this would work:
// e.preventDefault();
// e.stopPropagation();
// But it may change depending on the provider.
}
pasteContent(e, result) {
// The actions to perform to paste the result in the search bar.
// Some providers may require to dispatch events to simulate user input.
}
}
- Register the provider in
src/providerDetector.js
:
import YourProvider from './providers/YourProvider';
export default class ProviderDetector {
constructor() {
this.providers = [..., YourProvider];
}
...
}
-
Add the provider logo in
src/assets/
-
Add the provider url to the
manifest.json
so the plugin can be loaded in the provider website:
"content_scripts": [
{
"matches": [
"https://twitter.com/*",
"https://*.google.com/*",
"https://*.yourprovider.com/*"
],
"js": ["dist/contentScript.bundle.js"],
"css": ["style.css"]
}
],