INNER CODE UNIT · Python
init_chat_history
mfmezger/conversational-agent-langchain · frontend/assistant.py:34
def init_chat_history() -> None:
"""Initialize chat history in session state."""
if "messages" not in st.session_state:
st.session_state.messages = []
def display_chat_history() -> None:
"""Display chat messages from history."""
for message in st.session_state.messages:
with st.chat_message(message["role"]):
st.markdown(message["content"])
def display_sources(documents: list[dict]) -> None:
"""Display the sources."""
if documents:
with st.expander("Sources"):
for doc in documents: