Skip to main content

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.

ECE-BOT ships with three built-in hardware chatbots — MELFA, PLC, and CNC — each driven entirely by a JSON file in the data/ directory. No code changes are required to add a new bot or extend an existing one. The model is retrained from these files every time the application restarts, so editing the JSON and restarting the app is all it takes to change chatbot behaviour.

How the configuration works

Two layers of JSON control the hardware chatbot system. data/hardware_config.json is the registry. It lists every enabled bot with its machine ID, display name, description, and a pointer to its data file:
data/hardware_config.json
{
  "hardware": [
    {
      "id": "melfa",
      "name": "MELFA",
      "description": "Support for Mitsubishi MELFA industrial robots.",
      "file": "melfa.json"
    },
    {
      "id": "plc",
      "name": "PLC",
      "description": "Support for programmable logic controller questions.",
      "file": "plc.json"
    },
    {
      "id": "cnc",
      "name": "CNC",
      "description": "Support for CNC machine troubleshooting and usage.",
      "file": "cnc.json"
    }
  ]
}
Each bot data file (e.g. data/melfa.json) contains a system prompt (context) and an array of intents. The context is passed to Gemini when the local model falls back to the LLM. Each intent has a tag, a list of patterns (training phrases), and a list of responses:
data/melfa.json (excerpt)
{
  "context": "MELFA is a Mitsubishi industrial robot line used for automation, pick and place tasks, movement programming, and production workflows.",
  "intents": [
    {
      "tag": "melfa_startup",
      "patterns": [
        "how do i start melfa robot",
        "melfa startup steps",
        "how to power on melfa",
        "start robot sequence"
      ],
      "responses": [
        "For a basic MELFA startup, check safety conditions, power on the controller, release emergency stop, and then enable the robot from the teach pendant."
      ]
    },
    {
      "tag": "melfa_alarm",
      "patterns": [
        "melfa alarm reset",
        "how to clear robot alarm",
        "robot has alarm",
        "reset melfa error"
      ],
      "responses": [
        "To clear a MELFA alarm, first identify the alarm cause, remove the issue safely, and then perform the alarm reset from the controller or teach pendant."
      ]
    }
  ]
}

Confidence threshold and Gemini fallback

The local chatbot model produces a confidence score for each user message. If that score is 0.75 or higher, ECE-BOT returns one of the matched intent’s responses directly. If the score falls below 0.75, the query is forwarded to Gemini with the bot’s context field as the system prompt, and Gemini’s reply is returned instead.
Add more patterns to an intent to improve the local model’s confidence on common phrasings. The more varied the patterns, the less often the bot will need to fall back to Gemini.

Adding a new hardware bot

1

Create the bot data file

Create a new JSON file in data/ following the same structure as the existing bot files. Set context to a description of the machine that will serve as the Gemini system prompt, then define your intents.
data/laser.json
{
  "context": "Laser cutting machines use a focused laser beam to cut or engrave materials such as metal, wood, and acrylic in industrial settings.",
  "intents": [
    {
      "tag": "laser_startup",
      "patterns": [
        "how to start laser cutter",
        "laser machine startup",
        "power on laser cutter"
      ],
      "responses": [
        "Before starting the laser cutter, check the coolant level, ensure the work area is clear, power on the machine, and then run the homing sequence from the control panel."
      ]
    }
  ]
}
2

Register the bot in hardware_config.json

Add an entry for the new bot to the hardware array in data/hardware_config.json. The id must be unique and is used as the machine identifier throughout the app.
data/hardware_config.json
{
  "hardware": [
    { "id": "melfa", "name": "MELFA", "description": "Support for Mitsubishi MELFA industrial robots.", "file": "melfa.json" },
    { "id": "plc",   "name": "PLC",   "description": "Support for programmable logic controller questions.", "file": "plc.json" },
    { "id": "cnc",   "name": "CNC",   "description": "Support for CNC machine troubleshooting and usage.", "file": "cnc.json" },
    { "id": "laser", "name": "Laser Cutter", "description": "Support for laser cutting machine operation.", "file": "laser.json" }
  ]
}
3

Restart the application

ECE-BOT retrains the intent classifier on startup. Restart the app (or the Docker container) and the new bot will appear in the hardware chatbot list.
docker compose restart web
You can supply multiple strings in the responses array for an intent. ECE-BOT selects one at random, which makes repeated questions feel less repetitive. Add at least two or three response variants for common intents.

Intent field reference

tag
string
required
Unique identifier for the intent within this bot’s data file. Used for logging and debugging — not shown to users.
patterns
string[]
required
Training phrases for this intent. Include natural language variations of how an operator might ask the same question. More patterns improve classification accuracy.
responses
string[]
required
Candidate responses returned when this intent is matched above the confidence threshold. One response is chosen at random per query.

Build docs developers (and LLMs) love