fitchmultz / chat-with-gpt

An open-source ChatGPT web interface with local API key storage, support for multiple users, chat history, model selection, token settings, and more.
https://github.com/fitchmultz/chat-with-gpt
MIT License
9 stars 1 forks source link

Error: SQLITE_CANTOPEN: unable to open database file #37

Open gogo9th opened 2 months ago

gogo9th commented 2 months ago

Hi,

I wonder how I can get around this error:

:Desktop/chat-with-gpt$ sudo docker run -v $(pwd)/data:/app/data -p 3000:3000 ghcr.io/fitchmultz/chat-with-gpt:latest

> chat-with-gpt@0.2.3 start
> npx ts-node --logError src/index.ts

Configuring Passport.
[Error: SQLITE_CANTOPEN: unable to open database file] {
  errno: 14,
  code: 'SQLITE_CANTOPEN'
}
gogo9th commented 2 months ago

I manually ran the server by doing this:


cd app 
npm install
npm build
cd ../server
npm install
cp ../app/build public -r
npm run start

The server runs okay, but my API key does not work:

**I'm sorry, I'm having trouble connecting to OpenAI (no response from the API). Please make sure you've entered your OpenAI API key correctly and try again.**

My API key works for OpenAI's official tutorial of using it in Python:

# export OPEN_AI_KEY="My Key"

from openai import OpenAI
client = OpenAI()

completion = client.chat.completions.create(
  model="gpt-4-turbo",
  messages=[
    {"role": "system", "content": "You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."},
    {"role": "user", "content": "Why are companies blocking ChatGPT?"}
  ]
)

print(completion.choices[0].message)

Maybe the API you are using is deprecated?

fitchmultz commented 2 months ago

Are you still having this issue? Everything is functioning on my end but I'll see what I can do. I updated the openai package this week. I just ran the docker run command on my Macbook and didn't see any errors and my prompts are working in my Chrome browser.

docker run -v $(pwd)/data:/app/data -p 3000:3000 ghcr.io/fitchmultz/chat-with-gpt:latest

gogo9th commented 2 months ago

In Ubuntu 22.04, I still get the same error:

image

gogo9th commented 2 months ago

You can ssh-log in and check: root qwerzxcvqwer

fitchmultz commented 2 months ago

Unless your Ubuntu system is accessible via Public IP I won't be able to ssh in. I have an Ubuntu VM I will test on.

It looks like you're trying to run this in /root/chat-with-gpt; does the directory /root/chat-with-gpt/data exist? If not, create the data directory mkdir /root/chat-with-gpt/data and then try running the docker run command again.

If it still fails, what's the output of ls -al /root/chat-with-gpt and ls -al /root/chat-with-gpt/data?

I will test on Ubuntu and get back to you.

gogo9th commented 2 months ago

Sorry, my ip is 143.198.77.28. You can ssh here.

I have the data directory, but still does not work..

fitchmultz commented 2 months ago

Run the following command in the /root/chat-with-gpt directory, and try running the container again. I think it has something to do with running the container as root but this should fix it for now.

sudo chmod -R 777 $(pwd)/data

gogo9th commented 2 months ago

How it is working, thanks a lot. However, one small issue is that my network has a firewall and it blocks all OpenAI connections. But even if I run your docker on a remote VM and access the VM's website from my fire-walled domain, it blocks any responses from ChatGPT. Is it because the ChatGPT connections are created between my local machine and the remote server, not between the VM and the remote server? If so, is there any way I could enforce the connection to be routed through the VM's website?

gogo9th commented 1 month ago

Another question I have is that could you add the feature such that Latex math syntax is visually pretty-printed?

fitchmultz commented 1 month ago

Katex math was working at some point so I must have broken something when updating a package. Can you post a screenshot of an example where it is broken? That'll help me get it sorted out.

gogo9th commented 1 month ago

Here is the screenshot:

image

Also, I wonder if you could add the feature of :

  1. Changing the user's password
  2. Keeping the screen to where it is while GPT is still printing the answer (instead of auto-scrolling down), because I cannot read what I am reading if it keeps scrolling down.

Thanks.

fitchmultz commented 1 month ago

I've looked into the math formatting issue and can't seem to figure it out just yet.

In the settings panel, under UI, uncheck the auto scroll while generating a response option and the screen will stay in place while generating.