fix(gateway): keep typing loop overrides backward-compatible
This commit is contained in:
parent
150382e8b7
commit
8466268ca5
@ -6,6 +6,7 @@ and implement the required methods.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import inspect
|
||||||
import ipaddress
|
import ipaddress
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@ -1743,11 +1744,17 @@ class BasePlatformAdapter(ABC):
|
|||||||
|
|
||||||
# Start continuous typing indicator (refreshes every 2 seconds)
|
# Start continuous typing indicator (refreshes every 2 seconds)
|
||||||
_thread_metadata = {"thread_id": event.source.thread_id} if event.source.thread_id else None
|
_thread_metadata = {"thread_id": event.source.thread_id} if event.source.thread_id else None
|
||||||
|
_keep_typing_kwargs = {"metadata": _thread_metadata}
|
||||||
|
try:
|
||||||
|
_keep_typing_sig = inspect.signature(self._keep_typing)
|
||||||
|
except (TypeError, ValueError):
|
||||||
|
_keep_typing_sig = None
|
||||||
|
if _keep_typing_sig is None or "stop_event" in _keep_typing_sig.parameters:
|
||||||
|
_keep_typing_kwargs["stop_event"] = interrupt_event
|
||||||
typing_task = asyncio.create_task(
|
typing_task = asyncio.create_task(
|
||||||
self._keep_typing(
|
self._keep_typing(
|
||||||
event.source.chat_id,
|
event.source.chat_id,
|
||||||
metadata=_thread_metadata,
|
**_keep_typing_kwargs,
|
||||||
stop_event=interrupt_event,
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user