使用OpenWebUI与DeepSeek交互

Open WebUI 是针对 LLM 用户友好的 WebUI,支持的 LLM 运行程序包括阿里百炼、 Ollama、OpenAI 兼容的 API。这里主要讲在Docker环境下安装与本地Ollame和百炼API Key配置

一、安装Docker

1. CentOS

# 设置为阿里云的源
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

# 安装
sudo yum install docker-ce

2. Ubuntu

# 安装依赖
apt update
apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

# 使用下面的 curl 导入源仓库的 GPG key
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

# 将 Docker APT 软件源添加到你的系统
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

# 安装
apt updata
apt install docker-ce

3. 修改Docker源

mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
	"registry-mirrors": [
		"https://docker.1panel.live",
		"https://hub.rat.dev"
	]
}
EOF
systemctl daemon-reload
systemctl restart docker

二、安装OpenWebUI

1. 拉去镜像

docker pull ghcr.io/open-webui/open-webui:main

这里使用github上的open-webui镜像就可以了,不过这个镜像有近2G,要下很久很久。

2. 运行

docker run -d -p 3000:8080 -e OLLAMA_BASE_URL=https://example.com -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main

-p 3000:8080:映射容器中的8080端口到主机3000端口中
-e OLLAMA_BASE_URL=https://example.com:设置ollama地址,这个可以随便写一个,后面登录后设置可以调整
-v open-webui:/app/backend/data:目录映射
–name open-webui:容器名
–restart always:一直重启
ghcr.io/open-webui/open-webui:main:镜像名和版本

三、安装Ollama并部署DeepSeek(可选)

1. 安装Ollama

直接进入Ollama 官方下载页面,复制安装命令并运行。等待完成就好了。

curl -fsSL https://ollama.com/install.sh | sh

2. 部署DeepSeek

本地部署拼的是硬件实力。对于DeepSeek除了671B满血版本外,其他的版本都是阉割的,不论是深度还是精度都不是你想要的那个DeepSeek。所以,除671B版本外,其他的只是用来个人试验玩玩而已,我们可以使用后面第三方API Key。

DeepSeek版本可以在这里查看:https://ollama.com/library/deepseek-r1

根据自己的硬件配置,安装对应的版本。这里以7B版本为例,不同的版本把后面的7b替换一下就可以了。在命令行中输入

ollama run deepseek-r1:7b

漫长的等待,等看到success字样时说明已经安装完成,可以直接进行对话了。也可以使用http://ip:11434 提供给OpenWebUI使用

四、获取阿里百炼API Key(可选)

登录 阿里百炼大模型

同意霸王条款

选择需要开通的大模型,这是按Token收费的,不用不收小钱钱,而已每个模型都有100万个免费Token。

等待开通

模型进入控制台,在左下角选择API-Key -> 创建API-Key -> 选择默认业务空间

查看并复制Key后面用到

五、配置OpenWebUI

在浏览器中打开 http://ip:3000,首次进入会设置管理员密码信息

登录后,选择左下角头像 -> 设置 -> 设置页面中 管理员设置 -> 外部链接

最后可以选择模型使用了

© 版权声明
THE END
如果内容对您有所帮助,就支持一下吧!
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容