Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs-chat.die-coaching-akademie.de/llms.txt

Use this file to discover all available pages before exploring further.

Chat request flow

1

Widget sends a message

static/chatbot.js posts to /chat with:
{
  "message": "Wann ist der nächste Infoabend?",
  "history": [],
  "state": {}
}
2

FastAPI checks request-level guards

app.py checks IP-based in-memory rate limiting and prompt-injection patterns before delegating to answer_chat.
3

Chat service builds search context

search_text_from_request decides whether history is needed. Explicit new topics do not reuse old history, preventing stale answers from bleeding into a new question.
4

Deterministic answers run first

Payment terms, price, and infoabend logic can answer without OpenAI when the current question matches those topics.
5

Model answer is built if needed

If there is no deterministic answer, the service selects relevant knowledge-base entries and calls OpenAI with a constrained system prompt.
6

Analytics event is recorded

If ANALYTICS_ENABLED=true, a scrubbed JSONL event is appended to data/chat_events.jsonl.

Knowledge-base flow

data/knowledge_base.json
        +
data/website_knowledge_base.json
        |
        v
load_knowledge_base()
        |
        v
select_relevant_entries()
        |
        v
prompt context + source links

Analytics event shape

The stored event is deliberately small:
{
  "timestamp": "2026-05-02T12:00:00+00:00",
  "day": "2026-05-02",
  "question": "Was kostet die Coaching-Ausbildung?",
  "question_length": 36,
  "keywords": ["kostet", "coaching-ausbildung"],
  "topics": ["Coaching-Ausbildung", "Preise"],
  "source_count": 1,
  "fallback": false,
  "duration_ms": 42
}
Analytics events do not include IP addresses, User-Agent headers, cookies, or full chat history.