1
0
Fork 0

make core systems optional, format logic labels as templates
Run Docker Build / build (push) Failing after 7s Details
Run Python Build / build (push) Successful in 19s Details

This commit is contained in:
Sean Sube 2024-06-22 18:10:47 -05:00
parent c78de18377
commit d76bcf0b8a
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
6 changed files with 9 additions and 11 deletions

1
.gitignore vendored
View File

@ -5,5 +5,6 @@ venv/
client/node_modules/
client/out/
taleweave/custom_*
taleweave/systems/custom/
.coverage
coverage.*

View File

@ -75,7 +75,7 @@ TaleWeave AI has game systems for:
| Core | Life Sim | RPG | Environment | Generic |
| -------- | --------------- | ------ | ----------- | ------- |
| Acting | Hunger & Thirst | Health | Humidity | Logic |
| Acting | Hunger & Thirst | Health | Moisture | Logic |
| Planning | Hygiene | Quests | Temperature | |
| Summary | Mood | | Time of day | |
| | Sleeping | | Weather | |

View File

@ -60,8 +60,6 @@ if True:
from taleweave.models.prompt import PromptLibrary
from taleweave.plugins import load_plugin
from taleweave.state import save_world_state
from taleweave.systems.core.action import init_action
from taleweave.systems.core.planning import init_planning
def int_or_inf(value: str) -> float | int:
@ -269,10 +267,6 @@ def main():
# set up the game systems
systems: List[GameSystem] = []
systems.extend(init_planning())
systems.extend(init_action())
# load extra systems from plugins
for system_name in args.systems or []:
logger.info(f"loading systems from {system_name}")
module_systems = load_plugin(system_name)

View File

@ -195,7 +195,7 @@ def simulate_action(world: World, turn: int, data: Any | None = None):
logger.exception(f"error during action for character {character.name}")
def init_action():
def init():
return [
GameSystem(
ACTION_SYSTEM_NAME, initialize=initialize_action, simulate=simulate_action

View File

@ -191,7 +191,7 @@ def simulate_planning(world: World, turn: int, data: Any | None = None):
)
def init_planning():
def init():
# TODO: add format method that renders the recent notes and upcoming events
return [
GameSystem(

View File

@ -11,6 +11,7 @@ from yaml import Loader, load
from taleweave.game_system import FormatPerspective, GameSystem
from taleweave.models.entity import Attributes, World, WorldEntity, dataclass
from taleweave.plugins import get_plugin_function
from taleweave.utils.template import format_str
logger = getLogger(__name__)
@ -158,9 +159,11 @@ def format_logic(
for label in rules.labels:
if match_logic(entity, label):
if perspective == FormatPerspective.SECOND_PERSON and label.backstory:
labels.append(label.backstory)
backstory = format_str(label.backstory, entity=entity)
labels.append(backstory)
elif perspective == FormatPerspective.THIRD_PERSON and label.description:
labels.append(label.description)
description = format_str(label.description, entity=entity)
labels.append(description)
else:
logger.debug("label has no relevant description: %s", label)