← Back to Plugins
Tools

Pinchchat

OlivierNeu By OlivierNeu 👁 5 views ▲ 0 votes

Custom PinchChat build for OpenClaw โ€” strips injected plugin context from chat display

GitHub

Install

npm install
cp

Configuration Example

localStorage.setItem('pinchchat:debug', '1');

README

<p align="center">
  <img src="public/logo.png" alt="PinchChat" width="120" />
</p>

<h1 align="center">PinchChat</h1>

[![CI](https://github.com/MarlBurroW/pinchchat/actions/workflows/ci.yml/badge.svg)](https://github.com/MarlBurroW/pinchchat/actions/workflows/ci.yml)
[![GitHub Release](https://img.shields.io/github/v/release/MarlBurroW/pinchchat?color=cyan)](https://github.com/MarlBurroW/pinchchat/releases)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Node.js](https://img.shields.io/badge/node-%3E%3D20-brightgreen-brightgreen)](https://nodejs.org/)
[![Docker](https://img.shields.io/badge/docker-ghcr.io-blue)](https://github.com/MarlBurroW/pinchchat/pkgs/container/pinchchat)
[![GitHub Stars](https://img.shields.io/github/stars/MarlBurroW/pinchchat?style=social)](https://github.com/MarlBurroW/pinchchat)
[![Website](https://img.shields.io/badge/website-GitHub%20Pages-blueviolet)](https://marlburrow.github.io/pinchchat/)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)

**A sleek, dark-themed webchat UI for [OpenClaw](https://github.com/openclaw/openclaw) โ€” monitor sessions, stream responses, and inspect tool calls in real-time.**


<p align="center">
  <img src="docs/demo.gif" alt="PinchChat Demo" width="800" />
</p>

## โœจ Features

- ๐Ÿ”ง **Tool call visualization** โ€” see what your agent is doing in real-time: colored badges, visible parameters, expandable results. The killer feature missing from every other chat UI.
- ๐Ÿ’ฌ **GPT-like interface** โ€” sessions in a sidebar, switch between conversations. Familiar if you've used ChatGPT or Claude.
- ๐Ÿ“‹ **Multi-session navigation** โ€” browse all active sessions including cron jobs, sub-agents, and background tasks
- โšก **Live streaming** โ€” watch the agent think and write token by token
- ๐Ÿ“Š **Token usage tracking** โ€” progress bars per session so you know how much context is left
- ๐Ÿ–ผ๏ธ **Inline images** โ€” generated or read images render directly in chat with lightbox preview
- ๐ŸŽฏ **Chat-focused** โ€” no settings menus or config panels cluttering the screen. Just the conversation.
- ๐ŸŽจ **Themes** โ€” Dark, Light, and OLED Black modes with 6 accent colors. Persisted per-browser.
- ๐Ÿง  **Thinking/reasoning display** โ€” see the agent's reasoning process in collapsible blocks with elapsed time
- ๐Ÿ” **Message search** โ€” Ctrl+F to search and navigate through conversation history
- ๐Ÿ“ **Split view** โ€” open 2 sessions side by side with a resizable divider
- โœ๏ธ **Syntax-highlighted input** โ€” real-time markdown coloring as you type (code blocks, bold, links)
- ๐Ÿ”€ **Drag & drop reorder** โ€” organize sessions in the sidebar by dragging, order persists across reloads
- ๐Ÿ“‹ **Raw JSON viewer** โ€” inspect full gateway message payloads for debugging
- ๐Ÿ—‚๏ธ **Channel icons** โ€” Discord, Telegram, cron, and other session types shown with distinct icons
- ๐Ÿ“ค **Export conversations** โ€” download any session as a formatted Markdown file
- ๐ŸŒ **i18n** โ€” English and French built-in, easy to extend
- ๐Ÿ”” **Notification sounds** โ€” subtle audio chime for new messages (toggleable)
- โŒจ๏ธ **Keyboard shortcuts** โ€” navigate sessions, toggle sidebar, search, and more without touching the mouse
- ๐Ÿ“ฑ **PWA support** โ€” installable as a progressive web app with offline caching and auto-updates
- โ™ฟ **Accessible** โ€” skip-to-chat link, focus-visible outlines, semantic HTML, `prefers-reduced-motion` support, ARIA live regions

## ๐Ÿš€ Quick Start

### Docker (recommended)

```bash
docker run -p 3000:80 ghcr.io/marlburrow/pinchchat:latest
```

Open `http://localhost:3000` and enter your OpenClaw gateway URL + token on the login screen.

Or use Docker Compose:

```bash
curl -O https://raw.githubusercontent.com/MarlBurroW/pinchchat/main/docker-compose.yml
docker compose up -d
```

### From source

**Prerequisites:** Node.js 20+, an OpenClaw gateway running and accessible.

```bash
git clone https://github.com/MarlBurroW/pinchchat.git
cd pinchchat
npm install
cp .env.example .env
npm run dev
```

Optionally edit `.env` to pre-fill the gateway URL:

```env
VITE_GATEWAY_WS_URL=ws://localhost:18789
VITE_LOCALE=en          # or "fr" for French UI
```

### Production build

```bash
npm run build
npx vite preview
```

Or serve the `dist/` folder with nginx, Caddy, or any static file server.

## โš™๏ธ Configuration

All configuration is optional โ€” credentials are entered at runtime via the login screen.

| Variable | Description | Default |
|---|---|---|
| `VITE_GATEWAY_WS_URL` | Pre-fill the gateway URL on the login screen | `ws://<hostname>:18789` |
| `VITE_LOCALE` | UI language (`en` or `fr`) | `en` |

> **Note:** The gateway token is entered at runtime and stored in `localStorage` โ€” it is never baked into the build.

## ๐ŸŽจ Customization

PinchChat stores all preferences in `localStorage` โ€” no server-side config needed.

### Themes

Click the palette icon in the header to switch between:

| Theme | Description |
|-------|-------------|
| **Dark** (default) | Zinc-based dark theme, easy on the eyes |
| **Light** | Clean light mode with white backgrounds |
| **OLED** | Pure black backgrounds for OLED screens |
| **System** | Follows your OS dark/light preference |

### Accent Colors

Six accent colors are available: **Cyan** (default), **Violet**, **Emerald**, **Amber**, **Rose**, and **Blue**. The accent tints buttons, links, progress bars, and user message bubbles.

### Other Preferences

These settings persist across sessions:

- **Sidebar width** โ€” drag the right edge to resize
- **Session order** โ€” drag & drop to reorder; pinned sessions stay on top
- **Syntax highlighting** โ€” toggle the `</>` button in the input area
- **Split view** โ€” open two sessions side by side (icon in header)
- **Language** โ€” switch between English and French via the globe icon
- **Message drafts** โ€” input text is preserved per-session when switching

## ๐Ÿ— Architecture

```mermaid
graph TD
    subgraph Browser["๐ŸŒ PinchChat (Browser)"]
        Login["LoginScreen<br/><i>credentials</i>"]
        App["App.tsx<br/><i>router</i>"]
        UI["Chat + Sidebar<br/><i>main UI</i>"]
        Hook["useGateway<br/><i>WebSocket state machine</i><br/>auth ยท sessions ยท messages"]

        Login --> App --> UI
        App & UI --> Hook
    end

    Hook <-->|"WebSocket (JSON frames)"| Gateway["๐Ÿ”Œ OpenClaw Gateway<br/><code>ws://host:18789</code>"]
    Gateway <-->|API| LLM["๐Ÿค– LLM Provider<br/><i>Anthropic, OpenAI, etc.</i>"]
```

### Key Components

| File | Role |
|---|---|
| `src/hooks/useGateway.ts` | WebSocket connection, auth, message streaming, session management |
| `src/components/LoginScreen.tsx` | Runtime credential entry (stored in `localStorage`) |
| `src/components/Chat.tsx` | Message list with auto-scroll and streaming display |
| `src/components/ChatInput.tsx` | Input with file upload, paste, drag & drop, image compression |
| `src/components/ChatMessage.tsx` | Markdown rendering, tool calls, thinking blocks |
| `src/components/Sidebar.tsx` | Session list with token usage bars and activity indicators |
| `src/components/Header.tsx` | Connection status, token progress bar, logout |
| `src/lib/i18n.ts` | Lightweight i18n (English + French) |
| `src/lib/gateway.ts` | WebSocket protocol helpers and message types |

### Data Flow

1. **Login** โ€” User enters gateway URL + token โ†’ stored in `localStorage`
2. **Connect** โ€” `useGateway` opens a WebSocket and authenticates with the token
3. **Sessions** โ€” Gateway pushes session list; user selects one in the sidebar
4. **Messages** โ€” Messages stream in via WebSocket frames; the hook assembles partial chunks into complete messages
5. **Send** โ€” User input (+ optional file attachments) is sent as a JSON frame over the WebSocket

> ๐Ÿ“– For a deeper dive into the codebase structure, see [ARCHITECTURE.md](ARCHITECTURE.md).

## ๐ŸŒ Adding a Language

PinchChat uses a zero-dependency i18n system. Adding a new language takes ~5 minutes:

1. **Open `src/lib/i18n.ts`** and duplicate the `en` object with your locale code:

```ts
const de: typeof en = {
  'login.title': 'PinchChat',
  'login.subtitle': 'Verbinde dich mit deinem OpenClaw-Gateway',
  // ... translate all keys
};
```

2. **Register it** in the `messages` record (same file):

```ts
const messages: Record<string, typeof en> = { en, fr, de };
```

3. **Add a label** for the language selector:

```ts
export const localeLabels: Record<string, string> = {
  en: 'EN',
  fr: 'FR',
  de: 'DE',
};
```

4. **Done.** The language selector, `VITE_LOCALE`, and browser auto-detection all pick it up automatically.

> **Tip:** TypeScript enforces that your new locale object has the same keys as `en` โ€” missing translations won't compile.

## โŒจ๏ธ Keyboard Shortcuts

Press **?** anywhere to open the shortcuts panel.

| Shortcut | Action |
|---|---|
| `Enter` | Send message |
| `Shift + Enter` | New line |
| `Esc` | Stop generation / close sidebar |
| `Ctrl/โŒ˜ + F` | Search messages in current session |
| `Ctrl/โŒ˜ + K` | Focus session search |
| `Alt + โ†‘` / `Alt + โ†“` | Switch between sessions |
| `?` | Show shortcuts help |

## โ“ Troubleshooting

### Connection fails / "WebSocket error"

- Make sure your OpenClaw gateway is running and reachable from the browser
- Check the gateway URL format: `ws://host:18789` (or `wss://` if behind TLS)
- If PinchChat is served over HTTPS, the gateway **must** also use `wss://` โ€” browsers block mixed content
- Verify the gateway token is correct (copy-paste from your OpenClaw config)

### Blank screen after login

- Open your browser's developer console (F12) and check for errors
- Ensure the gateway is running a compatible version of OpenClaw (v0.24+)
- Try clearing `localStorage` (Application tab โ†’ Storage โ†’ Clear site data) and logging in again

### Messages don't appear / sessions empty

- The WebSocket may have disconnected silently โ€” check the connection indicator in the header
- If the gateway was restarted, PinchChat recon

... (truncated)
tools

Comments

Sign in to leave a comment

Loading comments...