From 898ae7fa80d2b2cc99b439f36b730ad75280a4a4 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Fri, 24 Jan 2025 12:41:06 +0800 Subject: [PATCH] Fix missplace for vector sim weight and token sim weight. (#4627) ### What problem does this PR solve? #4610 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/sdk/chat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/apps/sdk/chat.py b/api/apps/sdk/chat.py index cd67b10c..49d79432 100644 --- a/api/apps/sdk/chat.py +++ b/api/apps/sdk/chat.py @@ -140,7 +140,7 @@ def create(tenant_id): res["prompt"] = renamed_dict del res["prompt_config"] new_dict = {"similarity_threshold": res["similarity_threshold"], - "keywords_similarity_weight": res["vector_similarity_weight"], + "keywords_similarity_weight": 1-res["vector_similarity_weight"], "top_n": res["top_n"], "rerank_model": res['rerank_id']} res["prompt"].update(new_dict) @@ -304,7 +304,7 @@ def list_chat(tenant_id): res["prompt"] = renamed_dict del res["prompt_config"] new_dict = {"similarity_threshold": res["similarity_threshold"], - "keywords_similarity_weight": res["vector_similarity_weight"], + "keywords_similarity_weight": 1-res["vector_similarity_weight"], "top_n": res["top_n"], "rerank_model": res['rerank_id']} res["prompt"].update(new_dict)