|
| 1 | +# ep_ai_chat |
| 2 | + |
| 3 | +AI chat participant for Etherpad. When users @mention the AI in pad chat, it |
| 4 | +reads the document, understands who wrote what, and responds. It can also edit |
| 5 | +the pad directly when asked. |
| 6 | + |
| 7 | +## Installation |
| 8 | + |
| 9 | +Requires `ep_ai_core`. |
| 10 | + |
| 11 | +```bash |
| 12 | +pnpm run plugins i ep_ai_core ep_ai_chat |
| 13 | +``` |
| 14 | + |
| 15 | +Configure the LLM provider in `settings.json` under the `ep_ai_core` key. |
| 16 | +See the [ep_ai_core README](https://github.com/ether/ep_ai_core#readme) for |
| 17 | +full configuration details. |
| 18 | + |
| 19 | +## Usage |
| 20 | + |
| 21 | +Type `@ai` followed by your message in the pad's chat box: |
| 22 | + |
| 23 | +``` |
| 24 | +@ai summarize this document |
| 25 | +@ai who wrote the introduction? |
| 26 | +@ai fix the spelling errors in paragraph 3 |
| 27 | +``` |
| 28 | + |
| 29 | +The AI will respond in chat. If you ask it to make changes and the pad has |
| 30 | +`full` access mode, it will edit the document directly. |
| 31 | + |
| 32 | +## Configuration |
| 33 | + |
| 34 | +Chat-specific settings go under `ep_ai_core.chat` in `settings.json`: |
| 35 | + |
| 36 | +```json |
| 37 | +{ |
| 38 | + "ep_ai_core": { |
| 39 | + "apiBaseUrl": "https://api.anthropic.com/v1", |
| 40 | + "apiKey": "sk-ant-...", |
| 41 | + "model": "claude-sonnet-4-20250514", |
| 42 | + "chat": { |
| 43 | + "trigger": "@ai", |
| 44 | + "authorName": "AI Assistant", |
| 45 | + "authorColor": "#7c4dff", |
| 46 | + "systemPrompt": "You are a helpful writing assistant.", |
| 47 | + "maxContextChars": 50000, |
| 48 | + "chatHistoryLength": 20, |
| 49 | + "conversationBufferSize": 10 |
| 50 | + } |
| 51 | + } |
| 52 | +} |
| 53 | +``` |
| 54 | + |
| 55 | +| Setting | Default | Description | |
| 56 | +|---------|---------|-------------| |
| 57 | +| `trigger` | `@ai` | Text that activates the AI in chat | |
| 58 | +| `authorName` | `AI Assistant` | Display name in chat and authorship | |
| 59 | +| `authorColor` | `#7c4dff` | Color for the AI's edits and chat messages | |
| 60 | +| `systemPrompt` | _(built-in)_ | Custom system prompt for the LLM | |
| 61 | +| `maxContextChars` | `50000` | Max characters of pad content sent to the LLM | |
| 62 | +| `chatHistoryLength` | `20` | Number of recent chat messages included as context | |
| 63 | +| `conversationBufferSize` | `10` | Number of conversation turns remembered per pad | |
| 64 | + |
| 65 | +## How Editing Works |
| 66 | + |
| 67 | +When a user asks the AI to change the document, the AI responds with a |
| 68 | +structured edit (find text, replace with new text). The plugin: |
| 69 | + |
| 70 | +1. Locates the exact text in the pad |
| 71 | +2. Applies the change as a native Etherpad changeset |
| 72 | +3. Attributes the edit to the AI author (with the configured color) |
| 73 | +4. Broadcasts the update to all connected clients |
| 74 | +5. Announces the AI in the user list so its color appears in the author palette |
| 75 | + |
| 76 | +If the pad's access mode is `readOnly`, the AI will answer questions but |
| 77 | +decline edit requests. If access is `none`, the AI will not respond at all. |
| 78 | + |
| 79 | +## Conversation Memory |
| 80 | + |
| 81 | +The AI maintains a short conversation buffer per pad. Follow-up messages |
| 82 | +can reference earlier exchanges without repeating context. The buffer is |
| 83 | +kept in memory and resets when the server restarts. |
| 84 | + |
| 85 | +## License |
| 86 | + |
| 87 | +Apache-2.0 |
0 commit comments