The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(gateway/platforms): qqbot keyboards/constants/crypto micro-compaction
Tekniumc161f62f6662
diff --git a/gateway/platforms/qqbot/constants.py b/gateway/platforms/qqbot/constants.pyindex e4fec356d76..8a203dea6ab 100644--- a/gateway/platforms/qqbot/constants.py+++ b/gateway/platforms/qqbot/constants.py@@ -4,9 +4,7 @@ from __future__ import annotationsimport os-# Bump on functional changes to the adapter package.-QQBOT_VERSION = "1.1.0"-+QQBOT_VERSION = "1.1.0" # bump on functional changes to the adapter package# Portal domain is overridable (QQ_PORTAL_HOST) for corporate proxies / test environments.PORTAL_HOST = os.getenv("QQ_PORTAL_HOST", "q.qq.com")diff --git a/gateway/platforms/qqbot/crypto.py b/gateway/platforms/qqbot/crypto.pyindex af3b5ff8542..53e1a1f6367 100644--- a/gateway/platforms/qqbot/crypto.py+++ b/gateway/platforms/qqbot/crypto.py@@ -16,6 +16,5 @@ def decrypt_secret(encrypted_base64: str, key_base64: str) -> str:"""Decrypt ``bot_encrypt_secret`` (base64 of ``IV(12) ‖ ciphertext ‖ tag(16)``) to a UTF-8 string."""from cryptography.hazmat.primitives.ciphers.aead import AESGCM- raw = base64.b64decode(encrypted_base64)- # AESGCM expects ciphertext + tag concatenated.+ raw = base64.b64decode(encrypted_base64) # AESGCM expects ciphertext + tag concatenatedreturn AESGCM(base64.b64decode(key_base64)).decrypt(raw[:12], raw[12:], None).decode("utf-8")diff --git a/gateway/platforms/qqbot/keyboards.py b/gateway/platforms/qqbot/keyboards.pyindex 7bf02d9486b..be608cb9b02 100644--- a/gateway/platforms/qqbot/keyboards.py+++ b/gateway/platforms/qqbot/keyboards.py@@ -27,9 +27,7 @@ def _to_dict(value: Any) -> Any:"""Serialize a dataclass tree in field-declaration order (the wire shape)."""if is_dataclass(value):return {f.name: _to_dict(getattr(value, f.name)) for f in fields(value)}- if isinstance(value, list):- return [_to_dict(v) for v in value]- return value+ return [_to_dict(v) for v in value] if isinstance(value, list) else valueclass _Serializable:@@ -91,7 +89,7 @@ class InlineKeyboard(_Serializable):def parse_approval_button_data(button_data: str) -> Optional[tuple[str, str]]:"""Parse approval ``button_data`` into ``(session_key, decision)`` or ``None``."""m = _APPROVAL_DATA_RE.match(button_data or "")- return (m.group(1), m.group(2)) if m else None+ return m.groups() if m else Nonedef parse_update_prompt_button_data(button_data: str) -> Optional[str]: