open-webui 安装过程
安装文档:https://docs.openwebui.com/getting-started/
1、拉取镜像: sudo docker pull ghcr.io/open-webui/open-webui
2、启动docker程序
docker stop open-webui
docker rm open-webui
sudo docker run -d --network=host -v open-webui:/app/backend/data -e https_proxy=http://localhost:10808 -e no_proxy=127.0.0.1,localhost,api.moonshot.cn,dashscope.aliyuncs.com,api.deepseek.com --name open-webui --restart always ghcr.io/open-webui/open-webui:main
3、修改代码
sudo docker exec -it open-webui /bin/bash
apt-get update && apt-get install -y nano
nano apps/openai/main.py
Ctrl+W : 输入ClientSession # 定位到需要修改的代码
添加trust_env=True
if key != "": headers = {"Authorization": f"Bearer {key}"} - async with aiohttp.ClientSession(timeout=timeout) as session: + async with aiohttp.ClientSession(timeout=timeout, trust_env=True) as session: async with session.get(url, headers=headers) as response: return await response.json()
Ctrl+o (保存更改), Enter, Ctrl+x (退出代码编辑), exit
sudo docker restart open-webui
4、登录配置
在设置->连接 里,输入openai 以及兼容openai模型的 base_url 和aip_key
openai: https://api.openai.com/v1 sk-xxx
kimi: https://api.moonshot.cn/v1 sk-xxxx
qwef: https://dashscope.aliyuncs.com/compatible-mode/v1 sk-xxxx
deepseek: https://api.deepseek.com/v1 sk-xxxx
5、在模型里的,LiteLLM 添加模型
# 添加google模型 litellm_params: - model_name: gemini/gemini-pro - api_key: sk-xxxx # 添加qwe模型 model_list: - model_name: qwen-turbo litellm_params: model: openai/qwen-turbo api_base: https://dashscope.aliyuncs.com/compatible-mode/v1 api_key: xxxxxxxx
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义