Spaces:
Runtime error
Runtime error
Update ui/components.py
Browse files- ui/components.py +13 -4
ui/components.py
CHANGED
|
@@ -74,7 +74,6 @@ def show_chat_history(chat_history):
|
|
| 74 |
"""Display chat history"""
|
| 75 |
st.subheader("Chat History")
|
| 76 |
for idx, chat in enumerate(chat_history):
|
| 77 |
-
# Create a unique identifier for each analysis
|
| 78 |
timestamp = chat.get('timestamp', 'No date')
|
| 79 |
analysis_type = chat.get('analysis_type', 'Analysis')
|
| 80 |
label = f"{analysis_type} from {timestamp[:16]}"
|
|
@@ -85,16 +84,26 @@ def show_chat_history(chat_history):
|
|
| 85 |
if chat.get('question'):
|
| 86 |
st.write(f"Follow-up: {chat['question']}")
|
| 87 |
|
| 88 |
-
def show_follow_up_section(
|
| 89 |
"""Show the follow-up question section"""
|
| 90 |
st.subheader("Continue Analysis")
|
| 91 |
follow_up = st.text_input(
|
| 92 |
"Ask a follow-up question:",
|
| 93 |
-
key="
|
| 94 |
)
|
| 95 |
-
send_btn = st.button("Send", key="
|
| 96 |
return follow_up if send_btn else None
|
| 97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
def create_expertise_selector():
|
| 99 |
"""Create expertise level selector"""
|
| 100 |
if 'expertise_level' not in st.session_state:
|
|
|
|
| 74 |
"""Display chat history"""
|
| 75 |
st.subheader("Chat History")
|
| 76 |
for idx, chat in enumerate(chat_history):
|
|
|
|
| 77 |
timestamp = chat.get('timestamp', 'No date')
|
| 78 |
analysis_type = chat.get('analysis_type', 'Analysis')
|
| 79 |
label = f"{analysis_type} from {timestamp[:16]}"
|
|
|
|
| 84 |
if chat.get('question'):
|
| 85 |
st.write(f"Follow-up: {chat['question']}")
|
| 86 |
|
| 87 |
+
def show_follow_up_section(key_suffix=""):
|
| 88 |
"""Show the follow-up question section"""
|
| 89 |
st.subheader("Continue Analysis")
|
| 90 |
follow_up = st.text_input(
|
| 91 |
"Ask a follow-up question:",
|
| 92 |
+
key=f"followup_input_{key_suffix}"
|
| 93 |
)
|
| 94 |
+
send_btn = st.button("Send", key=f"followup_send_btn_{key_suffix}")
|
| 95 |
return follow_up if send_btn else None
|
| 96 |
|
| 97 |
+
def show_save_options():
|
| 98 |
+
"""Show save chat options"""
|
| 99 |
+
st.subheader("Save Analysis")
|
| 100 |
+
save_name = st.text_input(
|
| 101 |
+
"Save chat as (optional):",
|
| 102 |
+
key="save_chat_name"
|
| 103 |
+
)
|
| 104 |
+
save_btn = st.button("Save", key="save_chat_btn")
|
| 105 |
+
return save_name if save_btn else None
|
| 106 |
+
|
| 107 |
def create_expertise_selector():
|
| 108 |
"""Create expertise level selector"""
|
| 109 |
if 'expertise_level' not in st.session_state:
|