Spaces:
Runtime error
Runtime error
Update ui/components.py
Browse files- ui/components.py +27 -7
ui/components.py
CHANGED
|
@@ -101,14 +101,34 @@ def show_chat_history(chat_history):
|
|
| 101 |
st.markdown("---")
|
| 102 |
|
| 103 |
def show_follow_up_section(key_suffix=""):
|
| 104 |
-
"""Show the follow-up question section"""
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
)
|
| 109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
return follow_up if send_btn else None
|
| 111 |
-
|
| 112 |
def show_save_options():
|
| 113 |
"""Show save chat options"""
|
| 114 |
st.subheader("Save Analysis")
|
|
|
|
| 101 |
st.markdown("---")
|
| 102 |
|
| 103 |
def show_follow_up_section(key_suffix=""):
|
| 104 |
+
"""Show the follow-up question section with enhanced UI"""
|
| 105 |
+
st.markdown("---") # Visual separator
|
| 106 |
+
|
| 107 |
+
# Chat container
|
| 108 |
+
chat_container = st.container()
|
| 109 |
+
with chat_container:
|
| 110 |
+
# Show conversation context if exists
|
| 111 |
+
if 'conversation_context' in st.session_state:
|
| 112 |
+
for msg in st.session_state.conversation_context:
|
| 113 |
+
if msg['role'] == 'user':
|
| 114 |
+
st.markdown(f"**You:** {msg['content']}")
|
| 115 |
+
else:
|
| 116 |
+
st.markdown(f"**Assistant:** {msg['content']}")
|
| 117 |
+
st.markdown("---")
|
| 118 |
+
|
| 119 |
+
# Input section
|
| 120 |
+
col1, col2 = st.columns([4, 1])
|
| 121 |
+
with col1:
|
| 122 |
+
follow_up = st.text_input(
|
| 123 |
+
"Ask a follow-up question:",
|
| 124 |
+
key=f"followup_input_{key_suffix}",
|
| 125 |
+
placeholder="Type your question here..."
|
| 126 |
+
)
|
| 127 |
+
with col2:
|
| 128 |
+
send_btn = st.button("Send", key=f"followup_send_btn_{key_suffix}")
|
| 129 |
+
|
| 130 |
return follow_up if send_btn else None
|
| 131 |
+
|
| 132 |
def show_save_options():
|
| 133 |
"""Show save chat options"""
|
| 134 |
st.subheader("Save Analysis")
|