文章目录
pipeline报错
将open-webui
几次更新,但始终没更新pipelines
,也有很长一段时间没跑pipeline
,今天想重新做一个新功能,再跑pipeline
,竟然报错了:
- 页面上的错:
- 后台的错: INFO: 192.168.216.113:13879 - "POST /pipeline.exporter/filter/inlet HTTP/1.1" 404 Not Found
原因
网上也只找到一两个人遇到这样的错,更没有人解决。初看这问题,真是莫名其妙。后面终于从后台的错中的url路径
入手,找到了关键代码:
pipelines/main.py
python
@app.post("/v1/{pipeline_id}/filter/inlet")
@app.post("/{pipeline_id}/filter/inlet")
async def filter_inlet(pipeline_id: str, form_data: FilterForm):
if pipeline_id not in app.state.PIPELINES:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail=f"Filter {pipeline_id} not found",
)
原来是新版本的open webui
在传pipeline_id
,会额外加上pipeline.
前缀,所以就找不到对应的pipeline
,从而报404
错。
解决
因为懒得再去open-webui
找相应的传参代码进行修改了,所以就直接在pipeline/main.py
中修改,关键部分如下:
python
@app.post("/v1/{pipeline_id}/filter/inlet")
@app.post("/{pipeline_id}/filter/inlet")
async def filter_inlet(pipeline_id: str, form_data: FilterForm):
pipeline_id = pipeline_id.split(".")[-1] # 增加
print(pipeline_id)
if pipeline_id not in app.state.PIPELINES:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail=f"Filter {pipeline_id} not found",
)
@app.post("/v1/{pipeline_id}/filter/outlet")
@app.post("/{pipeline_id}/filter/outlet")
async def filter_outlet(pipeline_id: str, form_data: FilterForm):
pipeline_id = pipeline_id.split(".")[-1] # 增加
if pipeline_id not in app.state.PIPELINES:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail=f"Filter {pipeline_id} not found",
)