```
feat: 添加飞书用户模块和订阅功能支持 - 新增feishu_users模块用于处理飞书用户身份验证和权限管理 - 新增subscriptions模块用于处理订阅相关功能 - 新增personalization模块用于个性化服务 - 在alembic迁移配置中注册新的模型模块 - 在API路由器中添加feishu_users和subscriptions路由 - 实现事件调度服务的改进,包括错误处理和状态更新优化 - 添加飞书命令处理的权限检查机制 - 实现飞书应用票据事件处理 - 改进审计日志记录功能 ```
This commit is contained in:
101
app/modules/personalization/constants.py
Normal file
101
app/modules/personalization/constants.py
Normal file
@@ -0,0 +1,101 @@
|
||||
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",
|
||||
"密码",
|
||||
"密钥",
|
||||
"令牌",
|
||||
"健康",
|
||||
"病史",
|
||||
"疾病",
|
||||
"诊断",
|
||||
"医疗记录",
|
||||
"宗教",
|
||||
"信仰",
|
||||
"政治立场",
|
||||
"党派",
|
||||
"选举倾向",
|
||||
"性取向",
|
||||
"同性恋",
|
||||
"异性恋",
|
||||
"绩效",
|
||||
"考核结果",
|
||||
"银行账号",
|
||||
"银行卡",
|
||||
"工资",
|
||||
"薪资",
|
||||
"个人收入",
|
||||
"财务秘密",
|
||||
"未公开财务",
|
||||
"保密预算",
|
||||
)
|
||||
Reference in New Issue
Block a user