mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 21:29:13 +00:00
Check if n is populated before making a comparison
This commit is contained in:
@@ -110,12 +110,13 @@ def chat_history(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Get latest N messages if N > 0
|
if n:
|
||||||
if n > 0 and meta_log.get("chat"):
|
# Get latest N messages if N > 0
|
||||||
meta_log["chat"] = meta_log["chat"][-n:]
|
if n > 0 and meta_log.get("chat"):
|
||||||
# Else return all messages except latest N
|
meta_log["chat"] = meta_log["chat"][-n:]
|
||||||
elif n < 0 and meta_log.get("chat"):
|
# Else return all messages except latest N
|
||||||
meta_log["chat"] = meta_log["chat"][:n]
|
elif n < 0 and meta_log.get("chat"):
|
||||||
|
meta_log["chat"] = meta_log["chat"][:n]
|
||||||
|
|
||||||
update_telemetry_state(
|
update_telemetry_state(
|
||||||
request=request,
|
request=request,
|
||||||
|
|||||||
Reference in New Issue
Block a user