Sergidev commited on
Commit
4af388b
1 Parent(s): ef742a5

Update modules/pmbl.py

Browse files
Files changed (1) hide show
  1. modules/pmbl.py +6 -6
modules/pmbl.py CHANGED
@@ -31,22 +31,22 @@ class PMBL:
31
  c = conn.cursor()
32
 
33
  if mode == "full":
34
- c.execute("SELECT timestamp, prompt, response FROM chats ORDER BY id")
35
  history = []
36
  for row in c.fetchall():
37
- history.append({"role": "user", "content": row[1]})
38
- history.append({"role": "PMB", "content": f"[{row[0]}] {row[2]}"})
39
  else:
40
  c.execute("SELECT id, prompt, response FROM chats WHERE topic != 'Untitled'")
41
  chats = c.fetchall()
42
  relevant_chat_id = self.find_relevant_chat(chats, user_message)
43
 
44
  if relevant_chat_id:
45
- c.execute("SELECT timestamp, prompt, response FROM chats WHERE id = ?", (relevant_chat_id,))
46
  row = c.fetchone()
47
  history = [
48
- {"role": "user", "content": row[1]},
49
- {"role": "PMB", "content": f"[{row[0]}] {row[2]}"}
50
  ]
51
  else:
52
  history = []
 
31
  c = conn.cursor()
32
 
33
  if mode == "full":
34
+ c.execute("SELECT prompt, response FROM chats ORDER BY id")
35
  history = []
36
  for row in c.fetchall():
37
+ history.append({"role": "user", "content": row[0]})
38
+ history.append({"role": "PMB", "content": row[1]})
39
  else:
40
  c.execute("SELECT id, prompt, response FROM chats WHERE topic != 'Untitled'")
41
  chats = c.fetchall()
42
  relevant_chat_id = self.find_relevant_chat(chats, user_message)
43
 
44
  if relevant_chat_id:
45
+ c.execute("SELECT prompt, response FROM chats WHERE id = ?", (relevant_chat_id,))
46
  row = c.fetchone()
47
  history = [
48
+ {"role": "user", "content": row[0]},
49
+ {"role": "PMB", "content": row[1]}
50
  ]
51
  else:
52
  history = []