16 lines
467 B
Python
16 lines
467 B
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
|
||
|
|
class ConversationRoute:
|
||
|
|
def __init__(self):
|
||
|
|
self._routes: dict[str, str] = {}
|
||
|
|
|
||
|
|
def register(self, conversation_id: str, adapter_key: str) -> None:
|
||
|
|
self._routes[conversation_id] = adapter_key
|
||
|
|
|
||
|
|
def resolve(self, conversation_id: str) -> str | None:
|
||
|
|
return self._routes.get(conversation_id)
|
||
|
|
|
||
|
|
def unregister(self, conversation_id: str) -> None:
|
||
|
|
self._routes.pop(conversation_id, None)
|