新增 Synology Chat 渠道扩展,支持在 Yuxi 平台中集成群晖 Synology Chat 即时通讯渠道。 包含以下功能模块: - client: Synology Chat API 客户端封装 - accounts: 账户管理 - webhook: Webhook 事件处理 - security: 安全校验 - dedupe: 消息去重 - status: 会话状态管理 - session: 会话管理 - types: 类型定义
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
|
|
def build_session_key(agent_id: str, account_id: str, user_id: str) -> str:
|
|
return f"agent:{agent_id}:synology-chat:{account_id}:direct:{user_id}"
|
|
|
|
|
|
CHANNEL_FORMAT_INSTRUCTIONS = """
|
|
### Synology Chat Formatting
|
|
Synology Chat supports limited formatting. Use these patterns:
|
|
|
|
**Links**: Use <URL|display text> to create clickable links.
|
|
Example: <https://example.com|Click here> renders as a clickable link.
|
|
Markdown links [label](url) are automatically converted to <URL|label> format.
|
|
|
|
**File sharing**: Include a publicly accessible URL to share files or images.
|
|
The NAS will download and attach the file (max 32 MB).
|
|
|
|
**Interactive buttons**: Bot can send action buttons via attachments.
|
|
Supported button styles: green, grey, red, orange, blue, teal.
|
|
|
|
**Limitations**:
|
|
- No markdown, bold, italic, or code blocks
|
|
- No message editing after send
|
|
- Keep messages under 2000 characters for best readability
|
|
|
|
**Best practices**:
|
|
- Use short, clear responses (Synology Chat has a minimal UI)
|
|
- Use line breaks to separate sections
|
|
- Use numbered or bulleted lists for clarity
|
|
- Wrap URLs with <URL|label> for user-friendly links
|
|
"""
|