Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] Support external database, for self-hosted version #1573

Closed
jasongitmail opened this issue Mar 14, 2024 · 9 comments · Fixed by #2556 or #2901
Closed

[Request] Support external database, for self-hosted version #1573

jasongitmail opened this issue Mar 14, 2024 · 9 comments · Fixed by #2556 or #2901
Labels
🌠 Feature Request New feature or request | 特性与建议 released
Milestone

Comments

@jasongitmail
Copy link

jasongitmail commented Mar 14, 2024

🥰 Feature Description

Using IndexDB browser storage has a couple limitations:

  1. User's data could get deleted by clearing the browser's site data.
  2. Chat history, agents, settings, etc are not available across devices–e.g. laptop and mobile.

The option to connect a hosted, serverless-compatible database would solve this, e.g.:

VercelSQL (based on NeonDB) & NeonDB (based on Postgres) both support vector embeddings, which would allow for RAG too.

🧐 Proposed Solution

This would require user authentication.

  • For a single-user instance, this could be a Personal Access Token, i.e. a random string defined as an environment variable, that LobeChat prompts the user for once, stores locally in browser storage, and sends with requests to the LobeChat instance to store or retrieve chat history. (probably works for 95% of people)
  • For a multi-user instance, user accounts would be required. (You could define a list of allowed users as an env var comma-concatenated string or similar to prevent public registrations and limit it to just family/friends, or allow anyone to register if not specified. Each account should provide it's own API keys, so you could keep LobeChat's current API key handling and just ask the user enter their API keys on each device that they use.) Update: I see OpenAI key is prompted for during Vercel deployment, so this might need to be done differently, I haven't looked at the code.

This way if the browser's site data is cleared, no chat history or agents are lost and it can be shared across devices; only the API keys would need to be re-entered.

📝 Additional Information

No response

@jasongitmail jasongitmail added the 🌠 Feature Request New feature or request | 特性与建议 label Mar 14, 2024
@lobehubbot
Copy link
Member

👀 @jasongitmail

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

@andrewluetgers
Copy link

this would be nice

@arvinxx arvinxx added this to the LobeChat 1.0 milestone Apr 3, 2024
@julianbrennum
Copy link

Yes, this would be nice. But I don't think it need to be serverless. MongoDB, Postgres etc would be fine. It would also be nice if the "login" interface was the first thing the user was getting if they are not logged in.

@jasongitmail
Copy link
Author

But I don't think it need to be serverless. MongoDB, Postgres etc would be fine.

@julianbrennum The repo suggests Vercel or Docker for hosting currently. While you're correct for those who choose to use Docker for deployment on a regular server, others who use Vercel need a DB that provides an HTTP interface, since serverless hosts can't reliably maintain long-lived connections to a DB. But there are providers of Mongo and Postgres (and others) that meet that requirement (e.g. Neon for Postgres)

@AdamsGH
Copy link

AdamsGH commented May 12, 2024

Yes, this would be nice. But I don't think it need to be serverless. MongoDB, Postgres etc would be fine. It would also be nice if the "login" interface was the first thing the user was getting if they are not logged in.

Fully agree with you, really miss login button and spent some time to find it

@lobehubbot
Copy link
Member

@jasongitmail

This issue is closed, If you have any questions, you can comment and reply.
此问题已经关闭。如果您有任何问题,可以留言并回复。

@arvinxx
Copy link
Contributor

arvinxx commented Jun 18, 2024

Database Server DB Guide:https://lobehub.com/docs/self-hosting/advanced/server-database

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Database Server DB Guide:https://lobehub.com/docs/self-hosting/advanced/server-database

@lobehubbot
Copy link
Member

🎉 This issue has been resolved in version 1.0.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌠 Feature Request New feature or request | 特性与建议 released
Projects
None yet
6 participants