此提交对Synology Chat适配器进行了全面改进: 1. 新增消息去重、分布式轮询租约、bot名称配置等功能 2. 优化URL提取逻辑,自动清理尾部标点符号 3. 重构发送逻辑,提取通用重试工具函数并优化SID缓存 4. 完善文档提示与配置项,新增轮询租约类型支持 5. 修复认证API路径硬编码问题,调整交互组件提示文案 6. 增加Webhook模式下的DSM客户端兜底初始化 7. 优化导入顺序与代码结构,清理冗余空行
38 lines
1.5 KiB
Python
38 lines
1.5 KiB
Python
"""Agent format hints for Synology Chat.
|
|
|
|
Provides message formatting guidelines for the LLM/Agent to produce
|
|
Synology Chat-compatible output.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
def get_format_hints() -> str:
|
|
return (
|
|
"Synology Chat 消息格式指南:\n"
|
|
"- 粗体:使用 *文本* 格式(单星号)\n"
|
|
"- 斜体:使用 _文本_ 格式(下划线)\n"
|
|
"- 删除线:使用 ~文本~ 格式(波浪号)\n"
|
|
"- 行内代码:使用 `代码` 格式(反引号)\n"
|
|
"- 引用:使用 > 开头的行\n"
|
|
"- 链接:使用 <URL|标签> 格式,例如 <https://example.com|示例链接>\n"
|
|
"- 不支持 Markdown 表格、代码块、图片嵌入等高级语法\n"
|
|
"- 单条消息限制 4000 字符,长回复请分段发送\n"
|
|
"- 按钮、卡片等交互组件暂未启用\n"
|
|
)
|
|
|
|
|
|
def get_format_hints_english() -> str:
|
|
return (
|
|
"Synology Chat message formatting guide:\n"
|
|
"- Bold: use *text* format (single asterisk)\n"
|
|
"- Italic: use _text_ format (underscore)\n"
|
|
"- Strikethrough: use ~text~ format (tilde)\n"
|
|
"- Inline code: use `code` format (backtick)\n"
|
|
"- Blockquote: use > prefix on lines\n"
|
|
"- Links: use <URL|label> format, e.g. <https://example.com|Example Link>\n"
|
|
"- Markdown tables, code blocks, inline images are NOT supported\n"
|
|
"- Single message limit: 4000 characters, split long replies\n"
|
|
"- Interactive components (buttons, cards) are not yet enabled\n"
|
|
)
|