the code for this has some spaghettiness to it, but here it is for fun anyway, a bot that watches you type in the Glitch editor and edits with you.
and I don’t mean that it programs with you, it’s only an experiment to show how to interact with the live collaboration system, “OT.” here it’s set up so that when you type a comment starting with > , it’ll repeat the comment, starting with < , in uppercase.
As you are working on your bots, let me know what roadblocks you hit, what API endpoints would help you succeed, what kind of bots you’d like to build for the Glitch editor, etc. I think this is super interesting work and love the idea of community-built bots on here!
do I fix conversations wiping when you stop bot.js? and also probably make a README.md on how to use it
this is an awesome project, it’ll make MY work easier that’s for sure.
EDIT: There’s some documentation on how to use it now and I’m making it easier to use by the minute
For those trying to work with this: Your user token is in your cachedUser object inside localStorage, as your persistentToken value. This is neccesary to create the connection to your project. The rest I handle- including getting the project ID, you just have to give the username. Should work with private ones too since I pass in your user token at that point.
Heyyyy! I spent a good few hours working on this and I want to die.
It’s done now though! Go check it out, it’s somewhat easy to integrate now (and once you’ve done it, you can just keep the tab open to integrate ChatGPT with your project)
yo @wh0 you know more than me about this, can you help? I tried to add whitespace support but it sometimes replaces in the wrong spot (I do put in the whitespace length to avoid that but it seems to not be working)
it also has ChatGPT support if you want to test that too
Worked like a charm! A few changes and now it actually respects whitespace. You probably saw the dirty patch I made to fix an indentation issue near the bottom
offsets in your indentation in .html / .svelte cause issues with the bot. trying to figure out the offset generation as we speak but it’s painful
So far I’ve figured out the offsets to make the line appear right BUT now we have the issue of broken bits after, I’m removing part of my code to see if it helps
EDIT: for some reason Glitch injects a SINGLE SPACE whenever the .html offset issue happens. no more auto new lines to mitigate. please tell me if this is the right way to do this
oh it’s better not to use start or end like that after sending the first transaction. every time you await there could have been other edits made that shift things around. you can rely on the transactions to be up to date
the relative offset in [0] looks right, for bringing you to just before the “C” in “Contacting”
the splice length in [1] looks one too many, as Contacting ChatGPT... is 21 characters. you have no guarantees what comes outside the transaction’s splices, so it’s not safe to do 22 there.
edit:
and that if thing that comes later shouldn’t trigger, as long as there are no concurrent edits going on. does it?
it does, the .html offset issue causes it to flip (end no longer equals the value returned in unsubmittedTx2 and that new value breaks things, hence the offset fix