提示词节奏准则+群聊/朋友圈限长; 解密降级防500

This commit is contained in:
zhiqui
2026-11-15 16:53:58 +08:00
parent 9f90de0541
commit ae83d0d948
3 changed files with 22 additions and 4 deletions
+7 -1
View File
@@ -12,7 +12,13 @@ def enc(key: bytes | None, text: str) -> str:
def dec(key: bytes | None, stored: str) -> str:
from ..core.security import decrypt_text
return decrypt_text(key, stored) if key else stored
if not key:
return stored
try:
return decrypt_text(key, stored)
except Exception:
# 密码重置/盐变更导致的旧密文:降级显示,不让整个请求 500
return "[旧加密内容已失效]"
class UserRepo: