AI Chat Bot on Porteus LXDE using just Bash and Zenity

Get help with the LXDE desktop
User avatar
Andrew0604
Black ninja
Black ninja
Posts: 35
Joined: 27 Oct 2025, 01:00
Distribution: Porteus 5.1 Es
Location: Argentina
Contact:

AI Chat Bot on Porteus LXDE using just Bash and Zenity

Post#1 by Andrew0604 » 30 Sep 2026, 00:38

Hi.,.. Many Porteus Users look for a simple way to have an AI assistant on Porteus without dealing with Python or heavy environments. The easiest solution is to use Bash + Zenity + curl, three things we already have or can install in seconds. The result is a bot with a graphical window that queries an external AI model and returns the answer.

1: Install Zenity and jq
Zenity usually comes with LXDE. If it's not there, install it with:

Code: Select all

slapt-mod -m zenity
We also need jq to extract the response from the JSON:

Code: Select all

slapt-mod -m jq
The generated .xzm modules should be moved to your modules folder so they persist:

Code: Select all

mv /tmp/zenity-*.xzm /mnt/sdaX/porteus/modules/
mv /tmp/jq-*.xzm /mnt/sdaX/porteus/modules/
(Replace sdaX with the drive where Porteus is installed.)

If slapt-mod throws the Failed to open package_data error, fix the path with:

Code: Select all

sed -i 's|/var/cache/slapt-get|/var/slapt-get|g' /etc/slapt-get/slapt-getrc
slapt-mod -u
2: Get an API Key
This tutorial uses Public AI (https://platform.publicai.co/) because it's free and compatible with the OpenAI format. Any similar API will work.

Sign up on the platform.

Create an API Key.

Copy the key.

3: Create the bot script
Create the chat_bot.sh file in your home folder:

Code: Select all

cat > /home/guest/chat_bot.sh << 'SCRIPT_END'
#!/bin/bash

API_KEY="YOUR_KEY_HERE"
API_URL="https://api.publicai.co/v1/chat/completions"
MODEL="swiss-ai/apertus-v1.5-8b"

while true; do
  msg=$(zenity --entry --title="Chat" --text="Type your message:" --width=400)
  [ -z "$msg" ] && break

  response=$(curl -s "$API_URL" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $API_KEY" \
    -H "User-Agent: MiBot/1.0" \
    -d "{\"model\":\"$MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"$msg\"}]}" \
    | jq -r '.choices[0].message.content')

  zenity --info --title="Bot" --text="$response" --width=400
done
SCRIPT_END

chmod +x /home/guest/chat_bot.sh
Replace YOUR_KEY_HERE with your actual key.

4: Test it from the terminal

Code: Select all

/home/guest/chat_bot.sh
A window should pop up asking for your message. After you accept, another window shows the model's response.

5: Create a desktop icon

Create the launcher:

Code: Select all

cat > /home/guest/Desktop/ChatBot.desktop << 'DESKTOP_END'
[Desktop Entry]
Type=Application
Name=My AI Chat Bot
Comment=Launcher for the AI Chat Bot
Exec=/home/guest/chat_bot.sh
Icon=utilities-terminal
Terminal=false
DESKTOP_END

chmod +x /home/guest/Desktop/ChatBot.desktop
An icon will appear on your desktop. Double click and you're set.

Notes and limitations
Zenity is not a real chat app. Every message opens a new window. For a Telegram-like experience you'd need yad or a more complete graphical toolkit.

The API Key is stored inside the script. On a shared machine, it's better to move it to a separate file.

The bot has no memory. Each message is sent as if it were the first one. To add memory, you'd need to accumulate messages in an array and send them all together.

Porteus doesn't save changes by default. You need persistence enabled (save.dat or similar) so the script and the icon survive a reboot.

see the video for this: https://i.imgur.com/5VWCZhQ.mp4 :D

Input message in the Chat Bot
Image

and Output
Image

User avatar
dreadbird
Shogun
Shogun
Posts: 268
Joined: 08 Dec 2024, 04:30
Distribution: porteus5

AI Chat Bot on Porteus LXDE using just Bash and Zenity

Post#2 by dreadbird » 30 Sep 2026, 14:43

This is really neat thank you for the tutorial every bit helps in having a nice setup

User avatar
Andrew0604
Black ninja
Black ninja
Posts: 35
Joined: 27 Oct 2025, 01:00
Distribution: Porteus 5.1 Es
Location: Argentina
Contact:

AI Chat Bot on Porteus LXDE using just Bash and Zenity

Post#3 by Andrew0604 » 30 Sep 2026, 15:29

dreadbird wrote: ↑
30 Sep 2026, 14:43
This is really neat thank you for the tutorial every bit helps in having a nice setup
With three tools already on the system (Bash, Zenity, curl) and a couple of small modules, you can have a working AI assistant on Porteus without installing anything heavy. The idea is to keep it lite and to learn how to build it — what you do with it from here is up to you. This is just the base.
:celebrate3:

User avatar
Andrew0604
Black ninja
Black ninja
Posts: 35
Joined: 27 Oct 2025, 01:00
Distribution: Porteus 5.1 Es
Location: Argentina
Contact:

AI Chat Bot on Porteus LXDE using just Bash and Zenity

Post#4 by Andrew0604 » 30 Sep 2026, 15:40

I'm leaving the resource links here so you can download them if you don't have them.

JQ
https://download.salixos.org/x86_64/ext ... ix15.0.txz

Zenity
https://ponce.cc/slackware/slackware64- ... 1ponce.txz

B)

Post Reply