diff --git a/docs/NEXTCLOUD_TALK_BOT.md b/docs/NEXTCLOUD_TALK_BOT.md index 8b1140d..1f29b00 100644 --- a/docs/NEXTCLOUD_TALK_BOT.md +++ b/docs/NEXTCLOUD_TALK_BOT.md @@ -38,29 +38,31 @@ Create `home/{username}/channels.json` on the Cortex server: ### 2. Register the bot in Nextcloud -Run on the Nextcloud server (inside the Docker container): +The Nextcloud container for DgrZone is `dgr_zone_nextcloud-app-1`. Substitute your own container name if different. + +First, list existing bots to check if one is already registered (note the bot ID): ```bash -docker exec -it --user www-data php /var/www/html/occ talk:bot:install \ - "{persona_name}" \ +docker exec -it --user www-data dgr_zone_nextcloud-app-1 php /var/www/html/occ talk:bot:list +``` + +If re-registering (new URL or new secret), uninstall the old bot first: + +```bash +docker exec -it --user www-data dgr_zone_nextcloud-app-1 php /var/www/html/occ talk:bot:uninstall +``` + +Install the bot: + +```bash +docker exec -it --user www-data dgr_zone_nextcloud-app-1 php /var/www/html/occ talk:bot:install \ + "Inara" \ "" \ "https://cortex.dgrzone.com/webhook/nextcloud/{username}" \ --feature webhook --feature response --feature reaction ``` -After installing, enable the bot in each Talk conversation via the conversation settings UI (three-dot menu → Bots). - -To list installed bots and verify registration: - -```bash -docker exec -it --user www-data php /var/www/html/occ talk:bot:list -``` - -To remove a bot (e.g. to re-register with a new secret or URL): - -```bash -docker exec -it --user www-data php /var/www/html/occ talk:bot:remove -``` +After installing, enable the bot in each Talk conversation: open the conversation → three-dot menu → **Bots** → enable the bot by name. --- @@ -131,6 +133,20 @@ location ^~ /webhook/ { --- +## Logs + +Two log streams are useful when debugging: + +```bash +# Nextcloud server logs (bot registration errors, webhook rejections) +docker exec -it --user www-data dgr_zone_nextcloud-app-1 php /var/www/html/occ log:tail + +# Cortex service logs (LLM errors, signature failures, timeouts) +journalctl --user -u cortex -f +``` + +--- + ## Troubleshooting | Symptom | Cause | Fix | @@ -139,7 +155,7 @@ location ^~ /webhook/ { | Webhook not received | Bot not enabled for conversation | Enable in Talk conversation settings (Bots) | | Incoming 401 | `bot_secret` in `channels.json` doesn't match `occ install` secret | Re-register with matching secret | | Reply POST returns 401 (first try) | HMAC computed over wrong data | Sign `random + message_text` only (not raw JSON body) | -| Reply POST returns 401 (persistent) | Brute force protection triggered | `occ security:bruteforce:reset ` | +| Reply POST returns 401 (persistent) | Brute force protection triggered | `docker exec -it --user www-data dgr_zone_nextcloud-app-1 php /var/www/html/occ security:bruteforce:reset ` | | Bot auto-disabled by Nextcloud | Webhook held open too long | Verify `BackgroundTasks` is used — Cortex returns 200 immediately | | Claude falls back to Gemini | Stale/expired auth token | Run `claude auth login`; token is auto-refreshed from `~/.claude/.credentials.json` | | No response at all | Nginx blocking the path | Add a `location ^~ /webhook/` block before any auth block |