but i’m not a coder
Always time to learn! :D
You can download the generator code if you save your own copy of it:
- click "🛠️ edit"
- then "💾 save"
- then "⚙️ settings"
- finally, "download it" on the menu that pops up
That gives you an HTML file which you can simply open with your browser. But likely what you want is to serve it to yourself on localhost. I have a shell script with this:
#!/usr/bin/bash
python3 -m http.server 8000 --bind 127.0.0.1
Which I run from say path/to/folder, which contains the HTML file. So to serve myself the file my_generator.html, I go to http://localhost:8000/my_generator.html.
So OK what you'd have to do then is replace calls to the AI text plugin with calls to your own backend. Now, I can't tell you exactly what to do there because I don't know which generator you're talking about, but if the code is based on the advanced character chat (and I suspect that it is), then you want to be looking for these symbols within the code:
countTokens, a function that gets an approximate token count for a piece of text.idealMaxContextTokens, some number below the total size of your context window.aiTextPlugin/root.aiTextPlugin, ie the call to the model itself.
You'd have to provide your own version of these to handle the rerouting. And then another thing, if you have bits like these on the code:
const aiTextPluginMetaObject = root.aiTextPlugin({getMetaObject:true});
window.countTokens = aiTextPluginMetaObject.countTokens;
window.idealMaxContextTokens = aiTextPluginMetaObject.idealMaxContextTokens;
Then you'd have to remove the aiTextPluginMetaObject, as you're no longer fetching anything from the AI text plugin.
Oh, also (again) I don't know how stuff like the comments or bug report plugins would behave because I honestly haven't tried if they work offline. I don't think they should...
The text embedder (used for lore/memories) would also maybe give you some trouble because it downloads a bunch of JS files while the page loads, and that wouldn't work without an internet connection. Not sure if the dynamic import trick done for the other dependencies (Dexie, marked, and DOMPurify, see here) would be affected by this. Anyway, I'm guessing you'd want to download the code for all those dependencies so that you can still import them without internet.
OK so there's a few hurdles and likely some more that I didn't number; this is just off the top of my head. Never tried self-hosting, my hardware is relatively ancient (less than 1GB of VRAM! XD) but hopefully this rant gives you an idea of what it would take to do what you want to.
Anyway, there are no elephants in this room...
ok, actually, there is one elephant. Conventional wisdom is you're going to have an easier time with a frontend that was developed with local use in mind and compiled to run on your platform, than rewriting a webapp to be entirely locally run.
However, if you need to rewrite a webapp anyway, then yeah, it should be possible.
OK exposition dump over :D cheers!