feat: editable guardrails, refs NOISSUE

This commit is contained in:
2026-04-11 11:12:50 +02:00
parent 798bb218f8
commit e35db0a361
9 changed files with 1559 additions and 103 deletions

View File

@@ -48,6 +48,7 @@ OLLAMA_URL=http://localhost:11434
OLLAMA_MODEL=llama3
# Gitea
# Host-only values such as git.disi.dev are normalized to https://git.disi.dev.
GITEA_URL=https://gitea.yourserver.com
GITEA_TOKEN=your_gitea_api_token
GITEA_OWNER=ai-software-factory
@@ -69,6 +70,19 @@ N8N_WEBHOOK_URL=http://n8n.yourserver.com/webhook/telegram
# Telegram
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
TELEGRAM_CHAT_ID=your_chat_id
# Optional: queue Telegram prompts until Home Assistant reports battery/surplus targets are met.
PROMPT_QUEUE_ENABLED=false
PROMPT_QUEUE_AUTO_PROCESS=true
PROMPT_QUEUE_FORCE_PROCESS=false
PROMPT_QUEUE_POLL_INTERVAL_SECONDS=60
PROMPT_QUEUE_MAX_BATCH_SIZE=1
HOME_ASSISTANT_URL=http://homeassistant.local:8123
HOME_ASSISTANT_TOKEN=your_home_assistant_long_lived_token
HOME_ASSISTANT_BATTERY_ENTITY_ID=sensor.home_battery_soc
HOME_ASSISTANT_SURPLUS_ENTITY_ID=sensor.home_pv_surplus_power
HOME_ASSISTANT_BATTERY_FULL_THRESHOLD=95
HOME_ASSISTANT_SURPLUS_THRESHOLD_WATTS=100
```
### Build and Run
@@ -93,6 +107,7 @@ docker-compose up -d
The backend now interprets free-form Telegram text with Ollama before generation.
If `TELEGRAM_CHAT_ID` is set, the Telegram-trigger workflow only reacts to messages from that specific chat.
If `PROMPT_QUEUE_ENABLED=true`, Telegram prompts are stored in a durable queue and processed only when the Home Assistant battery and surplus thresholds are satisfied, unless you force processing via `/queue/process` or send `process_now=true`.
2. **Monitor progress via Web UI:**
@@ -104,6 +119,12 @@ docker-compose up -d
If you deploy the container with PostgreSQL environment variables set, the service now selects PostgreSQL automatically even though SQLite remains the default for local/test usage.
The health tab now shows separate application, n8n, Gitea, and Home Assistant/queue diagnostics so misconfigured integrations are visible without checking container logs.
The dashboard Health tab also exposes operator controls for the prompt queue, including manual batch processing, forced processing, and retrying failed items.
Guardrail and system prompts are no longer environment-only in practice: the factory can persist DB-backed overrides for the editable LLM prompt set, expose them at `/llm/prompts`, and edit them from the dashboard System tab. Environment values still act as defaults and as the reset target.
## API Endpoints
| Endpoint | Method | Description |