From 038822f3bdd3014e2597fce4c6efd5727c154008 Mon Sep 17 00:00:00 2001 From: KevinHuSh Date: Sun, 28 Apr 2024 11:56:17 +0800 Subject: [PATCH] make cites in conversation API configurable (#576) ### What problem does this PR solve? #566 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/db/services/dialog_service.py | 2 +- docs/conversation_api.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/api/db/services/dialog_service.py b/api/db/services/dialog_service.py index db1d6241f..ed8b05039 100644 --- a/api/db/services/dialog_service.py +++ b/api/db/services/dialog_service.py @@ -136,7 +136,7 @@ def chat(dialog, messages, **kwargs): chat_logger.info("User: {}|Assistant: {}".format( msg[-1]["content"], answer)) - if knowledges and prompt_config.get("quote", True): + if knowledges and (prompt_config.get("quote", True) and kwargs.get("quote", True)): answer, idx = retrievaler.insert_citations(answer, [ck["content_ltks"] for ck in kbinfos["chunks"]], diff --git a/docs/conversation_api.md b/docs/conversation_api.md index 81d7ef34b..2e675edf8 100644 --- a/docs/conversation_api.md +++ b/docs/conversation_api.md @@ -221,6 +221,7 @@ This will be called to get the answer to users' questions. |------|-------|----|----| | conversation_id| string | No | This is from calling /new_conversation.| | messages| json | No | All the conversation history stored here including the latest user's question.| +| quote | bool | Yes | Default: true | ### Response ```json