init
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user