From 0aa9da39a9292d9f01bd438ea9ae3b1a397f6a17 Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Sun, 27 Oct 2024 01:27:59 +0530 Subject: [PATCH] fix(isNoneDoc): empty doc assumed as default --- application/api/answer/routes.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/application/api/answer/routes.py b/application/api/answer/routes.py index 17eb5cc34..e05de1230 100644 --- a/application/api/answer/routes.py +++ b/application/api/answer/routes.py @@ -269,9 +269,6 @@ class Stream(Resource): "prompt_id": fields.String( required=False, default="default", description="Prompt ID" ), - "selectedDocs": fields.String( - required=False, description="Selected documents" - ), "chunks": fields.Integer( required=False, default=2, description="Number of chunks" ), @@ -303,10 +300,9 @@ def post(self): history = json.loads(history) conversation_id = data.get("conversation_id") prompt_id = data.get("prompt_id", "default") - if "selectedDocs" in data and data["selectedDocs"] is None: - chunks = 0 - else: - chunks = int(data.get("chunks", 2)) + + + chunks = int(data.get("chunks", 2)) token_limit = data.get("token_limit", settings.DEFAULT_MAX_HISTORY) retriever_name = data.get("retriever", "classic") @@ -333,7 +329,8 @@ def post(self): ) prompt = get_prompt(prompt_id) - + if "isNoneDoc" in data and data["isNoneDoc"] is True: + chunks = 0 retriever = RetrieverCreator.create_retriever( retriever_name, question=question,