from enum import StrEnum class PreferenceCategory(StrEnum): LANGUAGE = "language" TONE = "tone" DETAIL = "detail" TOPIC = "topic" INTEREST = "interest" class PreferenceSource(StrEnum): EXPLICIT = "explicit" AUTO = "auto" class ConversationRole(StrEnum): USER = "user" ASSISTANT = "assistant" class ConversationChatType(StrEnum): PRIVATE = "private" GROUP = "group" class PersonalizationContextKey(StrEnum): SYSTEM_CONSTRAINTS = "system_constraints" COMPANY_RULES = "company_rules" PERSONAL_RULES = "personal_rules" CURRENT_REQUEST = "current_request" PREFERENCES = "preferences" INTERESTS = "interests" PERSONAL_MEMORY = "personal_memory" CONVERSATION_HISTORY = "conversation_history" PREFERENCE_CODE_PREFIX = "PREF" CONVERSATION_CODE_PREFIX = "CONV" PREFERENCE_MAX_VALUE_LENGTH = 1000 CONVERSATION_MAX_CONTENT_LENGTH = 20_000 CONVERSATION_RETENTION_DAYS = 30 CONVERSATION_MAX_TURNS = 20 CONVERSATION_MAX_MESSAGES = CONVERSATION_MAX_TURNS * 2 ERASURE_CONFIRMATION_TTL_MINUTES = 10 UNAVAILABLE_AI_PROVIDERS = frozenset({"", "noop"}) PREFERENCE_SIGNAL_TERMS = ( "以后", "记住", "偏好", "喜欢", "希望", "请用", "请保持", "关注", "感兴趣", "prefer", "preference", "i like", "interested in", ) # These terms identify categories that must never become an inferred personal profile. # General topics such as public market news remain allowed; the financial terms below are # intentionally limited to private account, compensation, and confidential-company facts. SENSITIVE_PREFERENCE_TERMS = ( "api key", "api_key", "access token", "access_token", "password", "secret", "token", "密码", "密钥", "令牌", "健康", "病史", "疾病", "诊断", "医疗记录", "宗教", "信仰", "政治立场", "党派", "选举倾向", "性取向", "同性恋", "异性恋", "绩效", "考核结果", "银行账号", "银行卡", "工资", "薪资", "个人收入", "财务秘密", "未公开财务", "保密预算", )