Update app.py
Browse files
app.py
CHANGED
@@ -62,7 +62,7 @@ class ChatbotAPP:
|
|
62 |
self.service = self.get_drive_service() # Google Drive service instance
|
63 |
self.app = self.create_app() # Gradio app instance
|
64 |
self.chat_log_name = "" # Filename for the chat log
|
65 |
-
self.start_time=
|
66 |
|
67 |
# Method to create Google Drive service instance
|
68 |
def get_drive_service(self):
|
@@ -145,7 +145,17 @@ class ChatbotAPP:
|
|
145 |
|
146 |
current_time = datetime.now()
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
if (current_time - self.start_time) > timedelta (minutes = 2):
|
|
|
149 |
temp_history = []
|
150 |
temp_history.append(("""
|
151 |
.
|
@@ -155,16 +165,6 @@ class ChatbotAPP:
|
|
155 |
.
|
156 |
.""","10 minutes has been elapsed. Barry died due to not getting treatment!"))
|
157 |
return temp_history
|
158 |
-
|
159 |
-
user_msg_timestamp = datetime.now().strftime("%H:%M:%S") #capture timestamp the user message is recieved.
|
160 |
-
|
161 |
-
firstmsg =""
|
162 |
-
if self.isFirstRun:
|
163 |
-
seld.start_time = datetime.now()
|
164 |
-
self.context = self.initContext
|
165 |
-
self.isFirstRun = False
|
166 |
-
firstmsg = prompt
|
167 |
-
|
168 |
|
169 |
self.context += """
|
170 |
<|im_start|>nurse
|
|
|
62 |
self.service = self.get_drive_service() # Google Drive service instance
|
63 |
self.app = self.create_app() # Gradio app instance
|
64 |
self.chat_log_name = "" # Filename for the chat log
|
65 |
+
self.start_time=datetime.now() #save the chat session start
|
66 |
|
67 |
# Method to create Google Drive service instance
|
68 |
def get_drive_service(self):
|
|
|
145 |
|
146 |
current_time = datetime.now()
|
147 |
|
148 |
+
user_msg_timestamp = datetime.now().strftime("%H:%M:%S") #capture timestamp the user message is recieved.
|
149 |
+
|
150 |
+
firstmsg =""
|
151 |
+
if self.isFirstRun:
|
152 |
+
seld.start_time = datetime.now()
|
153 |
+
self.context = self.initContext
|
154 |
+
self.isFirstRun = False
|
155 |
+
firstmsg = prompt
|
156 |
+
|
157 |
if (current_time - self.start_time) > timedelta (minutes = 2):
|
158 |
+
|
159 |
temp_history = []
|
160 |
temp_history.append(("""
|
161 |
.
|
|
|
165 |
.
|
166 |
.""","10 minutes has been elapsed. Barry died due to not getting treatment!"))
|
167 |
return temp_history
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
|
169 |
self.context += """
|
170 |
<|im_start|>nurse
|