Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions agent/prompt_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,14 @@ def _strip_yaml_frontmatter(content: str) -> str:
"only β€” no markdown, no formatting. SMS messages are limited to ~1600 "
"characters, so be brief and direct."
),
"weixin": (
"You are on WeChat (Weixin), a Chinese messaging platform. "
"Messages are plain text only β€” markdown is NOT rendered. "
"Keep responses concise. You can send images, videos, and files as "
"native attachments. Voice messages may arrive as speech-to-text "
"transcriptions. Do not use markdown formatting like **bold** or "
"`code` β€” use plain text."
),
}

CONTEXT_FILE_MAX_CHARS = 20_000
Expand Down
1 change: 1 addition & 0 deletions cron/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def _deliver_result(job: dict, content: str) -> None:
"mattermost": Platform.MATTERMOST,
"homeassistant": Platform.HOMEASSISTANT,
"dingtalk": Platform.DINGTALK,
"weixin": Platform.WEIXIN,
"feishu": Platform.FEISHU,
"wecom": Platform.WECOM,
"email": Platform.EMAIL,
Expand Down
2 changes: 1 addition & 1 deletion gateway/channel_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def build_channel_directory(adapters: Dict[Any, Any]) -> Dict[str, Any]:
logger.warning("Channel directory: failed to build %s: %s", platform.value, e)

# Telegram, WhatsApp & Signal can't enumerate chats -- pull from session history
for plat_name in ("telegram", "whatsapp", "signal", "email", "sms"):
for plat_name in ("telegram", "whatsapp", "signal", "weixin", "email", "sms"):
if plat_name not in platforms:
platforms[plat_name] = _build_from_sessions(plat_name)

Expand Down
29 changes: 27 additions & 2 deletions gateway/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class Platform(Enum):
EMAIL = "email"
SMS = "sms"
DINGTALK = "dingtalk"
WEIXIN = "weixin"
API_SERVER = "api_server"
WEBHOOK = "webhook"
FEISHU = "feishu"
Expand Down Expand Up @@ -262,6 +263,11 @@ def get_connected_platforms(self) -> List[Platform]:
for platform, config in self.platforms.items():
if not config.enabled:
continue
# Weixin needs both token and account_id from QR login.
if platform == Platform.WEIXIN:
if config.token and config.extra.get("account_id"):
connected.append(platform)
continue
# Platforms that use token/api_key auth
if config.token or config.api_key:
connected.append(platform)
Expand Down Expand Up @@ -872,6 +878,27 @@ def _apply_env_overrides(config: GatewayConfig) -> None:
name=os.getenv("FEISHU_HOME_CHANNEL_NAME", "Home"),
)

# WeChat (Weixin)
weixin_token = os.getenv("WEIXIN_TOKEN")
if weixin_token:
if Platform.WEIXIN not in config.platforms:
config.platforms[Platform.WEIXIN] = PlatformConfig()
config.platforms[Platform.WEIXIN].enabled = True
config.platforms[Platform.WEIXIN].token = weixin_token
extra = config.platforms[Platform.WEIXIN].extra
extra["base_url"] = os.getenv("WEIXIN_BASE_URL", "https://ilinkai.weixin.qq.com")
extra["cdn_base_url"] = os.getenv("WEIXIN_CDN_BASE_URL", "https://novac2c.cdn.weixin.qq.com/c2c")
weixin_account_id = os.getenv("WEIXIN_ACCOUNT_ID", "")
if weixin_account_id:
extra["account_id"] = weixin_account_id
weixin_home = os.getenv("WEIXIN_HOME_CHANNEL")
if weixin_home:
config.platforms[Platform.WEIXIN].home_channel = HomeChannel(
platform=Platform.WEIXIN,
chat_id=weixin_home,
name=os.getenv("WEIXIN_HOME_CHANNEL_NAME", "Home"),
)

# WeCom (Enterprise WeChat)
wecom_bot_id = os.getenv("WECOM_BOT_ID")
wecom_secret = os.getenv("WECOM_SECRET")
Expand Down Expand Up @@ -908,5 +935,3 @@ def _apply_env_overrides(config: GatewayConfig) -> None:
config.default_reset_policy.at_hour = int(reset_hour)
except ValueError:
pass


Loading