fix: llm_bridge._decrypt_key 修复 unpassword 参数顺序 + key 默认值兜底,正确解密 confidential_fields 加密的 api_key

This commit is contained in:
ymq 2026-08-17 15:28:16 +08:00
parent 42bf89c0c1
commit 853f3d5082

View File

@ -24,8 +24,10 @@ def _decrypt_key(encrypted: str) -> str:
from appPublic.rc4 import unpassword
from appPublic.jsonConfig import getConfig
config = getConfig()
key = config.password_key
return unpassword(key, encrypted)
# 与 ahserver.globalEnv.get_password_key() 一致password_key 为空时用默认 key
key = config.password_key or 'QRIVSRHrthhwyjy176556332'
# unpassword(code, key)code=密文key=密钥(之前参数顺序写反了)
return unpassword(encrypted, key)
except Exception:
return encrypted # already plaintext or decrypt failed