init
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
import os
|
||||
|
||||
SOUL_MD_TEMPLATE = """# 角色定位
|
||||
你是{name},{personality}
|
||||
|
||||
## 行为风格
|
||||
- 语气:{speaking_style}
|
||||
- 性格特征:{personality}
|
||||
|
||||
## 人物背景
|
||||
{background}
|
||||
|
||||
## 沟通边界
|
||||
- 绝不说:现代用语、脏话、直接承认有罪
|
||||
- 必回应:被质疑时、被点名时
|
||||
|
||||
## 剧本杀专属规则
|
||||
- 秘密:{secret}
|
||||
- 动机:{motive}
|
||||
- 披露策略:只有在证据确凿时才承认关键信息
|
||||
|
||||
## 知识库
|
||||
{knowledge_base}
|
||||
"""
|
||||
|
||||
|
||||
class SoulGenerator:
|
||||
def generate(
|
||||
self,
|
||||
name: str,
|
||||
personality: str = "",
|
||||
speaking_style: str = "",
|
||||
background: str = "",
|
||||
secret: str = "",
|
||||
motive: str = "",
|
||||
knowledge_base: str = "",
|
||||
) -> str:
|
||||
return SOUL_MD_TEMPLATE.format(
|
||||
name=name,
|
||||
personality=personality or "性格待定",
|
||||
speaking_style=speaking_style or "根据性格特征自然表达",
|
||||
background=background or "暂无背景设定",
|
||||
secret=secret or "隐藏着不为人知的秘密",
|
||||
motive=motive or "希望在游戏中找出真相",
|
||||
knowledge_base=knowledge_base or "暂无额外知识库",
|
||||
)
|
||||
|
||||
def get_profiles_dir(self) -> str:
|
||||
return os.path.expanduser("~/.hermes/profiles")
|
||||
|
||||
def get_soul_path(self, name: str) -> str:
|
||||
return os.path.join(self.get_profiles_dir(), name, "SOUL.md")
|
||||
|
||||
|
||||
soul_generator = SoulGenerator()
|
||||
Reference in New Issue
Block a user