Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Kr-Yogsa/ECE-BOT/llms.txt
Use this file to discover all available pages before exploring further.
POST /chat is the core endpoint of ECE-BOT. It accepts a user message, routes it through the hardware-specific intent classifier, and returns a structured reply. If the intent model’s confidence falls below 0.75, ECE-BOT automatically falls back to Gemini to generate a response. Each message is persisted to a session — either a new one created automatically from the first message, or an existing one you supply via session_id.
This endpoint requires a valid Bearer token. The active hardware assistant is determined by the session’s
hardware_id (for existing sessions) or the bot selected via POST /select-bot (for new sessions).POST /chat
Request headers
Bearer token obtained at login. Format:
Bearer <token>.Must be
application/json.Request body
The user’s question or message. Must be a non-empty string. Leading and trailing whitespace is stripped before processing.
The ID of an existing session to continue. If omitted or
null, ECE-BOT creates a new session and auto-generates a title from the first message. If provided, the message is appended to that session and the session’s hardware_id overrides the currently selected bot.Response
The AI-generated response to the user’s message.
Which AI backend produced the reply:
"intent_model"— the hardware-specific intent classifier answered with confidence above0.75."LLM"— Gemini was used as a fallback because intent confidence was at or below0.75.
The intent model’s confidence score, rounded to four decimal places. Range:
0.0–1.0. When the source is "LLM", this reflects the intent model’s score that triggered the fallback (or 0.0 if the model produced no prediction).The hardware assistant that handled the request (e.g.,
"melfa", "plc", "cnc").The ID of the session this message was saved to. Use this value in subsequent requests to continue the conversation.
Errors
| Status | Condition |
|---|---|
400 | message field is missing or empty. |
401 | Missing or invalid Bearer token. |
404 | The supplied session_id does not exist or belongs to another user, or no valid hardware assistant is currently selected. |
503 | The chat service is temporarily unavailable. Retry after a short delay. |
How the reply source is determined
ECE-BOT first runs the user message through the hardware-specific intent classifier:- If
confidence > 0.75— the intent model’s matched response is returned as-is andsourceis"intent_model". - If
confidence ≤ 0.75or the model produces no prediction — Gemini receives the message along with conversation history andsourceis"LLM".
confidence field always reflects the intent model’s score, regardless of which source ultimately answered.
Session auto-creation
Whensession_id is null or omitted, ECE-BOT derives a title from the first message by:
- Removing common stop words and words that match the hardware ID.
- Taking up to three meaningful words from the cleaned message.
- Prepending the hardware ID in uppercase (e.g.,
"CNC Error Code").
"New chat".
Example
200 — intent model reply
200 — LLM fallback reply
503 response