Update funcs.py
Browse files
funcs.py
CHANGED
@@ -73,11 +73,10 @@ def generate_triggers_img(items):
|
|
73 |
return triggers_img
|
74 |
|
75 |
class session_processor:
|
76 |
-
|
77 |
-
self.session_conversation = []
|
78 |
|
79 |
# Generate therapist responses and patient triggers
|
80 |
-
def get_doc_response_emotions(
|
81 |
|
82 |
user_messages = []
|
83 |
user_messages.append(user_message)
|
@@ -97,7 +96,7 @@ class session_processor:
|
|
97 |
|
98 |
therapy_session_conversation.append(["User: "+user_message, "Therapist: "+doc_response])
|
99 |
|
100 |
-
|
101 |
|
102 |
print(f"User's message: {user_message}")
|
103 |
print(f"RAG Matching message: {dials_embeddings.iloc[top_match_index]['Patient']}")
|
@@ -107,9 +106,9 @@ class session_processor:
|
|
107 |
return '', therapy_session_conversation, emotions_msg
|
108 |
|
109 |
# Generate summarization and recommendations for teh session
|
110 |
-
def summarize_and_recommend(
|
111 |
session_time = str(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
|
112 |
-
session_conversation_processed =
|
113 |
session_conversation_processed.insert(0, "Session_time: "+session_time)
|
114 |
session_conversation_processed ='\n'.join(session_conversation_processed)
|
115 |
print("Session conversation:", session_conversation_processed)
|
@@ -167,5 +166,5 @@ class session_processor:
|
|
167 |
full_recommendations = full_recommendations.replace('User:', '').strip()
|
168 |
print("\n")
|
169 |
print("Full recommendations:", full_recommendations)
|
170 |
-
|
171 |
return full_summary, full_recommendations
|
|
|
73 |
return triggers_img
|
74 |
|
75 |
class session_processor:
|
76 |
+
session_conversation = []
|
|
|
77 |
|
78 |
# Generate therapist responses and patient triggers
|
79 |
+
def get_doc_response_emotions(user_message, therapy_session_conversation):
|
80 |
|
81 |
user_messages = []
|
82 |
user_messages.append(user_message)
|
|
|
96 |
|
97 |
therapy_session_conversation.append(["User: "+user_message, "Therapist: "+doc_response])
|
98 |
|
99 |
+
session_conversation.extend(["User: "+user_message, "Therapist: "+doc_response])
|
100 |
|
101 |
print(f"User's message: {user_message}")
|
102 |
print(f"RAG Matching message: {dials_embeddings.iloc[top_match_index]['Patient']}")
|
|
|
106 |
return '', therapy_session_conversation, emotions_msg
|
107 |
|
108 |
# Generate summarization and recommendations for teh session
|
109 |
+
def summarize_and_recommend():
|
110 |
session_time = str(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
|
111 |
+
session_conversation_processed = session_conversation.copy()
|
112 |
session_conversation_processed.insert(0, "Session_time: "+session_time)
|
113 |
session_conversation_processed ='\n'.join(session_conversation_processed)
|
114 |
print("Session conversation:", session_conversation_processed)
|
|
|
166 |
full_recommendations = full_recommendations.replace('User:', '').strip()
|
167 |
print("\n")
|
168 |
print("Full recommendations:", full_recommendations)
|
169 |
+
session_conversation=[]
|
170 |
return full_summary, full_recommendations
|