diff --git a/custom_components/groqd/conversation.py b/custom_components/groqd/conversation.py index f957c37..df0af16 100644 --- a/custom_components/groqd/conversation.py +++ b/custom_components/groqd/conversation.py @@ -350,6 +350,10 @@ class GroqdConversationEntity( history = messages[1:] limit = options.get(CONF_CONTEXT_MESSAGES, DEFAULT_CONTEXT_MESSAGES) + try: + limit = int(limit) + except (TypeError, ValueError): + limit = DEFAULT_CONTEXT_MESSAGES if limit == 0: history = [] elif limit > 0: