diff --git a/mind_palace/app.py b/mind_palace/app.py index 5423d3b..5c95a62 100644 --- a/mind_palace/app.py +++ b/mind_palace/app.py @@ -16,12 +16,6 @@ st.text("Coming soon...") -if "messages" not in st.session_state.keys(): # Initialize the chat messages history - st.session_state.messages = [ - {"role": "assistant", "content": "Ask me a question about these PDFs"} - ] - - @st.cache_resource(show_spinner=False) def load_index(model): with st.spinner( @@ -35,6 +29,17 @@ def load_index(model): vector_index = load_index(gpt_model) query_engine = CitationQueryEngine.from_args(index=vector_index, verbose=True) + +def get_welcome_message(): + return "Ask me a question about these PDFs" + + +if "messages" not in st.session_state.keys(): # Initialize the chat messages history + st.session_state.messages = [ + {"role": "assistant", "content": get_welcome_message()} + ] + + if prompt := st.chat_input( "Your question" ): # Prompt for user input and save to chat history