Files
conversation-layer/README.md
2025-06-04 22:58:59 -06:00

31 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Conversation Layer
This module contains the services that handle messaging for WhatsApp and the web chat interface. All source code is now written in **TypeScript**. It is composed of three containers:
- **openwa** provides access to WhatsApp through the [open-wa](https://github.com/open-wa/wa-automate-nodejs) project.
- **whatsapp-router** receives webhook events from openwa and forwards messages to a conversation handler. Handlers can be configured per chat ID in `whatsapp-router/src/chatHandlers.ts`.
- **chat-ui** simple web chat interface that also communicates with the LLM agent.
All services can be launched together with `docker-compose`.
## Usage
1. Configure the URL of your LLM agent in `docker-compose.yml` (`LLM_AGENT_URL`).
2. Optionally edit `whatsapp-router/src/chatHandlers.ts` to map specific chat IDs to different handler URLs or local handlers. By default the chat ID `50498554225@c.us` is mapped to a builtin *HelloWorld* agent that replies "hello world" for testing.
3. Run:
```bash
docker-compose up --build
```
The chat UI will be available on [http://localhost:3000](http://localhost:3000). Open-wa exposes its API on port `8080` and the WhatsApp router listens on port `3001`.
Alternatively you can run the chat UI and router locally using Make:
```bash
make chat # start chat-ui
make router # start whatsapp-router
```
Both targets read configuration from a `.env` file if it exists (see `.env.example`).