ForcePilot/backend/package/yuxi/channels/adapters/googlechat/threads.py
Kris ca07c593a8 feat(googlechat): 实现 Google Chat 适配器完整功能集
新增 Google Chat 对接的全套工具模块,包括:
- 会话线程管理、消息解析与格式化
- Pub/Sub 消息解码、提及和命令识别
- 权限审批、目录管理和审计日志
- 消息缓存、媒体上传下载和 SSFR 防护
- 策略配置、卡片构建和流式回复支持
2026-05-12 00:44:18 +08:00

19 lines
513 B
Python

from __future__ import annotations
def parse_thread_key(message: dict) -> str | None:
return message.get("thread", {}).get("threadKey")
def extract_thread_metadata(message: dict) -> dict:
thread = message.get("thread", {})
return {
"thread_key": thread.get("threadKey"),
"thread_name": thread.get("name"),
"is_thread_root": not bool(thread.get("threadKey")),
}
def is_thread_message(message: dict) -> bool:
return bool(message.get("thread", {}).get("threadKey"))