From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Fri, 25 Apr 2025 17:53:38 +0000 (-0700) Subject: Trim nodes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ccaf66869ea9a116a2f74f14788e11aaf2c9019;p=thirdparty%2Fpaperless-ngx.git Trim nodes --- diff --git a/src/paperless/ai/chat.py b/src/paperless/ai/chat.py index 6ad67b56f..6185131a1 100644 --- a/src/paperless/ai/chat.py +++ b/src/paperless/ai/chat.py @@ -51,7 +51,8 @@ def stream_chat_with_documents(query_str: str, documents: list[Document]): else: top_nodes = retriever.retrieve(query_str) context = "\n\n".join( - f"TITLE: {node.metadata.get('title')}\n{node.text}" for node in top_nodes + f"TITLE: {node.metadata.get('title')}\n{node.text[:500]}" + for node in top_nodes ) prompt = CHAT_PROMPT_TMPL.partial_format(