Spaces:
Sleeping
Sleeping
Vela
commited on
Commit
·
0a9bd9c
1
Parent(s):
4c3070e
modified display chat history function
Browse files
src/frontend/app/__pycache__/common_functions.cpython-313.pyc
CHANGED
Binary files a/src/frontend/app/__pycache__/common_functions.cpython-313.pyc and b/src/frontend/app/__pycache__/common_functions.cpython-313.pyc differ
|
|
src/frontend/app/__pycache__/pinecone_data_handler.cpython-313.pyc
CHANGED
Binary files a/src/frontend/app/__pycache__/pinecone_data_handler.cpython-313.pyc and b/src/frontend/app/__pycache__/pinecone_data_handler.cpython-313.pyc differ
|
|
src/frontend/app/common_functions.py
CHANGED
@@ -350,33 +350,19 @@ def display_message_box(role, content):
|
|
350 |
border_color = "#1E88E5" if role.lower() == 'user' else "#43A047"
|
351 |
text_align = "left" if role.lower() == 'user' else "right"
|
352 |
flex_direction = "row" if role.lower() == 'user' else "row-reverse"
|
353 |
-
avatar = "path_to_user_avatar.png" if role.lower() == 'user' else "path_to_assistant_avatar.png"
|
354 |
|
355 |
st.markdown(f"""
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
<div style="
|
366 |
-
background-color: {background_color};
|
367 |
-
padding: 15px;
|
368 |
-
border-left: 5px solid {border_color};
|
369 |
-
border-radius: 8px;
|
370 |
-
box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.1);
|
371 |
-
width: 100%;">
|
372 |
-
|
373 |
-
<strong style="color: #333; font-size: 16px;">{role}:</strong>
|
374 |
-
<div style="margin-top: 5px; color: #555; font-size: 14px;">
|
375 |
-
{content}
|
376 |
</div>
|
377 |
-
|
378 |
-
</div>
|
379 |
-
""", unsafe_allow_html=True)
|
380 |
|
381 |
def get_chat_history_from_db(conversation_id: str, retries=3, delay=5):
|
382 |
API_URL = "http://127.0.0.1:8000/chat-history/retrieve"
|
|
|
350 |
border_color = "#1E88E5" if role.lower() == 'user' else "#43A047"
|
351 |
text_align = "left" if role.lower() == 'user' else "right"
|
352 |
flex_direction = "row" if role.lower() == 'user' else "row-reverse"
|
|
|
353 |
|
354 |
st.markdown(f"""
|
355 |
+
<div style="
|
356 |
+
background-color: {background_color};
|
357 |
+
padding: 15px;
|
358 |
+
border-left: 5px solid #4CAF50;
|
359 |
+
border-radius: 8px;
|
360 |
+
margin-bottom: 10px;
|
361 |
+
box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.1);">
|
362 |
+
<strong style="color: #333; font-size: 16px;">{role}:</strong>
|
363 |
+
<div style="margin-top: 5px; color: #555; font-size: 14px;">{content}</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
364 |
</div>
|
365 |
+
""", unsafe_allow_html=True)
|
|
|
|
|
366 |
|
367 |
def get_chat_history_from_db(conversation_id: str, retries=3, delay=5):
|
368 |
API_URL = "http://127.0.0.1:8000/chat-history/retrieve"
|
src/frontend/pages/Chat_With_Us.py
CHANGED
@@ -47,7 +47,6 @@ def render_chatbot():
|
|
47 |
avatar_image = "src/frontend/images/chat_doctor_logo.png" if role == "assistant" else "src/frontend/images/healthy.png" if role == "user" else None
|
48 |
with st.chat_message(role, avatar=avatar_image):
|
49 |
common_functions.display_message_box(role,message['content'])
|
50 |
-
# st.write(message["content"])
|
51 |
|
52 |
# User Input
|
53 |
user_input = st.chat_input("Ask your health-related question:")
|
|
|
47 |
avatar_image = "src/frontend/images/chat_doctor_logo.png" if role == "assistant" else "src/frontend/images/healthy.png" if role == "user" else None
|
48 |
with st.chat_message(role, avatar=avatar_image):
|
49 |
common_functions.display_message_box(role,message['content'])
|
|
|
50 |
|
51 |
# User Input
|
52 |
user_input = st.chat_input("Ask your health-related question:")
|