From a04cdee33f21c443b5d96d53041fcb9aebc9475b Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 12 Jan 2024 14:38:15 +0000 Subject: [PATCH] Refactor source log generation in complete_stream function --- application/api/answer/routes.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/application/api/answer/routes.py b/application/api/answer/routes.py index 13685154..3fa32a6e 100644 --- a/application/api/answer/routes.py +++ b/application/api/answer/routes.py @@ -117,12 +117,9 @@ def complete_stream(question, docsearch, chat_history, api_key, prompt_id, conve source_log_docs = [] for doc in docs: if doc.metadata: - data = json.dumps({"type": "source", "doc": doc.page_content[:10], "metadata": doc.metadata}) source_log_docs.append({"title": doc.metadata['title'].split('/')[-1], "text": doc.page_content}) else: - data = json.dumps({"type": "source", "doc": doc.page_content[:10]}) source_log_docs.append({"title": doc.page_content, "text": doc.page_content}) - yield f"data:{data}\n\n" if len(chat_history) > 1: tokens_current_history = 0