|
1 | 1 | # TreeChat — Branching Chat UI |
2 | 2 |
|
3 | | -https://github.com/user-attachments/assets/87ed3e76-2909-452c-bc45-37be0396bf60 |
4 | | - |
5 | 3 | ## Overview |
6 | 4 |
|
7 | 5 | This is a minimal React + TypeScript app that renders full branching conversation trees: user edits and assistant retries create sibling branches that are preserved and displayed side-by-side. This supports retries, user edits, selecting any leaf to continue the branch, and multi-model chats. |
8 | 6 |
|
| 7 | + |
| 8 | + |
9 | 9 | ## What’s inside |
10 | 10 |
|
11 | 11 | - client: Vite + React + TypeScript UI that renders a conversation tree. |
12 | 12 | - server: Express + OpenAI SDK proxy endpoint streaming assistant deltas. |
13 | 13 |
|
14 | | -## Quickstart (Docker) |
15 | | - |
16 | | -Prereqs: Docker Desktop (includes `docker compose`). |
17 | | - |
18 | | -### Option A: One command (pull a prebuilt image) |
19 | | - |
20 | | -This is the easiest UX for users: pull a prebuilt image + Postgres via Docker Compose. |
21 | | - |
22 | | -``` |
23 | | -curl -fsSL https://raw.githubusercontent.com/yxzwayne/treechat/refs/heads/main/docker-compose.pull.yml \ |
24 | | - | docker compose -f - up -d --pull always |
25 | | -``` |
26 | | - |
27 | | -Then open http://localhost:8787 |
28 | | - |
29 | | -Defaults: the container starts with `USE_MOCK=1` (no API key required). |
30 | | - |
31 | | -If port 8787 is busy, pick another host port: |
32 | | - |
33 | | -``` |
34 | | -curl -fsSL https://raw.githubusercontent.com/yxzwayne/treechat/refs/heads/main/docker-compose.pull.yml \ |
35 | | - | HOST_PORT=8788 docker compose -f - up -d --pull always |
36 | | -``` |
37 | | - |
38 | | -Finch equivalent (download first): |
| 14 | +## Quickstart (local) |
39 | 15 |
|
40 | | -``` |
41 | | -curl -fsSL https://raw.githubusercontent.com/yxzwayne/treechat/refs/heads/main/docker-compose.pull.yml -o /tmp/treechat.pull.yml |
42 | | -HOST_PORT=8787 finch compose -f /tmp/treechat.pull.yml up -d |
43 | | -``` |
44 | | - |
45 | | -To shut it down: |
46 | | - |
47 | | -``` |
48 | | -curl -fsSL https://raw.githubusercontent.com/yxzwayne/treechat/refs/heads/main/docker-compose.pull.yml -o /tmp/treechat.pull.yml |
49 | | -docker compose -f /tmp/treechat.pull.yml down |
50 | | -finch compose -f /tmp/treechat.pull.yml down |
51 | | -``` |
| 16 | +Prereqs: Node.js 18+. Release and electron-ification is coming. |
52 | 17 |
|
53 | | -To run with real model calls, pass `USE_MOCK=0` and an API key to `docker compose`: |
| 18 | +Data is stored on disk at `~/.treechat/data` by default (override with `TREECHAT_DATA_DIR`). |
54 | 19 |
|
| 20 | +1) Clone + install |
55 | 21 | ``` |
56 | | -curl -fsSL https://raw.githubusercontent.com/yxzwayne/treechat/refs/heads/main/docker-compose.pull.yml \ |
57 | | - | USE_MOCK=0 OPENROUTER_API_KEY=... docker compose -f - up -d --pull always |
| 22 | +git clone https://github.com/yxzwayne/treechat.git |
| 23 | +cd treechat |
| 24 | +cd client && npm ci |
| 25 | +cd ../server && npm ci |
| 26 | +cd .. |
58 | 27 | ``` |
59 | 28 |
|
60 | | -Finch equivalent: |
| 29 | +2) Run (dev) |
| 30 | + - Terminal A: `cd server && npm run dev` (API on http://localhost:8787) |
| 31 | + - Terminal B: `cd client && npm run dev` (UI on http://localhost:5173) |
61 | 32 |
|
62 | | -``` |
63 | | -USE_MOCK=0 OPENROUTER_API_KEY=... finch compose -f /tmp/treechat.pull.yml up -d |
64 | | -``` |
| 33 | +3) Open the UI |
| 34 | + - http://localhost:5173 |
65 | 35 |
|
66 | | -### Option B: Local (build from source) |
| 36 | +Notes: |
| 37 | +- By default, the server runs in mock mode when no API key is configured. |
| 38 | +- To use real models, add an API key in `server/.env` (see `docs/CONFIG.md`). |
67 | 39 |
|
68 | | -From this repo: |
| 40 | +## Next steps |
69 | 41 |
|
70 | | -- `docker compose up --build` |
71 | | -- `finch compose up --build` (Finch) |
72 | | -- open http://localhost:8787 |
73 | | - |
74 | | -See `docs/DOCKER.md`. |
75 | | - |
76 | | -## Developer setup (no Docker) |
77 | | - |
78 | | -1) Install deps |
79 | | - - client: `cd client && npm ci` |
80 | | - - server: `cd server && npm ci` |
81 | | - |
82 | | -2) Configure env |
83 | | - - In `server/.env` set `OPENROUTER_API_KEY=your_key` |
84 | | - - Optional: set `USE_MOCK=1` to run without network |
85 | | - |
86 | | -3) Run (two terminals) |
87 | | - - server: `cd server && npm run dev` (default port 8787) |
88 | | - - client: `cd client && npm run dev` (Vite dev server on 5173; proxied to the server) |
89 | | - |
90 | | -4) Tests |
91 | | - - client: `cd client && npm test` |
| 42 | +- Single-process mode (serve the built UI from the server): see `docs/BUILD.md`. |
| 43 | +- Env / storage configuration (including `USE_MOCK=1`): see `docs/CONFIG.md`. |
| 44 | +- Tests: `cd client && npm test`. |
92 | 45 |
|
93 | 46 | ## Using the app |
94 | 47 |
|
|
132 | 85 |
|
133 | 86 |
|
134 | 87 | # TODO |
135 | | - |
136 | | -- Image/file support: Allow uploading and rendering images/files in messages, and forwarding them to the model when supported. Include persistence in Postgres (blob storage path or presigned URL), display thumbnails, and drag-and-drop paste handling on the Composer. |
137 | | -- ⚠️ when user edits a message, provide the option to "override current branch" and clearly notify them that this is a "delete plus create" operation |
138 | | -- **New workflow, automatic conversation summary from the first user message**: this should be a separate workflow that runs like lambda on hardware with access to client, server and database. this workflow is triggered by a user sending the first message in a new conversation. This workflow has a system prompt instructing the model to summarize the following content and appends the user's first prompt. ask the summary to be under 10 words or characters if it's not a Latin language. |
| 88 | +- Image/file support: Allow uploading and rendering images/files in messages, and forwarding them to the model when supported. Include persistence in the filesystem store, display thumbnails, and drag-and-drop paste handling on the Composer. |
| 89 | +- New workflow, automatic conversation summary from the first user message: a separate async workflow triggered by a user sending the first message in a new conversation, instructing the model to summarize the first message to be under x words or characters if it's not a Latin language. |
0 commit comments