From c15e8004cefd5f721c6975e753aa9c4dd321e21d Mon Sep 17 00:00:00 2001 From: Luxferre Date: Sat, 27 Dec 2025 12:02:03 +0200 Subject: [PATCH] added post guards to deck.llm --- deck/llm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deck/llm.py b/deck/llm.py index 5a641e6..11bb792 100644 --- a/deck/llm.py +++ b/deck/llm.py @@ -86,7 +86,7 @@ class LLMChat: self.messages = [{"role": "system", "content": self.config.get('system_prompt', '')}] return (True, "Context cleared") - def guarded_post(url, headers={}, payload={}): + def guarded_post(self, url, headers={}, payload={}): """ Performs a POST request trying to bypass possible 429 errors with heuristics. """ @@ -106,7 +106,7 @@ class LLMChat: except: pass time.sleep(sleeptime) - return guarded_post(url, headers, payload) + return self.guarded_post(url, headers, payload) else: data = response.json() response.close() @@ -131,7 +131,7 @@ class LLMChat: url = f"{self.provider.get('base_url').rstrip('/')}/chat/completions" try: - response = guarded_post(url, self.headers, payload) + response = self.guarded_post(url, self.headers, payload) data = response.json() response.close() # Important for CircuitPython memory bot_content = data['choices'][0]['message']['content']