Skip to content

Commit 83f846f

Browse files
authored
Merge pull request #8 from xerexcoded/xerexcoded/llm-wiki-rag
Make note listing order deterministic
2 parents 23cbbc8 + 0430ea5 commit 83f846f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pplx_cli/notes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ def list_notes(self, tag: Optional[str] = None) -> List[dict]:
9797
conn.row_factory = sqlite3.Row
9898
if tag:
9999
cursor = conn.execute(
100-
"SELECT * FROM notes WHERE tags LIKE ? ORDER BY created_at DESC",
100+
"SELECT * FROM notes WHERE tags LIKE ? ORDER BY created_at DESC, id DESC",
101101
(f'%"{tag}"%',)
102102
)
103103
else:
104-
cursor = conn.execute("SELECT * FROM notes ORDER BY created_at DESC")
104+
cursor = conn.execute("SELECT * FROM notes ORDER BY created_at DESC, id DESC")
105105
return [dict(row) for row in cursor.fetchall()]
106106

107107
def update_note(self, note_id: int, title: Optional[str] = None,
@@ -176,4 +176,4 @@ def search_similar_notes(self, query: str, top_k: int = 3) -> List[Tuple[dict, f
176176
with sqlite3.connect(self.db_path) as conn:
177177
conn.row_factory = sqlite3.Row
178178
cursor = conn.execute("SELECT * FROM notes ORDER BY created_at DESC LIMIT ?", (top_k,))
179-
return [(dict(row), 0.0) for row in cursor.fetchall()]
179+
return [(dict(row), 0.0) for row in cursor.fetchall()]

0 commit comments

Comments
 (0)