Linux(宝塔) 部署chatbot-ui

0 阅读1分钟

仓库地址:github.com/mckaywrigle…

一台海外服务器

4核8g,8mbps最低配置

系统Ubuntu24.04

怎么区分这台海外服务器能不能用

curl https://api.anthropic.com/v1/messages \
  -H "x-api-key: 填你自己克劳德的key,但这里最是测试这太服务器能不能用,随便写个无所谓" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-3-5-sonnet-20241022",
    "max_tokens": 1,
    "messages": [
      {"role": "user", "content": "hi"}
    ]
  }'
{
  "error": {
    "type": "forbidden",
    "message": "Request not allowed"
  }
}
这种全部是被国内城墙挡住了
{
	"type": "error",
	"error": {
		"type": "authentication_error",
		"message": "invalid x-api-key"
	},
	"request_id": "req_abcd2wwqTM"
}
这种就OK,起码没有城墙

1)node版本 20.20.0

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

2)安装supabase - CLI (宝塔docker里面也有supabase 但不是CLI版本)

# 安装 CLI 到项目里(开发依赖)
npm install supabase --save-dev

chatbot-ui 官方仓库里的 supabase/config.toml通常是精心配好的(project_id、端口、kong 名称等)

正确做法是:跳过 init,直接 start

npx supabase status

image.png

NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321

NEXT_PUBLIC_SUPABASE_ANON_KEY=sb_publishable_ACJWlzQHlZjBrEguHvfOxg_3BJgxAaH

SUPABASE_SERVICE_ROLE_KEY=sb_secret_N7UND0UgjKTVK-Uodkm0Hg_xSvEMPvz

注意NEXT_PUBLIC_SUPABASE_URL 我们用的是公网ip,把127.0.0.1 替换成公网ip

db/workspaces.ts (27:10) @ getWorkspaceById

if (!workspace) {
   throw new Error(error.message)
}

这种错误就是NEXT_PUBLIC_SUPABASE_URL 本地ip的问题
docker ps --format "table {{.Names}}\t{{.Status}}" | grep -i supabase
cd /www/wwwnode/chatbot-ui && npx supabase start --debug
npm run dev -- --hostname 0.0.0.0 --port 3000

就结束了,迁移成功会自动创建一个test@test.com 的账户,密码就是possword