added post guards to deck.llm
This commit is contained in:
+1
-3
@@ -131,9 +131,7 @@ class LLMChat:
|
|||||||
url = f"{self.provider.get('base_url').rstrip('/')}/chat/completions"
|
url = f"{self.provider.get('base_url').rstrip('/')}/chat/completions"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = self.guarded_post(url, self.headers, payload)
|
data = self.guarded_post(url, self.headers, payload)
|
||||||
data = response.json()
|
|
||||||
response.close() # Important for CircuitPython memory
|
|
||||||
bot_content = data['choices'][0]['message']['content']
|
bot_content = data['choices'][0]['message']['content']
|
||||||
self.messages.append({"role": "assistant", "content": bot_content})
|
self.messages.append({"role": "assistant", "content": bot_content})
|
||||||
return (True, bot_content)
|
return (True, bot_content)
|
||||||
|
|||||||
Reference in New Issue
Block a user