Coerce context message limit to int

This commit is contained in:
Your Name 2025-12-20 11:44:46 -06:00
parent c0018e2241
commit 6a5e2a067a

View file

@ -350,6 +350,10 @@ class GroqdConversationEntity(
history = messages[1:] history = messages[1:]
limit = options.get(CONF_CONTEXT_MESSAGES, DEFAULT_CONTEXT_MESSAGES) limit = options.get(CONF_CONTEXT_MESSAGES, DEFAULT_CONTEXT_MESSAGES)
try:
limit = int(limit)
except (TypeError, ValueError):
limit = DEFAULT_CONTEXT_MESSAGES
if limit == 0: if limit == 0:
history = [] history = []
elif limit > 0: elif limit > 0: