Skip to content

Commit

Permalink
Remove Redundant None Check for vector_similarity_weight (infiniflow#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
learnerLj authored Dec 16, 2024
1 parent 7ddccbb commit 44ac87a
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions api/apps/dialog_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ def set_dialog():
req["rerank_id"] = ""
similarity_threshold = req.get("similarity_threshold", 0.1)
vector_similarity_weight = req.get("vector_similarity_weight", 0.3)
if vector_similarity_weight is None:
vector_similarity_weight = 0.3
llm_setting = req.get("llm_setting", {})
default_prompt = {
"system": """你是一个智能助手,请总结知识库的内容来回答问题,请列举知识库中的数据详细回答。当所有知识库内容都与问题无关时,你的回答必须包括“知识库中未找到您要的答案!”这句话。回答需要考虑聊天历史。
Expand Down

0 comments on commit 44ac87a

Please sign in to comment.