in Frontend/utils/essays_catalog.py [0:0]
def load_essay_from_catalog(index: int, catalog: List[Dict] = ESSAYS_CATALOG) -> None:
"""
Loads an essay from the catalog into the session state.
Args:
catalog (List[Dict]): The catalog of essays.
index (int): The index of the essay to load.
"""
try:
essay = catalog[index]
st.session_state["tema"] = essay.get('tema', '')
st.session_state["textos_motivadores"] = essay.get('textosMotivadores', '')
st.session_state["redacao_aluno"] = essay.get('texto', '').replace("\n", "\n\n")
st.session_state["proposta"] = essay.get('textoProposta', '')
except IndexError:
st.error("Exemplo inválido.")