chatbot-ui README

The project's README from github.com/mckaywrigley/chatbot-ui. As one markdown file: README.md.

Chatbot UI

The open-source AI chat app for everyone.

Chatbot UI

Demo

View the latest demo here.

Updates

Hey everyone! I've heard your feedback and am working hard on a big update.

Things like simpler deployment, better backend compatibility, and improved mobile layouts are on their way.

Be back soon.

-- Mckay

Official Hosted Version

Use Chatbot UI without having to host it yourself!

Find the official hosted version of Chatbot UI here.

Sponsor

If you find Chatbot UI useful, please consider sponsoring me to support my open-source work :)

Issues

We restrict "Issues" to actual issues related to the codebase.

We're getting excessive amounts of issues that amount to things like feature requests, cloud provider issues, etc.

If you are having issues with things like setup, please refer to the "Help" section in the "Discussions" tab above.

Issues unrelated to the codebase will likely be closed immediately.

Discussions

We highly encourage you to participate in the "Discussions" tab above!

Discussions are a great place to ask questions, share ideas, and get help.

Odds are if you have a question, someone else has the same question.

Legacy Code

Chatbot UI was recently updated to its 2.0 version.

The code for 1.0 can be found on the legacy branch.

Updating

In your terminal at the root of your local Chatbot UI repository, run:

npm run update

If you run a hosted instance you'll also need to run:

npm run db-push

to apply the latest migrations to your live database.

Local Quickstart

Follow these steps to get your own Chatbot UI instance running locally.

You can watch the full video tutorial here.

1. Clone the Repo

git clone https://github.com/mckaywrigley/chatbot-ui.git

2. Install Dependencies

Open a terminal in the root directory of your local Chatbot UI repository and run:

npm install

3. Install Supabase & Run Locally

Why Supabase?

Previously, we used local browser storage to store data. However, this was not a good solution for a few reasons:

We now use Supabase because it's easy to use, it's open-source, it's Postgres, and it has a free tier for hosted instances.

We will support other providers in the future to give you more options.

1. Install Docker

You will need to install Docker to run Supabase locally. You can download it here for free.

2. Install Supabase CLI

MacOS/Linux

brew install supabase/tap/supabase

Windows

scoop bucket add supabase https://github.com/supabase/scoop-bucket.git
scoop install supabase

3. Start Supabase

In your terminal at the root of your local Chatbot UI repository, run:

supabase start

4. Fill in Secrets

1. Environment Variables

In your terminal at the root of your local Chatbot UI repository, run:

cp .env.local.example .env.local

Get the required values by running:

supabase status

Note: Use API URL from supabase status for NEXT_PUBLIC_SUPABASE_URL

Now go to your .env.local file and fill in the values.

If the environment variable is set, it will disable the input in the user settings.

2. SQL Setup

In the 1st migration file supabase/migrations/20240108234540_setup.sql you will need to replace 2 values with the values you got above:

This prevents issues with storage files not being deleted properly.

5. Install Ollama (optional for local models)

Follow the instructions here.

6. Run app locally

In your terminal at the root of your local Chatbot UI repository, run:

npm run chat

Your local instance of Chatbot UI should now be running at http://localhost:3000. Be sure to use a compatible node version (i.e. v18).

You can view your backend GUI at http://localhost:54323/project/default/editor.

Hosted Quickstart

Follow these steps to get your own Chatbot UI instance running in the cloud.

Video tutorial coming soon.

1. Follow Local Quickstart

Repeat steps 1-4 in "Local Quickstart" above.

You will want separate repositories for your local and hosted instances.

Create a new repository for your hosted instance of Chatbot UI on GitHub and push your code to it.

2. Setup Backend with Supabase

1. Create a new project

Go to Supabase and create a new project.

2. Get Project Values

Once you are in the project dashboard, click on the "Project Settings" icon tab on the far bottom left.

Here you will get the values for the following environment variables:

While still in "Settings" click on the "API" text tab on the left.

Here you will get the values for the following environment variables:

3. Configure Auth

Next, click on the "Authentication" icon tab on the far left.

In the text tabs, click on "Providers" and make sure "Email" is enabled.

We recommend turning off "Confirm email" for your own personal instance.

4. Connect to Hosted DB

Open up your repository for your hosted instance of Chatbot UI.

In the 1st migration file supabase/migrations/20240108234540_setup.sql you will need to replace 2 values with the values you got above:

Now, open a terminal in the root directory of your local Chatbot UI repository. We will execute a few commands here.

Login to Supabase by running:

supabase login

Next, link your project by running the following command with the "Project ID" you got above:

supabase link --project-ref <project-id>

Your project should now be linked.

Finally, push your database to Supabase by running:

supabase db push

Your hosted database should now be set up!

3. Setup Frontend with Vercel

Go to Vercel and create a new project.

In the setup page, import your GitHub repository for your hosted instance of Chatbot UI. Within the project Settings, in the "Build & Development Settings" section, switch Framework Preset to "Next.js".

In environment variables, add the following from the values you got above:

You can also add API keys as environment variables.

For the full list of environment variables, refer to the '.env.local.example' file. If the environment variables are set for API keys, it will disable the input in the user settings.

Click "Deploy" and wait for your frontend to deploy.

Once deployed, you should be able to use your hosted instance of Chatbot UI via the URL Vercel gives you.

Contributing

We are working on a guide for contributing.

Contact

Message Mckay on Twitter/X

chatbot-ui (mckaywrigley/chatbot-ui)

Searching Database…

这是什么?一个开源的 AI 聊天网页应用——界面类似 ChatGPT,可以自己部署,并连接不同的 AI 模型。
我必须自己部署吗,还是有官方托管的版本?两种方式都有:官方提供的托管版,不用自己部署就能直接用;也可以在本地或云端运行自己的实例。
我怎么在本地把它跑起来?克隆仓库,运行 npm install,用 Supabase CLI 启动本地 Supabase 套件(需要 Docker),把生成的值填进 .env.local,然后启动开发服务器。
开始之前需要安装哪些东西?Docker 和 Supabase CLI 用于本地后端,还需要一个兼容的 Node 版本(v18)来运行应用;另外要自己准备各家服务商的 API 密钥——或者用 Ollama 跑本地模型,完全不用密钥。
搭建过程轻松吗?并不轻松:步骤比较多——要装 Docker、Supabase CLI,还要修改一个迁移 SQL 文件和环境变量。作者表示更简单的部署方式正在开发中。
只能我自己用,还是别人也能用我的实例?实例通过 Supabase 的邮箱登录提供用户账号;指南建议个人使用时关闭“确认邮件”功能,所以既可以一个人用,也可以多人共用。
我的对话记录存在哪里?聊天记录保存在 Supabase(Postgres)里—— either 你机器上的本地实例,或者你自己的云端项目;这取代了早期把数据存在浏览器里的做法。
我可以和哪些 AI 模型服务商的模型聊天?代码库内置了 OpenAI、Azure OpenAI、Anthropic、Google Gemini 和 Mistral 的客户端 SDK,另外还支持 Ollama 来运行本地模型。
为什么需要 Supabase,而不是直接用浏览器存储?早期版本把聊天记录存在浏览器里,但作者后来改用 Supabase,因为浏览器存储有安全隐患、容量有限,而且多模态场景也受限。
旧的 1.0 版本去哪了?应用已重写为 2.0 版本;原始代码仍然保留在仓库的 legacy 分支上。
我已经装过一次,怎么更新?拉取最新代码,然后运行仓库自带的更新脚本,它会执行数据库迁移并重新生成数据库类型;托管部署还会把迁移推送到线上 Supabase 数据库。
What are similar projects?mike, sim, NextChat, ruflo, LibreChat, brigade, LangBot, G0DM0D3
Size
3.6 MB
Stars
33.3K
Updated
CommitJun 22
Age
3y
Commits · 90 Days