fix: fix infinite retry loop in async_chat_streamly when success
The original code continues the retry loop even after a successful response.
This commit is contained in:
parent
c51e6b2a58
commit
a393a5aa35
1 changed files with 3 additions and 2 deletions
|
|
@ -187,6 +187,9 @@ class Base(ABC):
|
||||||
ans = delta_ans
|
ans = delta_ans
|
||||||
total_tokens += tol
|
total_tokens += tol
|
||||||
yield ans
|
yield ans
|
||||||
|
|
||||||
|
yield total_tokens
|
||||||
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
e = await self._exceptions_async(e, attempt)
|
e = await self._exceptions_async(e, attempt)
|
||||||
if e:
|
if e:
|
||||||
|
|
@ -194,8 +197,6 @@ class Base(ABC):
|
||||||
yield total_tokens
|
yield total_tokens
|
||||||
return
|
return
|
||||||
|
|
||||||
yield total_tokens
|
|
||||||
|
|
||||||
def _length_stop(self, ans):
|
def _length_stop(self, ans):
|
||||||
if is_chinese([ans]):
|
if is_chinese([ans]):
|
||||||
return ans + LENGTH_NOTIFICATION_CN
|
return ans + LENGTH_NOTIFICATION_CN
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue