added some guards to llm chat and an llmcfg.json example

This commit is contained in:
Luxferre
2025-12-27 12:25:51 +02:00
parent 9ae0bbee8c
commit 762dbaddc2
3 changed files with 31 additions and 2 deletions
+1 -1
View File
@@ -253,7 +253,7 @@ The editor mode supports the following subset of POSIX ed commands in the standa
### `app.llmchat` ### `app.llmchat`
A simple interactive chat with remote LLMs. Configured via `llmcfg.json` (see the `deck.llm` module reference) placed into the storage root. Run with the single `llmchat()` method it exports. A simple interactive chat with remote LLMs. Configured via `llmcfg.json` (see the `deck.llm` module reference and the `llmcfg.example.json` file) placed into the storage root. Run with the single `llmchat()` method it exports.
Supported chat commands: Supported chat commands:
+1 -1
View File
@@ -105,7 +105,7 @@ class LLMChat:
sleeptime = float(re.search(r'\d+\.\d+', restext).group(0)) sleeptime = float(re.search(r'\d+\.\d+', restext).group(0))
except: except:
pass pass
time.sleep(sleeptime) time.sleep(sleeptime + 0.1)
return self.guarded_post(url, headers, payload) return self.guarded_post(url, headers, payload)
else: else:
data = response.json() data = response.json()
+29
View File
@@ -0,0 +1,29 @@
{
"reasoning_enabled": false,
"temperature": 0.7,
"active_provider": "deepinfra",
"providers": {
"pollinations": {
"base_url": "https://text.pollinations.ai/openai",
"api_key": "",
"model": "openai-fast",
"extra_headers": {}
},
"deepinfra": {
"base_url": "https://api.deepinfra.com/v1/openai",
"api_key": "",
"model": "MiniMaxAI/MiniMax-M2",
"extra_headers": {
"Origin": "https://deepinfra.com",
"Referer": "https://deepinfra.com/",
"X-Deepinfra-Source": "web-page"
}
},
"airforce": {
"base_url": "https://api.airforce/v1",
"api_key": "",
"model": "gemini-3-flash",
"extra_headers": {}
},
"system_prompt": "You are a concise, embedded assistant."
}