From 015bc7c8c3cee54619bcdbe88496b9f5cbc86e8a Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 22 Dec 2023 12:10:35 +0000 Subject: [PATCH] hotfix source doc data --- application/api/answer/routes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/api/answer/routes.py b/application/api/answer/routes.py index 3ed4babd6..2d2019ef7 100644 --- a/application/api/answer/routes.py +++ b/application/api/answer/routes.py @@ -117,10 +117,10 @@ 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, "metadata": 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}) + 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"