diff --git a/application/api/answer/routes.py b/application/api/answer/routes.py index 62fb6b93..53005cae 100644 --- a/application/api/answer/routes.py +++ b/application/api/answer/routes.py @@ -221,7 +221,13 @@ def complete_stream( "timestamp": datetime.datetime.now(datetime.timezone.utc), } ) - + sources = retriever.search() + for source in sources: + if("text" in source): + source["text"] = source["text"][:100].strip()+"..." + if(len(sources) > 0): + data = json.dumps({"type":"source","source":sources}) + yield f"data: {data}\n\n" data = json.dumps({"type": "end"}) yield f"data: {data}\n\n" except Exception as e: