update prompt
This commit is contained in:
@@ -7,6 +7,9 @@ from typing import Iterable, List, Tuple
|
||||
|
||||
@dataclass
|
||||
class Appearance:
|
||||
"""
|
||||
外貌/颜值
|
||||
"""
|
||||
level: int # 1~10
|
||||
name: str
|
||||
desc_male: str
|
||||
|
||||
@@ -11,6 +11,7 @@ class Attack(MutualAction):
|
||||
DOABLES_REQUIREMENTS = "与目标处于同一区域"
|
||||
PARAMS = {"target_avatar": "AvatarName"}
|
||||
FEEDBACK_ACTIONS = ["Escape", "Battle"]
|
||||
story_prompt: str = ""
|
||||
|
||||
def _settle_feedback(self, target_avatar: "Avatar", feedback_name: str) -> None:
|
||||
fb = str(feedback_name).strip()
|
||||
|
||||
@@ -28,6 +28,7 @@ class Conversation(MutualAction):
|
||||
DOABLES_REQUIREMENTS = "与目标处于同一区域"
|
||||
PARAMS = {"target_avatar": "AvatarName"}
|
||||
FEEDBACK_ACTIONS: list[str] = ["Talk", "Reject"]
|
||||
story_prompt: str = ""
|
||||
|
||||
def _get_template_path(self) -> Path:
|
||||
# 使用 talk.txt 模板,以获取是否接受与对话内容
|
||||
|
||||
@@ -11,6 +11,7 @@ class DriveAway(MutualAction):
|
||||
DOABLES_REQUIREMENTS = "与目标处于同一区域"
|
||||
PARAMS = {"target_avatar": "AvatarName"}
|
||||
FEEDBACK_ACTIONS = ["MoveAwayFromRegion", "Battle"]
|
||||
story_prompt: str = ""
|
||||
|
||||
def _settle_feedback(self, target_avatar: "Avatar", feedback_name: str) -> None:
|
||||
fb = str(feedback_name).strip()
|
||||
|
||||
@@ -24,10 +24,12 @@ class DualCultivation(MutualAction):
|
||||
"""
|
||||
|
||||
ACTION_NAME = "双修"
|
||||
COMMENT = "以情入道的双修之术,仅合欢宗弟子可发起,对象可接受或拒绝,如接受会共同度过一段甜蜜的恋爱时光"
|
||||
COMMENT = "以情入道的双修之术,仅合欢宗弟子可发起,对象可接受或拒绝"
|
||||
DOABLES_REQUIREMENTS = "发起者为合欢宗;目标在感知范围内且为异性"
|
||||
PARAMS = {"target_avatar": "AvatarName"}
|
||||
FEEDBACK_ACTIONS = ["Accept", "Reject"]
|
||||
# 提供用于故事生成的提示词,供 StoryTeller 模板参考
|
||||
story_prompt: str | None = "两位修士在双修过程中情愫暗生,以含蓄、雅致的文字描绘一段暧昧而不露骨的双修体验,体现彼此性格、境界差异与甜蜜的恋爱时光。"
|
||||
|
||||
def _get_template_path(self) -> Path:
|
||||
# 复用 mutual_action 模板,仅需返回 Accept/Reject
|
||||
@@ -104,7 +106,7 @@ class DualCultivation(MutualAction):
|
||||
# 生成恋爱/双修小故事:使用通用故事模板
|
||||
avatar_infos = StoryTeller.build_avatar_infos(self.avatar, target)
|
||||
start_text = self._start_event_content or result_event.content
|
||||
story = StoryTeller.tell_story(avatar_infos, start_text, result_event.content)
|
||||
story = StoryTeller.tell_story(avatar_infos, start_text, result_event.content, self.story_prompt)
|
||||
story_event = Event(self.world.month_stamp, story)
|
||||
events.append(story_event)
|
||||
else:
|
||||
|
||||
@@ -42,6 +42,8 @@ class MutualAction(DefineAction, LLMAction, TargetingMixin):
|
||||
"Escape": "逃离",
|
||||
"Battle": "战斗",
|
||||
}
|
||||
# 若该互动动作可能生成小故事,可在子类中覆盖该提示词
|
||||
story_prompt: str | None = None
|
||||
|
||||
def _get_template_path(self) -> Path:
|
||||
return CONFIG.paths.templates / "mutual_action.txt"
|
||||
|
||||
@@ -45,7 +45,7 @@ class StoryTeller:
|
||||
return infos
|
||||
|
||||
@staticmethod
|
||||
def tell_story(avatar_infos: Dict[str, dict], event: str, res: str) -> str:
|
||||
def tell_story(avatar_infos: Dict[str, dict], event: str, res: str, story_prompt: str = "") -> str:
|
||||
"""
|
||||
基于 `static/templates/story.txt` 模板生成小故事。
|
||||
始终使用 fast 模式以提升速度。
|
||||
@@ -57,6 +57,7 @@ class StoryTeller:
|
||||
"event": event,
|
||||
"res": res,
|
||||
"style": random.choice(story_styles),
|
||||
"story_prompt": story_prompt or "",
|
||||
}
|
||||
data = get_prompt_and_call_llm(template_path, infos, mode="fast")
|
||||
story = data["story"].strip()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
你是一个故事讲述者,这是一个仙侠世界,你需要把一个事件扩展为一个约150字的小故事。
|
||||
写作风格提示:{style}
|
||||
额外主题提示:{story_prompt}
|
||||
|
||||
你需要进行决策的NPC的dict[AvatarName, info]为
|
||||
{avatar_infos}
|
||||
|
||||
Reference in New Issue
Block a user