Skip to content

Commit

Permalink
Add a log that combines the main GM log and all the scene logs into o…
Browse files Browse the repository at this point in the history
…ne, sorted by date.

PiperOrigin-RevId: 655908677
Change-Id: Ieb881638db94f38d3259e42e54a727fffcf162d3
  • Loading branch information
vezhnick authored and copybara-github committed Jul 25, 2024
1 parent 53697b2 commit 978705c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion concordia/factory/environment/basic_game_master.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""A Generic Environment Factory."""

from collections.abc import Callable, Sequence
import operator

from concordia import components as generic_components
from concordia.agents import basic_agent
Expand Down Expand Up @@ -238,11 +239,25 @@ def create_html_log(
)

history_sources = [primary_environment] + list(secondary_environments)

joint_histories = []
for history in history_sources:
joint_histories.extend(history.get_history())

sorted_joint_history = sorted(
joint_histories, key=operator.itemgetter('date')
)

histories_html = [
html_lib.PythonObjectToHTMLConverter(sorted_joint_history).convert()
] + [
html_lib.PythonObjectToHTMLConverter(history.get_history()).convert()
for history in history_sources
]
histories_names = [history.name for history in history_sources]

histories_names = ['Joint log'] + [
history.name for history in history_sources
]

gm_mem_html = html_lib.PythonObjectToHTMLConverter(
primary_gm_memories
Expand Down

0 comments on commit 978705c

Please sign in to comment.