I have just posted this on the Airtable forum, but wanted to share more weeds with you here - maybe you find it useful for your projects.
I have been playing recently with Chrome extensions ( I regret it ) and OpenAI (definitely potential) . I have just released a Chrome extension, which adds formula suggestions based on ChatGPT API - directly to the formula editor in Airtable.
You can see the green “Hint GPT” button next to “Save”:
Obviously you are all versed with formulas. I have been testing it myself and a few times it was easier for me to type what I want, rather than write formulas. Not that often, but I am actually surprised. The original idea came to me when I wanted to change a super long nested IF statement to SWITCH - it certainly works well for tedious tasks like that.
On other hand sometimes the formula suggestions are just hilariously wrong or wishful thinking. Like suggestions to use
IS_EMAIL() formula to validate emails
The technical weeds
The extension code is available MIT on my Github here (or you can download for free complied code here)
If you would be looking to build Chrome extension working with Airtable, you can take a look at above repo as there are a few interesting things:
- I did implement encapsulated elements on top of Airtable using Tailwind (via shadow DOM and twind.style) - this way you can implement your own Tailwind styles without crashing with Airtable stylesheets
- Airtable has a crazy level of DOM event capture - for example the “Backspace” key does not work… outside of editing fields. As per code comment it is blocked to prevent “Back” function on older browsers… I needed to deactivate those listeners to allow editing of my Setting fields
- Similarly the click events are captured in the way that simple e.preventDefault() won’t stop Airtable from doing its default behaviors in the background. I needed to use jQuery to disable it, so that I can show Settings modal on top of Airtable
- There is a lot of jQuery on Airtable page
- The OpenAI implemention is trivial, I am using both ChatGPT and GPT completions - the results are fairly similar, with main difference that OpenAI charges 10x less for the ChatGPT API usage. The chat completions end up sometimes in long didactic rants, despite pre-conditioning to the contrary.
- The formula editor is using Monaco editor - simplified version of what VS Code is using. It is possible to set / get data in and out of it, just like this extension is doing it. What I would really like is Coplilot like code completion inside of scripting block… but maybe another day…
- The main div holding the cells is called “hyperbaseContainer” I wonder if “Hyperbase” was an alternative in the naming contest years ago
Here you can also take a look at my video of how the extension works in action (or doesn’t - I think jobwise we are all safe).
Let me know what you think! Forks or contribution to the repo more than welcome!