Sergidev commited on
Commit
46390b9
1 Parent(s): c658301

Fix chat history.

Files changed (1) hide show
  1. modules/pmbl.py +3 -3
modules/pmbl.py CHANGED
@@ -22,7 +22,7 @@ class PMBL:
22
  conn.close()
23
 
24
  def get_chat_history(self, mode="full", user_message=""):
25
- conn = sqlite3.connect('../chat_history.db')
26
  c = conn.cursor()
27
 
28
  if mode == "full":
@@ -75,7 +75,7 @@ class PMBL:
75
  return score
76
 
77
  def save_chat_history(self, prompt, response):
78
- conn = sqlite3.connect('../chat_history.db')
79
  c = conn.cursor()
80
  timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
81
  c.execute("INSERT INTO chats (timestamp, prompt, response, topic) VALUES (?, ?, ?, 'Untitled')", (timestamp, prompt, response))
@@ -120,7 +120,7 @@ class PMBL:
120
  self.save_chat_history(prompt, response_text)
121
 
122
  def sleep_mode(self):
123
- conn = sqlite3.connect('../chat_history.db')
124
  c = conn.cursor()
125
  c.execute("SELECT id, prompt, response FROM chats WHERE topic = 'Untitled'")
126
  untitled_chats = c.fetchall()
 
22
  conn.close()
23
 
24
  def get_chat_history(self, mode="full", user_message=""):
25
+ conn = sqlite3.connect('chat_history.db')
26
  c = conn.cursor()
27
 
28
  if mode == "full":
 
75
  return score
76
 
77
  def save_chat_history(self, prompt, response):
78
+ conn = sqlite3.connect('chat_history.db')
79
  c = conn.cursor()
80
  timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
81
  c.execute("INSERT INTO chats (timestamp, prompt, response, topic) VALUES (?, ?, ?, 'Untitled')", (timestamp, prompt, response))
 
120
  self.save_chat_history(prompt, response_text)
121
 
122
  def sleep_mode(self):
123
+ conn = sqlite3.connect('chat_history.db')
124
  c = conn.cursor()
125
  c.execute("SELECT id, prompt, response FROM chats WHERE topic = 'Untitled'")
126
  untitled_chats = c.fetchall()