new RPG system
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
# generated module - copied to services/rpg_story.py by apply script
|
||||
PLACEHOLDER = True
|
||||
@@ -0,0 +1,2 @@
|
||||
"""Apply linear story refactor — run once: python tools/apply_linear_story.py"""
|
||||
print("placeholder")
|
||||
@@ -0,0 +1,37 @@
|
||||
from pathlib import Path
|
||||
Path("../services/rpg_context.py").write_text('''"""Shared context blocks for RPG narrator / plot LLM calls."""
|
||||
|
||||
import json
|
||||
|
||||
from services.rpg_story import (
|
||||
format_step_for_narrator,
|
||||
normalize_story_arc,
|
||||
step_progress,
|
||||
)
|
||||
|
||||
|
||||
def format_narrator_context(
|
||||
arc: dict | None,
|
||||
quests: list | None,
|
||||
status_quo: str = "",
|
||||
) -> str:
|
||||
arc = normalize_story_arc(arc or {}) if arc else {}
|
||||
return format_step_for_narrator(arc, quests, status_quo)
|
||||
|
||||
|
||||
def format_arc_summary_for_runtime(arc: dict | None) -> str:
|
||||
arc = normalize_story_arc(arc or {}) if arc else {}
|
||||
if not arc:
|
||||
return ""
|
||||
cur, total = step_progress(arc)
|
||||
return json.dumps(
|
||||
{
|
||||
"title": arc.get("title"),
|
||||
"global_story": (arc.get("global_story") or "")[:300],
|
||||
"step": f"{cur}/{total}",
|
||||
"status": arc.get("status", "active"),
|
||||
},
|
||||
ensure_ascii=False,
|
||||
)
|
||||
''', encoding='utf-8')
|
||||
print('done')
|
||||
Reference in New Issue
Block a user