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

 

posted @ 2024-06-05 10:07  华之菜  阅读(333)  评论(0编辑  收藏  举报