浏览代码

fix: stop rerank by model when search result is empty (#4203)

### What problem does this PR solve?


stop rerank by model when search result is empty, otherwise rerank may
raise an error (qwen).

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Co-authored-by: 刘博 <liubo@ynby.cn>
tags/v0.15.1
Bo Liu 10 个月前
父节点
当前提交
321e9f3719
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1
    1
      rag/nlp/search.py

+ 1
- 1
rag/nlp/search.py 查看文件

@@ -313,7 +313,7 @@ class Dealer:
ranks["total"] = sres.total

if page <= RERANK_PAGE_LIMIT:
if rerank_mdl:
if rerank_mdl and sres.total > 0:
sim, tsim, vsim = self.rerank_by_model(rerank_mdl,
sres, question, 1 - vector_similarity_weight, vector_similarity_weight)
else:

正在加载...
取消
保存