File size: 831 Bytes
b3391d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# session_state.py

import streamlit as st

def initialize_session_state():
    if "avatars" not in st.session_state:
        st.session_state.avatars = {'user': None, 'assistant': None}

    if 'user_text' not in st.session_state:
        st.session_state.user_text = None

    if "max_response_length" not in st.session_state:
        st.session_state.max_response_length = 1000

    if "system_message" not in st.session_state:
        st.session_state.system_message = "friendly AI conversing with a human user"

    if "starter_message" not in st.session_state:
        st.session_state.starter_message = "Hello, there! How can I help you today?"

    if "chat_history" not in st.session_state:
        st.session_state.chat_history = [{"role": "assistant", "content": st.session_state.starter_message}]