forked from LangQi99/NeoFish
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmessage.py
More file actions
34 lines (24 loc) · 1.08 KB
/
message.py
File metadata and controls
34 lines (24 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
message.py - Unified message type definitions for NeoFish.
All platform adapters translate their native message formats into
UnifiedMessage so the core agent logic stays platform-agnostic.
"""
from dataclasses import dataclass, field
from typing import List, Optional, Tuple, Union
@dataclass
class UnifiedMessage:
"""A platform-agnostic message that flows into the agent."""
# Which platform this message came from: "web" | "telegram" | "qq"
platform: str
# Opaque user identifier on that platform (e.g. Telegram user_id, QQ number)
user_id: str
# Unified session ID (UUID) shared across the system
session_id: str
# Plain text content of the message
text: str
# List of attachments. Each item is either:
# - a (filename, bytes) tuple for binary data received by the platform
# - a (filename, str) tuple where str is an HTTP URL or a base64 data-URL
attachments: List[Tuple[str, Union[bytes, str]]] = field(default_factory=list)
# ID of the message being replied to, if any (platform-native format)
reply_to: Optional[str] = None