notify: force env topic
This commit is contained in:
@@ -31,7 +31,6 @@ Principles:
|
|||||||
"action": "schedule_reminder",
|
"action": "schedule_reminder",
|
||||||
"reminder": {
|
"reminder": {
|
||||||
"message": "short friendly text",
|
"message": "short friendly text",
|
||||||
"topic": "adhdbot-<user id>",
|
|
||||||
"trigger": {
|
"trigger": {
|
||||||
"value": "ISO 8601 timestamp"
|
"value": "ISO 8601 timestamp"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,9 +35,7 @@ class NotificationDispatcher:
|
|||||||
def sendReminder(userId: str, reminder: Dict[str, Any]):
|
def sendReminder(userId: str, reminder: Dict[str, Any]):
|
||||||
metadata = reminder.get("metadata") or {}
|
metadata = reminder.get("metadata") or {}
|
||||||
actualUser = userId or reminder.get("user") or metadata.get("user") or "user"
|
actualUser = userId or reminder.get("user") or metadata.get("user") or "user"
|
||||||
topic = reminder.get("topic") or metadata.get("topic")
|
topic = NotificationDispatcher.buildTopic(actualUser)
|
||||||
if not topic:
|
|
||||||
topic = ntfyTopicTemplate.format(userId=actualUser)
|
|
||||||
url = NotificationDispatcher.buildTopicUrl(topic)
|
url = NotificationDispatcher.buildTopicUrl(topic)
|
||||||
if not url:
|
if not url:
|
||||||
return
|
return
|
||||||
@@ -76,6 +74,16 @@ class NotificationDispatcher:
|
|||||||
topicSlug = topic.lstrip("/")
|
topicSlug = topic.lstrip("/")
|
||||||
return f"{base}/{topicSlug}"
|
return f"{base}/{topicSlug}"
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def buildTopic(actualUser: str) -> str:
|
||||||
|
template = ntfyTopicTemplate or ""
|
||||||
|
if not template:
|
||||||
|
return ""
|
||||||
|
try:
|
||||||
|
return template.format(userId=actualUser)
|
||||||
|
except (KeyError, IndexError, ValueError):
|
||||||
|
return template
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def buildHeaders(message_text: str) -> Dict[str, str]:
|
def buildHeaders(message_text: str) -> Dict[str, str]:
|
||||||
headers = {"Title": NotificationDispatcher.buildTitleHeader(message_text)}
|
headers = {"Title": NotificationDispatcher.buildTitleHeader(message_text)}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ ADHDbot is a FastAPI + Discord assistant that captures ADHD-friendly notes, brea
|
|||||||
## At a glance
|
## At a glance
|
||||||
- Opinionated system prompt + tooling contract wired through OpenRouter (Claude Haiku 4.5 by default).
|
- Opinionated system prompt + tooling contract wired through OpenRouter (Claude Haiku 4.5 by default).
|
||||||
- FastAPI surface area for chat runs, notes, and persistent action items—served by Docker or a bare Python venv.
|
- FastAPI surface area for chat runs, notes, and persistent action items—served by Docker or a bare Python venv.
|
||||||
- Notification bridge that turns `schedule_reminder` JSON into ntfy pushes (bring your own topic + auth).
|
- Notification bridge that turns `schedule_reminder` JSON into ntfy pushes (single ntfy topic defined via env vars).
|
||||||
- Hourly agentic workflow that summarizes memory + actions, then nudges the user via a dedicated prompt.
|
- Hourly agentic workflow that summarizes memory + actions, then nudges the user via a dedicated prompt.
|
||||||
- Static React console (`web_App.tsx`) for local demos: send prompts, review transcripts, and edit action items without curl.
|
- Static React console (`web_App.tsx`) for local demos: send prompts, review transcripts, and edit action items without curl.
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ Environment variables of interest (see `.env.example`):
|
|||||||
- `PROMPT_CATEGORY`, `PROMPT_NAME`, `PROMPT_CONTEXT` – defaults for the `/run` endpoint.
|
- `PROMPT_CATEGORY`, `PROMPT_NAME`, `PROMPT_CONTEXT` – defaults for the `/run` endpoint.
|
||||||
- `LOG_PROMPTS` (default `1`) – when truthy, every outgoing prompt is logged to stdout so you can audit the final instructions sent to the LLM.
|
- `LOG_PROMPTS` (default `1`) – when truthy, every outgoing prompt is logged to stdout so you can audit the final instructions sent to the LLM.
|
||||||
- `NTFY_BASE_URL` – when set (e.g., `https://ntfy.scorpi.us`), reminder payloads with `action: schedule_reminder` will be POSTed to ntfy.
|
- `NTFY_BASE_URL` – when set (e.g., `https://ntfy.scorpi.us`), reminder payloads with `action: schedule_reminder` will be POSTed to ntfy.
|
||||||
- `NTFY_TOPIC_TEMPLATE` – optional format string for topics (default `adhdbot-{userId}`); override per reminder via `reminder.metadata.topic`.
|
- `NTFY_TOPIC_TEMPLATE` – format string for the ntfy topic slug (default `adhdbot-{userId}`); all reminders are forced through this template so every notification lands in the same subscribed channel.
|
||||||
- `NTFY_AUTH_TOKEN` – optional bearer token if your ntfy server requires auth.
|
- `NTFY_AUTH_TOKEN` – optional bearer token if your ntfy server requires auth.
|
||||||
- `AGENTIC_CATEGORY` / `AGENTIC_PROMPT_NAME` / `AGENTIC_MODE_HINT` – control which prompt handles the hourly agentic sweep (defaults: `agentic/hourly_review`, hint "Agentic review").
|
- `AGENTIC_CATEGORY` / `AGENTIC_PROMPT_NAME` / `AGENTIC_MODE_HINT` – control which prompt handles the hourly agentic sweep (defaults: `agentic/hourly_review`, hint "Agentic review").
|
||||||
- `AGENTIC_NOTES_LIMIT` – how many of the most recent notes to include in the sweep payload (default `5`).
|
- `AGENTIC_NOTES_LIMIT` – how many of the most recent notes to include in the sweep payload (default `5`).
|
||||||
@@ -121,7 +121,6 @@ When the assistant schedules a reminder it emits a single JSON block:
|
|||||||
"action": "schedule_reminder",
|
"action": "schedule_reminder",
|
||||||
"reminder": {
|
"reminder": {
|
||||||
"message": "short friendly text",
|
"message": "short friendly text",
|
||||||
"topic": "adhdbot-<user id>",
|
|
||||||
"trigger": {
|
"trigger": {
|
||||||
"value": "2025-11-11T02:41:42+00:00"
|
"value": "2025-11-11T02:41:42+00:00"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user