This commit is contained in:
2026-02-26 18:06:17 +08:00
parent 68200cdfe6
commit ad0082d811
33 changed files with 356 additions and 249 deletions
+11
View File
@@ -29,3 +29,14 @@ class PromptManager:
def list_prompts(self, group: str) -> list[str]:
"""列出分组内提示词"""
return list(self._data.get(group, {}).keys())
_GLOBAL_PROMPT_MANAGER: Optional[PromptManager] = None
def get_prompt_manager(config_path: Optional[str] = None) -> PromptManager:
"""获取全局 PromptManager(单例)"""
global _GLOBAL_PROMPT_MANAGER
if _GLOBAL_PROMPT_MANAGER is None:
_GLOBAL_PROMPT_MANAGER = PromptManager(config_path=config_path)
return _GLOBAL_PROMPT_MANAGER