From 974b92fc45d91af038a73e9f4bb1e6296f9d47fc Mon Sep 17 00:00:00 2001 From: root Date: Tue, 14 Apr 2026 11:51:32 +0800 Subject: [PATCH] =?UTF-8?q?revert:=20=E6=8F=90=E7=A4=BA=E8=AF=8D=E4=BF=9D?= =?UTF-8?q?=E6=8C=81=E6=89=93=E5=8C=85=E8=BF=9B=E4=BA=8C=E8=BF=9B=E5=88=B6?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E6=94=AF=E6=8C=81=E7=94=A8=E6=88=B7=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/prompts/prompt_manager.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/core/prompts/prompt_manager.py b/core/prompts/prompt_manager.py index fd30db2..d3aa547 100644 --- a/core/prompts/prompt_manager.py +++ b/core/prompts/prompt_manager.py @@ -10,11 +10,7 @@ class PromptManager: _instance = None _cached_prompt = None - # 用户自定义提示词路径 - USER_PROMPT_PATH = Path.home() / ".trulymem" / "system_prompt.md" - def __new__(cls): - """单例模式,避免重复加载""" if cls._instance is None: cls._instance = super().__new__(cls) return cls._instance @@ -25,29 +21,19 @@ class PromptManager: self._initialized = True def get_system_prompt(self) -> str: - """获取系统提示词(带缓存)""" if PromptManager._cached_prompt is not None: return PromptManager._cached_prompt - # 1. 优先使用用户自定义提示词 - if self.USER_PROMPT_PATH.exists(): - with open(self.USER_PROMPT_PATH, "r", encoding="utf-8") as f: - PromptManager._cached_prompt = f.read() - return PromptManager._cached_prompt - - # 2. 使用打包的提示词 prompt_file = self.prompts_dir / "system_prompt.md" if prompt_file.exists(): with open(prompt_file, "r", encoding="utf-8") as f: PromptManager._cached_prompt = f.read() else: - # 3. 使用内置默认提示词 PromptManager._cached_prompt = self._build_default_prompt() return PromptManager._cached_prompt def _build_default_prompt(self) -> str: - """构建默认提示词(精简版)""" return """你是TrulyMEM,一个拥有长期记忆能力的AI助手。 ## 核心能力 @@ -88,10 +74,4 @@ class PromptManager: - 是否需要维护任务链 - 如何使用工具 -记住:灵活应对,保持自然对话体验。""" - - @staticmethod - def clear_cache(): - """清除缓存,强制重新加载提示词""" - PromptManager._cached_prompt = None - PromptManager._instance = None \ No newline at end of file +记住:灵活应对,保持自然对话体验。""" \ No newline at end of file