如何在Docker部署的Open Web UI中集成启用text_to_sql_pipeline.py
Docker环境下Open Web UI启用text_to_sql_pipeline.py的问题排查与解决方案
已完成操作回顾
- 使用Docker容器运行搭载Ollama的Open Web UI
- 单独启动pipelines容器,命令:
docker run -d -p 9099:9099 --add-host=host.docker.internal:host-gateway -v pipelines:/app/pipelines --name pipelines --restart always ghcr.io/open-webui/pipelines:main - 在Open Web UI的
Admin Panel > Settings > Connections > OpenAI API section配置API URL为http://host.docker.internal:9099,密钥为0p3n-w3bu! - 上传本地
text_to_sql_pipeline.py后显示there are no Valves,管道未激活;填入GitHub URL也无效
问题根源
- 管道文件未放置到pipelines容器的默认扫描目录,UI上传无法被容器识别
text_to_sql_pipeline.py依赖数据库连接参数(即Valve),未配置导致管道无法激活- 直接使用GitHub URL加载管道,容器无法正确拉取解析
分步解决方案
1. 重置pipelines容器并修正挂载路径
- 停止并移除现有容器:
docker stop pipelines && docker rm pipelines - 在本地创建管道存储目录,将
text_to_sql_pipeline.py放入指定子目录:mkdir -p ./pipelines/pipelines # 可手动复制文件到./pipelines/pipelines/目录,或用curl下载 curl -o ./pipelines/pipelines/text_to_sql_pipeline.py https://raw.githubusercontent.com/open-webui/pipelines/main/examples/pipelines/rag/text_to_sql_pipeline.py - 重新启动pipelines容器,挂载本地目录:
docker run -d -p 9099:9099 \ --add-host=host.docker.internal:host-gateway \ -v ./pipelines:/app/pipelines \ --name pipelines --restart always \ ghcr.io/open-webui/pipelines:main
2. 配置管道所需Valve(数据库连接参数)
- 登录Open Web UI,进入
Admin Panel > Pipelines,找到text_to_sql_pipeline - 点击
Configure按钮,添加以下Valve参数:- 键:
DB_URL - 值:你的数据库连接字符串(示例:
postgresql://username:password@host.docker.internal:5432/dbname或mysql://username:password@host.docker.internal:3306/dbname)
注意:本地数据库使用
host.docker.internal确保容器可访问;容器化数据库需加入同一Docker网络 - 键:
3. 激活管道
- 配置完成后回到Pipelines列表页,找到
text_to_sql_pipeline,点击Activate按钮 - 确认管道状态变为
Active,即可在对话中使用
4. 验证与排查
- 查看pipelines容器日志,确认管道加载成功:
日志中应出现类似docker logs pipelinesLoaded pipeline: text_to_sql_pipeline的条目 - 验证Open Web UI与pipelines的连接:进入
Admin Panel > Settings > Connections,点击OpenAI API配置项的Test Connection按钮,确认连接正常
内容的提问来源于stack exchange,提问作者Urvesh
相关产品推荐
相关产品推荐

