File tree 2 files changed +6
-4
lines changed
extensions/session_manager
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -270,7 +270,11 @@ def fetch_recent(
270
270
last_k_filter = Num ("count" ) > int (count ) - top_k
271
271
combined = self ._tag_filter & last_k_filter
272
272
273
- query = FilterQuery (return_fields = return_fields , filter_expression = combined )
273
+ query = FilterQuery (
274
+ return_fields = return_fields ,
275
+ filter_expression = combined ,
276
+ params = {"sortby" : "timestamp" },
277
+ )
274
278
hits = self ._index .query (query )
275
279
if raw :
276
280
return hits
@@ -291,9 +295,6 @@ def _format_context(
291
295
Union[str, List[str]]: A single string transcription of the session
292
296
or list of strings if as_text is false.
293
297
"""
294
- if hits :
295
- hits .sort (key = lambda x : x ["timestamp" ]) # TODO move sorting to query.py
296
-
297
298
if as_text :
298
299
text_statements = [self ._preamble ["_content" ]]
299
300
for hit in hits :
Original file line number Diff line number Diff line change @@ -179,6 +179,7 @@ def query(self) -> Query:
179
179
.return_fields (* self ._return_fields )
180
180
.paging (self ._first , self ._limit )
181
181
.dialect (self ._dialect )
182
+ .sort_by (self ._params .get ("sortby" ))
182
183
)
183
184
return query
184
185
You can’t perform that action at this time.
0 commit comments