Update modules/pmbl.py
Browse files- 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
|
35 |
history = []
|
36 |
for row in c.fetchall():
|
37 |
-
history.append({"role": "user", "content": row[
|
38 |
-
history.append({"role": "PMB", "content":
|
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
|
46 |
row = c.fetchone()
|
47 |
history = [
|
48 |
-
{"role": "user", "content": row[
|
49 |
-
{"role": "PMB", "content":
|
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 = []
|