josephrocca / OpenCharacters

Simple little web interface for creating characters and chatting with them. It's basically a single HTML file - no server. Share characters using a link (character data is stored within the URL itself). All chat data is stored in your browser using IndexedDB. Currently supports OpenAI APIs and ~any Hugging Face model.
https://josephrocca.github.io/OpenCharacters
MIT License
367 stars 63 forks source link

openAiApiKey suggestion #4

Closed jonathanchourio closed 1 year ago

jonathanchourio commented 1 year ago

i was trying to set by default the ( let openAiApiKeyOriginal = (await db.misc.get("openAiApiKey"))?.value || "sk---------"; )

but then can not hide the apikey... and every time force the label promp:

let result = await prompt2({ openAiApiKey: { label: "Please create a new OpenAI API key and paste it here. Go to this page to do that. You can change or delete this later by clicking the 'settings' button.", type:"textLine" }, });

im trying to hide the default api key openAiApiKey: {label: "OpenAI API key:", type: "textLine", placeholder: "(optional)",defaultValue: openAiApiKeyOriginal, readOnly: true, hidden: true },

but not works ....woulbe interesting when you set the default apikey value do not force que promp.

its only an suggestion.! Great job! :D

josephrocca commented 1 year ago

I'm not 100% sure whether I understand you properly, but let me take a couple of guesses:

  1. You'd like to hide the API key so it shows asterisks
  2. Have you downloaded the index.html and utils.js, and are trying to run it in your browser, instead of using the github link (https://josephrocca.github.io/OpenCharacters)? If so, that's definitely something that I want to support. The only problem here, is that (IIUC), file:// URLs don't have their own persistent storage. So once you refresh the page, you'll lose all your data (and thus need to enter your API key again). Not 100% sure how to solve this, but it may become easy when this feature reaches browsers: https://github.com/WICG/isolated-web-apps/blob/main/README.md - web bundles are basically "safe exe files for the web" - i.e. bundle a website up into a simple executable file
josephrocca commented 1 year ago

I've written a guide on point 2: https://github.com/josephrocca/OpenCharacters/blob/main/docs/local-setup.md

Please feel free to open another issue if I've misunderstood, or if you run into any troubles.