Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ LLM_API_KEY=
LLM_MODEL=
# Ollama base URL (only needed if not using default http://localhost:11434)
OLLAMA_BASE_URL=
# Timeout for local Ollama instances. Default is 120000 for 120 seconds. Increase if your local model needs more time to complete.
OLLAMA_TIMEOUT=

# === Telegram Alerts (optional, requires LLM) ===
# Create a bot via @BotFather, get chat ID via @userinfobot
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@ All settings are in `.env` with sensible defaults:
| `LLM_PROVIDER` | disabled | `anthropic`, `openai`, `gemini`, `codex`, `openrouter`, `minimax`, `mistral`, or `grok` |
| `LLM_API_KEY` | — | API key (not needed for codex) |
| `LLM_MODEL` | per-provider default | Override model selection |
| `OLLAMA_BASE_URL` | Ollama base URL (only needed if not using default http://localhost:11434) |
| `OLLAMA_TIMEOUT` | imeout for local Ollama instances. Default is 120000 for 120 seconds. |
| `TELEGRAM_BOT_TOKEN` | disabled | For Telegram alerts + bot commands |
| `TELEGRAM_CHAT_ID` | — | Your Telegram chat ID |
| `TELEGRAM_CHANNELS` | — | Extra channel IDs to monitor (comma-separated) |
Expand Down
1 change: 1 addition & 0 deletions crucix.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default {
apiKey: process.env.LLM_API_KEY || null,
model: process.env.LLM_MODEL || null,
baseUrl: process.env.OLLAMA_BASE_URL || null,
timeout: parseInt(process.env.OLLAMA_TIMEOUT || '0', 10) || null,
},

telegram: {
Expand Down
2 changes: 1 addition & 1 deletion lib/llm/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function createLLMProvider(llmConfig) {
case "mistral":
return new MistralProvider({ apiKey, model });
case "ollama":
return new OllamaProvider({ model, baseUrl: llmConfig.baseUrl });
return new OllamaProvider({ model, baseUrl: llmConfig.baseUrl, timeout: llmConfig.timeout });
case 'grok':
return new GrokProvider({ apiKey, model });
default:
Expand Down
4 changes: 2 additions & 2 deletions lib/llm/ollama.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ export class OllamaProvider extends LLMProvider {
this.name = 'ollama';
this.baseUrl = (config.baseUrl || 'http://localhost:11434').replace(/\/+$/, '');
this.model = config.model || 'llama3.1:8b';
this.timeout = config.timeout || parseInt(process.env.OLLAMA_TIMEOUT || '120000', 10);
}

get isConfigured() { return !!this.model; }

async complete(systemPrompt, userMessage, opts = {}) {
const res = await fetch(`${this.baseUrl}/v1/chat/completions`, {
method: 'POST',
Expand All @@ -26,7 +26,7 @@ export class OllamaProvider extends LLMProvider {
{ role: 'user', content: userMessage },
],
}),
signal: AbortSignal.timeout(opts.timeout || 120000),
signal: AbortSignal.timeout(opts.timeout || this.timeout),
});

if (!res.ok) {
Expand Down