feat(gateway): include Discord channel topic in session context
Fixes #163 - Add chat_topic field to SessionSource dataclass - Update to_dict/from_dict for serialization support - Add chat_topic parameter to build_source helper - Extract channel.topic in Discord adapter for messages and slash commands - Display Channel Topic in system prompt when available - Normalize empty topics to None
This commit is contained in:
parent
4d6f380bd1
commit
54147474d3
3 changed files with 21 additions and 1 deletions
|
|
@ -736,9 +736,13 @@ class BasePlatformAdapter(ABC):
|
|||
chat_type: str = "dm",
|
||||
user_id: Optional[str] = None,
|
||||
user_name: Optional[str] = None,
|
||||
thread_id: Optional[str] = None
|
||||
thread_id: Optional[str] = None,
|
||||
chat_topic: Optional[str] = None,
|
||||
) -> SessionSource:
|
||||
"""Helper to build a SessionSource for this platform."""
|
||||
# Normalize empty topic to None
|
||||
if chat_topic is not None and not chat_topic.strip():
|
||||
chat_topic = None
|
||||
return SessionSource(
|
||||
platform=self.platform,
|
||||
chat_id=str(chat_id),
|
||||
|
|
@ -747,6 +751,7 @@ class BasePlatformAdapter(ABC):
|
|||
user_id=str(user_id) if user_id else None,
|
||||
user_name=user_name,
|
||||
thread_id=str(thread_id) if thread_id else None,
|
||||
chat_topic=chat_topic.strip() if chat_topic else None,
|
||||
)
|
||||
|
||||
@abstractmethod
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue