feat(support): isolated stateless customer chat with JWT gatekeeper
This commit is contained in:
1 parent
8bf1843b9b
commit
8242a1271f
21 files changed
+413
No files matched your search
@@ -0,0 +1,20 @@
|
||||
# Stage customer support chat
|
||||
|
||||
`POST /api/support-chat/ask` accepts only `{message, scope}`. Scope defaults to `public`; `orders` and `wallet` are explicit, read-only account intents. Existing Passport JWT strategy validates signature, expiry, revocation and user existence. A supplied invalid credential never becomes a guest. API-key authentication is deliberately not supported. Private rows are selected by the validated principal, limited to five orders, and formatted on the backend: they are **never sent to a model**.
|
||||
|
||||
Each public request creates a new Hermes AIAgent with a fresh UUID, no history, no persistence, no memory, context files, soul, review or tools. Support process has a temporary minimal home separate from Telegram. Backend owns all data access; no model DB connection. Invalid upstream envelopes, model failures and non-JSON/default error replies become one fixed Persian unavailable message. Unknown data must be acknowledged, never replaced with mock catalog data.
|
||||
|
||||
Research is deliberately narrow: fixed pet-product comparison query plus recognised brands only. Customer prose/URLs never become search arguments. No extraction, browser or model-invoked web tools exist. Domain policy blocks URLs, football and unrelated topics before inference. This is intentionally not a general web assistant.
|
||||
|
||||
## Configuration (secrets not committed)
|
||||
|
||||
Build from repository root:
|
||||
`docker build -f scripts/support-chat/Dockerfile -t canina-support-bot:stage .`
|
||||
|
||||
Use `compose.bot.override.example.yml` with the existing canina-bot compose file. Generate an independent random >=32-character secret as `SUPPORT_INTERNAL_KEY` in bot `support.env`; set the same value as `SUPPORT_CHAT_KEY` in stage `.support-chat.env`. Both files mode 0600. Use `compose.stage.override.example.yml` alongside existing stage docker-compose.yml. No ports or Traefik routes on the support API (8643). Do not expose the generic Hermes API; disable `platforms.api_server.enabled`. Model toolsets for api_server/telegram must be empty and persistent memory off on this customer container. Telegram gateway remains supervised independently; never alter the internal canina-hermes service.
|
||||
|
||||
Stage deploy: build backend/frontend from tested branch before switching images. Existing deploy.sh resets configs and seeds DB; do not use it for this deployment. Preserve existing stage compose/environment and use the support override. Never invoke a prod deployment.
|
||||
|
||||
Tests: backend Jest (including Supertest auth/isolation boundary), frontend Vitest, `python3 -m unittest discover -s scripts/support-chat -v`. Real model/research integration must also be checked from backend network before acceptance. Tests use synthetic account identities; no private customer records should be printed.
|
||||
|
||||
Rollback: restore stage backend/frontend previous image IDs; remove support compose override to disable the widget endpoint. Bot previous image may be restored independently; retain Telegram volume/token. Never restore unsafe generic API/tool defaults.
|
||||
Reference in new issue
Block a user