mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-19 20:16:49 +08:00
Fix: duplicate output by async_chat_streamly (#11842)
### What problem does this PR solve? Fix: duplicate output by async_chat_streamly Refact: revert manual modification ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [x] Refactoring --------- Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
This commit is contained in:
@ -146,7 +146,6 @@ class Base(ABC):
|
||||
request_kwargs["stop"] = stop
|
||||
|
||||
response = await self.async_client.chat.completions.create(**request_kwargs)
|
||||
|
||||
async for resp in response:
|
||||
if not resp.choices:
|
||||
continue
|
||||
@ -161,7 +160,6 @@ class Base(ABC):
|
||||
else:
|
||||
reasoning_start = False
|
||||
ans = resp.choices[0].delta.content
|
||||
|
||||
tol = total_token_count_from_response(resp)
|
||||
if not tol:
|
||||
tol = num_tokens_from_string(resp.choices[0].delta.content)
|
||||
@ -193,7 +191,7 @@ class Base(ABC):
|
||||
except Exception as e:
|
||||
e = await self._exceptions_async(e, attempt)
|
||||
if e:
|
||||
yield e
|
||||
yield e
|
||||
yield total_tokens
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user