新增 Google Chat 对接的全套工具模块,包括: - 会话线程管理、消息解析与格式化 - Pub/Sub 消息解码、提及和命令识别 - 权限审批、目录管理和审计日志 - 消息缓存、媒体上传下载和 SSFR 防护 - 策略配置、卡片构建和流式回复支持
10 lines
330 B
Python
10 lines
330 B
Python
from __future__ import annotations
|
|
|
|
|
|
def build_thread_id(agent_id: str, space_name: str, user_email: str = "") -> str:
|
|
if space_name.startswith("spaces/"):
|
|
space_id = space_name.removeprefix("spaces/")
|
|
return f"agent:{agent_id}:googlechat:space:{space_id}"
|
|
|
|
return f"agent:main:googlechat:dm:{user_email}"
|