Skip to content

Commit

Permalink
Update app.py
Browse files Browse the repository at this point in the history
  • Loading branch information
lasyaEd committed Dec 11, 2024
1 parent b24f6f7 commit f9364c4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions frontend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
with open(metadata_path, "w") as f:
json.dump([], f)


def load_metadata(metadata_path=metadata_path):
"""
Loads metadata from the specified JSON file.
Expand All @@ -80,14 +79,12 @@ def load_metadata(metadata_path=metadata_path):
print(f"Metadata handling error: {str(e)}")
return []


def get_base64_image(image_path):
import base64

with open(image_path, "rb") as img_file:
return base64.b64encode(img_file.read()).decode()


col1, col2 = st.columns([4, 1])
with col2:
st.markdown(
Expand Down Expand Up @@ -248,7 +245,8 @@ def get_base64_image(image_path):
# Reset button
if st.sidebar.button("Reset Chat"):
st.session_state.messages = []
st.sidebar.success("Chat session reset!")
st.session_state.pop("api_key", None) # Remove API key on reset
st.sidebar.success("Chat session reset! Please re-enter your OpenAI API Key.")

# Display chat messages from history on app rerun
for message in st.session_state.messages:
Expand Down

0 comments on commit f9364c4

Please sign in to comment.