Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lfoppiano committed Nov 21, 2023
1 parent 77334fb commit a70fbd3
Showing 1 changed file with 43 additions and 24 deletions.
67 changes: 43 additions & 24 deletions streamlit_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,35 @@
}
)

# css = '''
# <style>
# [data-testid="ScrollToBottomContainer"] {
# overflow: hidden;
# }
# </style>
# '''
#
# st.markdown(css, unsafe_allow_html=True)
css_modify_left_column = '''
<style>
[data-testid="stHorizontalBlock"] > div:nth-child(1) {
overflow: hidden;
background-color: red;
height: 70vh;
}
</style>
'''
css_modify_right_column = '''
<style>
[data-testid="stHorizontalBlock"]> div:first-child {
background-color: red;
position: fixed
height: 70vh;
}
</style>
'''
css_disable_scrolling_container = '''
<style>
[data-testid="ScrollToBottomContainer"] {
overflow: hidden;
}
</style>
'''


# st.markdown(css_lock_column_fixed, unsafe_allow_html=True)
# st.markdown(css2, unsafe_allow_html=True)


def new_file():
Expand Down Expand Up @@ -231,9 +251,9 @@ def play_old_messages():
# is_api_key_provided = st.session_state['api_key']

st.button(
'Reset chat memory.',
on_click=clear_memory(),
help="Clear the conversational memory. Currently implemented to retrain the 4 most recent messages.")
'Reset chat memory.',
on_click=clear_memory(),
help="Clear the conversational memory. Currently implemented to retrain the 4 most recent messages.")

left_column, right_column = st.columns([1, 1])

Expand Down Expand Up @@ -322,15 +342,15 @@ def get_pdf_display(binary):
left_column.markdown(get_pdf_display(st.session_state['binary']), unsafe_allow_html=True)

with right_column:
css = '''
<style>
[data-testid="column"] {
overflow: auto;
height: 70vh;
}
</style>
'''
st.markdown(css, unsafe_allow_html=True)
# css = '''
# <style>
# [data-testid="column"] {
# overflow: auto;
# height: 70vh;
# }
# </style>
# '''
# st.markdown(css, unsafe_allow_html=True)

# st.markdown(
# """
Expand All @@ -341,7 +361,6 @@ def get_pdf_display(binary):
# unsafe_allow_html=True,
# )


if st.session_state.loaded_embeddings and question and len(question) > 0 and st.session_state.doc_id:
for message in st.session_state.messages:
with st.chat_message(message["role"]):
Expand All @@ -365,8 +384,8 @@ def get_pdf_display(binary):
elif mode == "LLM":
with st.spinner("Generating response..."):
_, text_response = st.session_state['rqa'][model].query_document(question, st.session_state.doc_id,
context_size=context_size,
memory=st.session_state.memory)
context_size=context_size,
memory=st.session_state.memory)

if not text_response:
st.error("Something went wrong. Contact Luca Foppiano ([email protected]) to report the issue.")
Expand Down

0 comments on commit a70fbd3

Please sign in to comment.