iansinnott / prompta

ChatGPT UI that is keyboard-centric, mobile friendly, and searchable.
https://chat.prompta.dev
MIT License
154 stars 13 forks source link

There was an error initializing the database. Please try again. If the problem persists, please report it on GitHub.sqlite3_open_v2 #10

Closed Brikas closed 9 months ago

Brikas commented 10 months ago

It used to work fine, but now everytime I open it, I get this error THere was an error initializing the database. Please try again. If the problem persists, please report it on GitHub.sqlite3_open_v2

I saw another issues opened, but it did not work for me as I am on Windows.

I tried reinstalling, did not help.

Brikas commented 10 months ago

Update on the issue: I was using the https://chat.prompta.dev/ web version yesterday and it worked fine. Today I was chatting to it a bit about Flutter and it broke again.

It broke just before trying to output a code snippet. The response stream started and it froze as it was writing a codeblock. The GUI would not die, but I would not be able to interact with it. After restarting, I got the same error in my browser.

It could be that storing a specific code in the database breaks it. But not all code. As I was using it for CSS and HTML without any problems. After cleaning site data on Chrome, the error disappeared, yet I have lost all of my chats and had to re-enter API key.

P.S. How can I wipe my local database of chats (on Windows, non browser)?

iansinnott commented 10 months ago

5

iansinnott commented 10 months ago

Hm, thanks for further details @Brikas. Being unable to store some specific data would explain why it's hard to reproduce this issue.

Also good to know that it repros in browser as well as the Tauri app. So you're using the windows desktop app?

iansinnott commented 10 months ago

As you saw wiping the database does indeed fix the issue, for some definition of fix. It removes all data irrevocably. The backing database is sqlite compiled to wasm running on top of indexeddb, which means the usual remedies for a corrupt sqlite database don't apply.

Perhaps an option in the app to forcibly clear the database would be useful. This would at least give people a way to restore usability. Also an ongoing backup for the chats.

I've been a bit hesitant to change anything about the database layer b/c I'd like to rewrite it to use OPFS-backed sqlite. Either way an automatic backup of chat history would be helpful.

Brikas commented 10 months ago

Personally, I am not worried about my chats, nothing too valuable is stored. It's just annoying to keep reentering the API key and losing context of the current conversation.

I have been using Prompta on the browser this evening a lot and I got the error a few more times. Every time I wiped all website data and continued chatting from scratch.

My updated observation is that it seems to be stuck at random times, not always before outputting Dart code, but code is always present in my chats (cause that's what I use it for), so not 100% if specific data is causing the issue.

However, if you can give me a guide on how can I save the current database of my chats to a file, I can send the file for analysis to you the next time this error happens. @iansinnott And yes, I was using the Windows app when I originally posted the issue, but I can no longer use it, since I don't know how to delete the database to fix the issue. I am using it on the browser now.

iansinnott commented 10 months ago

@Brikas if you click the COMMAND button in the lower right and open settings there is an option to export your data.

Settings > Show Advanced > Export All

I'll add an option to clear the database from within the app and put the api key in local storage instead of the database. This way at least the API key doesn't have to be re-added every time.

edit: Although, you cannot currently export the database once it's broken. So the export feature might only be useful for preemptively backing up your questions if you care to.

iansinnott commented 10 months ago

Added a database reset option in v2: https://github.com/iansinnott/prompta/releases/tag/v2.0.0

iansinnott commented 10 months ago

Likely relevant: https://github.com/vlcn-io/js/issues/31

Brikas commented 10 months ago

It happens consistently now, independent of the type of topic (code, no-code), and yes, the database reset fixes it, but I am starting to realize that saving my chats is quite nice. @iansinnott are you still working on this project? If not, do you know any alternative solutions, that use OpenAI API and provide a chatbot interface that highlights code well, does not have graphic glitches, like Prompta, but also does not require resetting the database every time?

iansinnott commented 10 months ago

@Brikas this is an active project, but the issue is upstream in the wa-sqlite dependency. This is since been fixed in wa-sqlite itself, but Prompta uses wa-sqlite via VLCN (as linked above. https://github.com/vlcn-io/js/issues/31). Once VLCN releases a new version I will update Prompta. I expect it will be fairly soon—the author is quite active and already responded in that thread—but I don't know when that will be.

iansinnott commented 9 months ago

Updated in v3: https://github.com/iansinnott/prompta/releases/tag/v3.0.0

Brikas commented 9 months ago

@iansinnott Thank you so much! It has been working great so far. It is my favorite interface for using GPT4 :)

iansinnott commented 9 months ago

Thanks for letting me know @Brikas, glad you're enjoying it :)