[WIP][Bugfix][MiniCPM-o] Fix Full duplex bugs for minicpm-challenge (#5496)
Signed-off-by: Sy03 <1370724210@qq.com>
This commit is contained in:
60 files changed
+3696
-634
No files matched your search
@@ -503,11 +503,45 @@ class DuplexSessionRunnerMixin:
|
||||
clear_completed_pending_silence()
|
||||
pending_silence = native.pending_silence_task
|
||||
if pending_silence is not None and not pending_silence.done():
|
||||
if pending_silence is asyncio.current_task():
|
||||
return False
|
||||
try:
|
||||
if not await pending_silence:
|
||||
return False
|
||||
except asyncio.CancelledError:
|
||||
current = asyncio.current_task()
|
||||
if current is not None and current.cancelling():
|
||||
raise
|
||||
return False
|
||||
except Exception:
|
||||
return False
|
||||
clear_completed_pending_silence()
|
||||
pending_silence = native.pending_silence_task
|
||||
if pending_silence is not None and not pending_silence.done():
|
||||
return False
|
||||
append_tail = actor.native_append_tail
|
||||
if (append_tail is None or append_tail.done()) and real_native_input_waiting():
|
||||
return False
|
||||
if actor.native_append_tail is not None and not actor.native_append_tail.done():
|
||||
return False
|
||||
if real_native_input_waiting():
|
||||
return False
|
||||
continuation_delay_s = max(
|
||||
0.0,
|
||||
float(session.capabilities.chunk_period_ms or 1000) / 1000.0,
|
||||
)
|
||||
if continuation_delay_s > 0:
|
||||
await asyncio.sleep(continuation_delay_s)
|
||||
if (
|
||||
actor.native_append_tail is not append_tail
|
||||
or ((append_tail is None or append_tail.done()) and real_native_input_waiting())
|
||||
or self._native_silence_continuation_is_stale(
|
||||
session,
|
||||
request_id=request_id,
|
||||
response_id=response_id,
|
||||
response_owned=response_owned,
|
||||
expected_epoch=expected_epoch,
|
||||
expected_incarnation=expected_incarnation,
|
||||
expected_model_turn_id=expected_model_turn_id,
|
||||
)
|
||||
):
|
||||
return False
|
||||
|
||||
def _still_valid() -> bool:
|
||||
return not real_native_input_waiting() and not self._native_silence_continuation_is_stale(
|
||||
|
||||
Reference in new issue
Block a user