Vela commited on
Commit
5574342
·
1 Parent(s): 0a9bd9c

modified chat assistant

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/common_functions.py CHANGED
@@ -76,7 +76,7 @@ def set_page_title(page_title=PAGE_TITLE, icon="⚕️", color="#2E7D32", font_s
76
  font-size: {font_size};
77
  font-weight: bold;
78
  margin-bottom: 15px;
79
- text-align: center;
80
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2); /* Adds depth for a cleaner look */
81
  padding: 10px 0; /* Improved spacing */
82
  ">
 
76
  font-size: {font_size};
77
  font-weight: bold;
78
  margin-bottom: 15px;
79
+ text-align: left;
80
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2); /* Adds depth for a cleaner look */
81
  padding: 10px 0; /* Improved spacing */
82
  ">
src/frontend/pages/Chat_With_Us.py CHANGED
@@ -28,6 +28,11 @@ def fetch_health_advice(conversation_history):
28
  st.error(f"API Connection Error: {e}")
29
  return "I'm currently unable to respond. Please try again later."
30
 
 
 
 
 
 
31
  def render_chatbot():
32
 
33
  if "conversation_history" not in st.session_state:
@@ -35,12 +40,7 @@ def render_chatbot():
35
 
36
  if 'conversation_id' not in st.session_state:
37
  st.session_state.conversation_id = datetime.now().strftime("%Y-%m-%d")
38
-
39
- conversation_ids = common_functions.get_bucket_items()
40
- if conversation_ids:
41
- for conversation_id in conversation_ids[-3:]:
42
- common_functions.display_chat_history(conversation_id)
43
-
44
  # Display chat history
45
  for message in st.session_state.conversation_history [-NUMBER_OF_MESSAGES_TO_DISPLAY:]:
46
  role = message["role"]
@@ -55,7 +55,7 @@ def render_chatbot():
55
  "How can I help you today?")
56
  st.session_state.system_message = system_message
57
  with st.chat_message('ai'):
58
- common_functions.typewriter_effect(st.session_state.system_message)
59
 
60
  if user_input:
61
 
@@ -79,4 +79,5 @@ def render_chatbot():
79
  with st.chat_message('assistant',avatar=doctor_avatar_image):
80
  common_functions.typewriter_effect(assistant_reply)
81
 
82
- render_chatbot()
 
 
28
  st.error(f"API Connection Error: {e}")
29
  return "I'm currently unable to respond. Please try again later."
30
 
31
+ conversation_ids = common_functions.get_bucket_items()
32
+ if conversation_ids:
33
+ for conversation_id in conversation_ids[-3:]:
34
+ common_functions.display_chat_history(conversation_id)
35
+
36
  def render_chatbot():
37
 
38
  if "conversation_history" not in st.session_state:
 
40
 
41
  if 'conversation_id' not in st.session_state:
42
  st.session_state.conversation_id = datetime.now().strftime("%Y-%m-%d")
43
+
 
 
 
 
 
44
  # Display chat history
45
  for message in st.session_state.conversation_history [-NUMBER_OF_MESSAGES_TO_DISPLAY:]:
46
  role = message["role"]
 
55
  "How can I help you today?")
56
  st.session_state.system_message = system_message
57
  with st.chat_message('ai'):
58
+ common_functions.typewriter_effect(st.session_state.system_message,speed=0)
59
 
60
  if user_input:
61
 
 
79
  with st.chat_message('assistant',avatar=doctor_avatar_image):
80
  common_functions.typewriter_effect(assistant_reply)
81
 
82
+ if __name__ == "__main__":
83
+ render_chatbot()