Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions livekit-agents/livekit/agents/voice/avatar/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from typing import TYPE_CHECKING, Generic, Literal, TypeVar

from livekit import rtc
from livekit.api import TwirpError

from ... import utils
from ...job import get_job_context
Expand Down Expand Up @@ -130,12 +131,18 @@ async def aclose(self) -> None:
identity=self.avatar_identity,
)
)
except Exception:
logger.warning(
"failed to remove avatar participant",
extra={"identity": self.avatar_identity},
exc_info=True,
)
except Exception as e:
if isinstance(e, TwirpError) and e.code == "not_found":
logger.debug(
"avatar participant not in room, skipping removal",
extra={"identity": self.avatar_identity},
)
else:
logger.warning(
"failed to remove avatar participant",
extra={"identity": self.avatar_identity},
exc_info=True,
)

if self._agent_session:
self._agent_session.off("conversation_item_added", self._on_conversation_item_added)
Expand Down