初始化提交
This commit is contained in:
commit
887c1f449e
963 files changed
+166869
No files matched your search
@@ -0,0 +1,49 @@
|
||||
"""辰正时态配置。
|
||||
|
||||
所有字段可通过环境变量或 ``.env`` 覆盖(字段名即环境变量名,由 ``Settings.model_config``
|
||||
统一加载,无前缀,与既有 ``AppConfig`` 等同级配置一致)。默认值对齐辰正设计 §7.1
|
||||
离线档位与 §7.2/§7.3 触发阈值。v1 输入无 character 维度的时区/位置(character 模型
|
||||
未持有时区字段),统一用此处的默认值;v2 从档案/会话覆盖。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
|
||||
class TimeConfig(BaseSettings):
|
||||
"""辰正时态服务配置。"""
|
||||
|
||||
# 时区与位置(v1 全局默认;v2 从档案/会话覆盖)
|
||||
user_timezone: str = "Asia/Shanghai"
|
||||
home_timezone: str = "Asia/Shanghai"
|
||||
default_city: str = "上海"
|
||||
default_locale: str = "zh-CN"
|
||||
|
||||
# 离线档位阈值(分钟),对齐设计 §7.1 / duration.py 默认
|
||||
offline_active_minutes: float = 60
|
||||
offline_short_absence_minutes: float = 720
|
||||
offline_long_absence_minutes: float = 4320
|
||||
offline_reunion_impact_minutes: float = 4320
|
||||
|
||||
# 感慨触发(§7.2)
|
||||
sentiment_prewarm_days: int = 7
|
||||
# 认识天数有感节点(逗号分隔;§7.2 duration_node)
|
||||
sentiment_duration_nodes: str = "100,200,365,500,730,1000"
|
||||
# 强节气名(§7.2 solar_term;立春/冬至/清明/中秋/除夕等)
|
||||
sentiment_strong_solar_terms: str = "立春,清明,冬至,立夏,立秋,立冬"
|
||||
|
||||
# 关怀触发(§7.3)
|
||||
care_enabled: bool = True
|
||||
jetlag_threshold_minutes: int = 180
|
||||
late_night_min_turns: int = 3
|
||||
|
||||
@property
|
||||
def duration_nodes(self) -> set[int]:
|
||||
"""解析 ``sentiment_duration_nodes`` 为整数集合。"""
|
||||
return {int(x) for x in self.sentiment_duration_nodes.split(",") if x.strip()}
|
||||
|
||||
@property
|
||||
def strong_solar_terms(self) -> set[str]:
|
||||
"""解析强节气名集合。"""
|
||||
return {s.strip() for s in self.sentiment_strong_solar_terms.split(",") if s.strip()}
|
||||
Reference in new issue
Block a user