Skip to content

Commit 44ac87a

Browse files
authored
Remove Redundant None Check for vector_similarity_weight (infiniflow#4037)
### What problem does this PR solve? The removed if statement is unnecessary and adds cognitive load for readers. The original code: ``` vector_similarity_weight = req.get("vector_similarity_weight", 0.3) if vector_similarity_weight is None: vector_similarity_weight = 0.3 ``` has been simplified to: ``` vector_similarity_weight = req.get("vector_similarity_weight", 0.3) ``` ### Type of change - [x] Refactoring
1 parent 7ddccbb commit 44ac87a

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

api/apps/dialog_app.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ def set_dialog():
4141
req["rerank_id"] = ""
4242
similarity_threshold = req.get("similarity_threshold", 0.1)
4343
vector_similarity_weight = req.get("vector_similarity_weight", 0.3)
44-
if vector_similarity_weight is None:
45-
vector_similarity_weight = 0.3
4644
llm_setting = req.get("llm_setting", {})
4745
default_prompt = {
4846
"system": """你是一个智能助手,请总结知识库的内容来回答问题,请列举知识库中的数据详细回答。当所有知识库内容都与问题无关时,你的回答必须包括“知识库中未找到您要的答案!”这句话。回答需要考虑聊天历史。

0 commit comments

Comments
 (0)