初始化询价智能体新仓:同步本地工程并排除密钥与 .env。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
linmianxun
2026-09-13 14:30:44 +08:00
co-authored by Cursor
commit 2a14def882
2621 changed files with 393165 additions and 0 deletions
@@ -0,0 +1,25 @@
"""
企微加解密自检(无外网)。
运行:在 agent 目录 .venv 下 python -m agent.channel.wecom.selftest
需已配置 WECOM_CALLBACK_TOKEN / WECOM_ENCODING_AES_KEY / WECOM_CORP_ID。
"""
from __future__ import annotations
from agent.channel.wecom.crypto import WeComCrypto
from agent.config import get_settings
def main() -> None:
s = get_settings()
c = WeComCrypto(s.wecom_callback_token, s.wecom_encoding_aes_key, s.wecom_corp_id)
plain = "<xml><FromUserName><![CDATA[Alice]]></FromUserName><MsgType><![CDATA[text]]></MsgType><Content><![CDATA[hi]]></Content><MsgId>1</MsgId></xml>"
enc = c.encrypt(plain)
dec = c.decrypt(enc)
assert "Alice" in dec and "hi" in dec
print("crypto_ok")
if __name__ == "__main__":
main()