mal_bnais‑svr.js – The Chill‑Filter API Service

mal_bnais‑svr.js is an Express/Node.js server that exposes a simple REST endpoint (`POST /chill`) to transform any user‑supplied text from negative to positive. It uses the same local Ollama LLM that powers benais.js, so your data never leaves your machine.

Installation & Setup

  1. Prerequisites: Node 18+ and a running Ollama instance (e.g., `gemma3`).
  2. Clone the repo or copy the file into your project.
  3. Create a `.env` file from `.env.example`:
    # .env
    PORT=3000
    OLLAMA_URL=http://127.0.0.1:11434/api/chat
    LLM_MODEL=gemma3
  4. Install dependencies and start the server:
    npm install express dotenv node-fetch
    node mal_bnais-svr.js

API Reference

POST /chill

Transforms a single sentence from negative to positive.

Request Body (JSON)

{
  "text": "I hate how slow this is."
}

Response (JSON)

{
  "original": "I hate how slow this is.",
  "chilled": "I appreciate the improvements being made."
}

Status Codes

Example with curl

curl -X POST http://localhost:3000/chill \
     -H "Content-Type: application/json" \
     -d '{"text":"You are stupid as fuck!"}'

How It Works (Behind the Scenes)

The server forwards the user’s sentence to Ollama with a prompt identical to that used in benais.js:

You are a helpful text filter. Analyze the following sentence and determine if it contains any negative or "bad" meaning.
If it does, rewrite the sentence to have a positive, opposite meaning.
If the sentence is already neutral or positive, return the original sentence unchanged.

Example 1: "This is a terrible situation." -> "This is a wonderful situation."
...

The sentence to transform is: "${originalMessage}"

Transformed sentence:

The LLM returns the transformed text, which the API then packages in JSON and sends back.

Future Enhancements

Contributing & Feedback

This project is in Beta. Pull requests, issue reports and ideas are welcome! Fork the repo, tweak the prompt or add new features, then submit a PR.