Spaces:
Runtime error
Runtime error
Update ui/components.py
Browse files- ui/components.py +10 -1
ui/components.py
CHANGED
|
@@ -7,6 +7,15 @@ def create_sidebar():
|
|
| 7 |
"""Create the sidebar with analysis options"""
|
| 8 |
with st.sidebar:
|
| 9 |
st.title("🚀 Chart Analysis AI")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
upload_option = st.radio(
|
| 11 |
"Choose input method:",
|
| 12 |
("Upload Images", "Take Screenshot", "Ask Question"),
|
|
@@ -18,7 +27,7 @@ def create_sidebar():
|
|
| 18 |
uploaded_files = st.file_uploader(
|
| 19 |
"Upload your charts",
|
| 20 |
type=["png", "jpg", "jpeg"],
|
| 21 |
-
accept_multiple_files=True,
|
| 22 |
key="sidebar_file_uploader"
|
| 23 |
)
|
| 24 |
if uploaded_files:
|
|
|
|
| 7 |
"""Create the sidebar with analysis options"""
|
| 8 |
with st.sidebar:
|
| 9 |
st.title("🚀 Chart Analysis AI")
|
| 10 |
+
|
| 11 |
+
# Add New Chat button at the top
|
| 12 |
+
if st.button("📝 New Chat", key="new_chat_button", type="primary"):
|
| 13 |
+
# Save current chat if it exists
|
| 14 |
+
if st.session_state.chat_history:
|
| 15 |
+
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
| 16 |
+
st.session_state['last_saved_chat'] = f"chat_{timestamp}"
|
| 17 |
+
return "new_chat", None, [], [], "Individual Analysis"
|
| 18 |
+
|
| 19 |
upload_option = st.radio(
|
| 20 |
"Choose input method:",
|
| 21 |
("Upload Images", "Take Screenshot", "Ask Question"),
|
|
|
|
| 27 |
uploaded_files = st.file_uploader(
|
| 28 |
"Upload your charts",
|
| 29 |
type=["png", "jpg", "jpeg"],
|
| 30 |
+
accept_multiple_files=True,
|
| 31 |
key="sidebar_file_uploader"
|
| 32 |
)
|
| 33 |
if uploaded_files:
|