Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix: prevent redundant retries in async_chat_streamly upon success (#11832)

N0bodycan986386234830
diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.py
index f3f207eb2e..8a27438662 100644
--- a/rag/llm/chat_model.py
+++ b/rag/llm/chat_model.py
@@ -187,6 +187,9 @@ class Base(ABC):
ans = delta_ans
total_tokens += tol
yield ans
+
+ yield total_tokens
+ return
except Exception as e:
e = await self._exceptions_async(e, attempt)
if e:
@@ -194,8 +197,6 @@ class Base(ABC):
yield total_tokens
return
- yield total_tokens
-
def _length_stop(self, ans):
if is_chinese([ans]):
return ans + LENGTH_NOTIFICATION_CN