mirror of
https://gitcode.com/JianFeeeee/TrulyMEM-TrueHumanMEM.git
synced 2026-09-20 08:58:15 +00:00
docs: 重构为双语文档结构,添加人设图机制
- 拆分为 docs/(CN) 和 docs_en/(EN) 两个文件夹 - 主 README 索引对应语言文档 - 新增 persona.md (人设图机制详细说明) - 文件重命名为英文名
This commit is contained in:
@ -13,19 +13,29 @@ class AppConfig:
|
||||
api_key: str = ""
|
||||
model: str = "deepseek-chat"
|
||||
base_url: str = "https://api.deepseek.com"
|
||||
persona_query_max: int = 1
|
||||
persona_update_max: int = 1
|
||||
task_query_max: int = 4
|
||||
task_update_max: int = 2
|
||||
memory_query_max: int = 20
|
||||
memory_update_max: int = 10
|
||||
|
||||
@classmethod
|
||||
def from_env(cls) -> "AppConfig":
|
||||
"""从环境变量加载配置"""
|
||||
return cls(
|
||||
api_key=os.getenv("DEEPSEEK_API_KEY", ""),
|
||||
model=os.getenv("MODEL_NAME", "deepseek-chat"),
|
||||
base_url=os.getenv("DEEPSEEK_BASE_URL", "https://api.deepseek.com"),
|
||||
persona_query_max=int(os.getenv("PERSONA_QUERY_MAX", 1)),
|
||||
persona_update_max=int(os.getenv("PERSONA_UPDATE_MAX", 1)),
|
||||
task_query_max=int(os.getenv("TASK_QUERY_MAX", 4)),
|
||||
task_update_max=int(os.getenv("TASK_UPDATE_MAX", 2)),
|
||||
memory_query_max=int(os.getenv("MEMORY_QUERY_MAX", 20)),
|
||||
memory_update_max=int(os.getenv("MEMORY_UPDATE_MAX", 10)),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_file(cls, path: Path) -> "AppConfig":
|
||||
"""从文件加载配置"""
|
||||
if not path.exists():
|
||||
return cls()
|
||||
|
||||
@ -36,10 +46,15 @@ class AppConfig:
|
||||
api_key=data.get("api_key", ""),
|
||||
model=data.get("model", "deepseek-chat"),
|
||||
base_url=data.get("base_url", "https://api.deepseek.com"),
|
||||
persona_query_max=data.get("persona_query_max", 1),
|
||||
persona_update_max=data.get("persona_update_max", 1),
|
||||
task_query_max=data.get("task_query_max", 4),
|
||||
task_update_max=data.get("task_update_max", 2),
|
||||
memory_query_max=data.get("memory_query_max", 20),
|
||||
memory_update_max=data.get("memory_update_max", 10),
|
||||
)
|
||||
|
||||
def save(self, path: Path) -> None:
|
||||
"""保存配置到文件"""
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
|
||||
Reference in New Issue
Block a user