quikchat 1.1.16 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +160 -354
- package/dist/build-manifest.json +157 -0
- package/dist/quikchat-md-full.cjs.js +2742 -0
- package/dist/quikchat-md-full.cjs.js.map +1 -0
- package/dist/quikchat-md-full.cjs.min.js +10 -0
- package/dist/quikchat-md-full.cjs.min.js.map +1 -0
- package/dist/quikchat-md-full.esm.js +2740 -0
- package/dist/quikchat-md-full.esm.js.map +1 -0
- package/dist/quikchat-md-full.esm.min.js +10 -0
- package/dist/quikchat-md-full.esm.min.js.map +1 -0
- package/dist/quikchat-md-full.umd.js +2748 -0
- package/dist/quikchat-md-full.umd.js.map +1 -0
- package/dist/quikchat-md-full.umd.min.js +10 -0
- package/dist/quikchat-md-full.umd.min.js.map +1 -0
- package/dist/quikchat-md.cjs.js +1641 -0
- package/dist/quikchat-md.cjs.js.map +1 -0
- package/dist/quikchat-md.cjs.min.js +8 -0
- package/dist/quikchat-md.cjs.min.js.map +1 -0
- package/dist/quikchat-md.esm.js +1639 -0
- package/dist/quikchat-md.esm.js.map +1 -0
- package/dist/quikchat-md.esm.min.js +8 -0
- package/dist/quikchat-md.esm.min.js.map +1 -0
- package/dist/quikchat-md.umd.js +1647 -0
- package/dist/quikchat-md.umd.js.map +1 -0
- package/dist/quikchat-md.umd.min.js +8 -0
- package/dist/quikchat-md.umd.min.js.map +1 -0
- package/dist/quikchat.cjs.js +449 -1421
- package/dist/quikchat.cjs.js.map +1 -1
- package/dist/quikchat.cjs.min.js +1 -1
- package/dist/quikchat.cjs.min.js.map +1 -1
- package/dist/quikchat.css +753 -226
- package/dist/quikchat.esm.js +449 -1421
- package/dist/quikchat.esm.js.map +1 -1
- package/dist/quikchat.esm.min.js +1 -1
- package/dist/quikchat.esm.min.js.map +1 -1
- package/dist/quikchat.min.css +1 -1
- package/dist/quikchat.umd.js +449 -1421
- package/dist/quikchat.umd.js.map +1 -1
- package/dist/quikchat.umd.min.js +1 -1
- package/dist/quikchat.umd.min.js.map +1 -1
- package/package.json +59 -34
- package/dist/quikchat.d.ts +0 -194
package/README.md
CHANGED
|
@@ -1,442 +1,248 @@
|
|
|
1
|
-
[](https://opensource.org/licenses/BSD-2-Clause)
|
|
1
|
+
[](https://opensource.org/licenses/BSD-2-Clause)
|
|
2
|
+
[](https://www.npmjs.com/package/quikchat)
|
|
3
|
+

|
|
2
4
|
|
|
3
5
|
# QuikChat
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
A lightweight, zero-dependency vanilla JavaScript chat widget. Drop it into any page — no React, no Vue, no build step required — and connect it to any LLM, WebSocket, or message source with plain `fetch()`.
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
```html
|
|
10
|
+
<script src="https://unpkg.com/quikchat"></script>
|
|
11
|
+
<link rel="stylesheet" href="https://unpkg.com/quikchat/dist/quikchat.css" />
|
|
12
|
+
```
|
|
10
13
|
|
|
14
|
+
```javascript
|
|
15
|
+
const chat = new quikchat('#chat', async (chat, msg) => {
|
|
16
|
+
chat.messageAddNew(msg, 'me', 'right', 'user');
|
|
11
17
|
|
|
18
|
+
// Stream a response from any LLM
|
|
19
|
+
const id = chat.messageAddTypingIndicator('bot');
|
|
20
|
+
const response = await fetch('http://localhost:11434/api/chat', {
|
|
21
|
+
method: 'POST',
|
|
22
|
+
headers: { 'Content-Type': 'application/json' },
|
|
23
|
+
body: JSON.stringify({
|
|
24
|
+
model: 'llama3.1',
|
|
25
|
+
messages: chat.historyGet(), // full conversation context
|
|
26
|
+
stream: true
|
|
27
|
+
})
|
|
28
|
+
});
|
|
12
29
|
|
|
13
|
-
|
|
30
|
+
const reader = response.body.getReader();
|
|
31
|
+
let first = true;
|
|
32
|
+
while (true) {
|
|
33
|
+
const { value, done } = await reader.read();
|
|
34
|
+
if (done) break;
|
|
35
|
+
const token = JSON.parse(new TextDecoder().decode(value).trim()).message.content;
|
|
36
|
+
if (first) { chat.messageReplaceContent(id, token); first = false; }
|
|
37
|
+
else { chat.messageAppendContent(id, token); }
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
```
|
|
14
41
|
|
|
15
|
-
|
|
16
|
-
- **🎨 Fully Customizable** - Complete CSS theming system with multi-instance support
|
|
17
|
-
- **🤖 LLM Ready** - Built-in support for OpenAI, Anthropic, Ollama, and streaming responses
|
|
18
|
-
- **📱 Responsive Design** - Adapts to any screen size and container dimensions
|
|
19
|
-
- **⚡ High Performance** - Virtual scrolling for large message volumes
|
|
20
|
-
- **👁 Advanced Visibility** - Individual and group-based message control (v1.1.13+)
|
|
21
|
-
- **🏷 Tagged Messages** - Powerful tagging system for message organization (v1.1.14+)
|
|
22
|
-
- **💾 Full History Control** - Save, load, and restore complete chat sessions
|
|
23
|
-
- **🔧 Developer Friendly** - TypeScript-ready with comprehensive API
|
|
42
|
+
That's a working streaming LLM chat in one file — no bundler, no framework, no SDK.
|
|
24
43
|
|
|
44
|
+
## Features
|
|
25
45
|
|
|
46
|
+
- **LLM-ready** — `historyGet()` returns `{ role, content }` objects compatible with OpenAI, Ollama, Mistral, and Claude APIs
|
|
47
|
+
- **Streaming built in** — `messageAddNew()` → `messageAppendContent()` for token-by-token display
|
|
48
|
+
- **Typing indicator** — animated "..." dots that auto-clear when streaming begins
|
|
49
|
+
- **Markdown support** — three tiers: base (no markdown), `-md` (basic markdown via [quikdown](https://github.com/deftio/quikdown)), `-md-full` (syntax highlighting, math, diagrams, maps — loaded on demand from CDN)
|
|
50
|
+
- **HTML sanitization** — built-in XSS protection or plug in your own sanitizer
|
|
51
|
+
- **Themeable** — 8 built-in CSS themes (light, dark, blue, warm, midnight, ocean, modern, debug) or write your own
|
|
52
|
+
- **Multi-user** — multiple users per chat, multiple independent chats per page
|
|
53
|
+
- **Message visibility & tagging** — hide system prompts and tool-call results from the UI while keeping them in history for LLM context
|
|
54
|
+
- **History export / import** — save and restore complete chat sessions (`historyExport()` / `historyImport()`)
|
|
55
|
+
- **RTL support** — `setDirection('rtl')` for Arabic, Hebrew, and other right-to-left languages
|
|
56
|
+
- **Event callbacks** — hooks for message add, append, replace, and delete events
|
|
57
|
+
- **Timestamps** — optional per-message timestamps (show/hide)
|
|
58
|
+
- **Zero runtime dependencies** — ~5 KB gzipped (base), ~9 KB with markdown, ~14 KB full
|
|
59
|
+
- **Any environment** — works with CDN, npm, or local files; UMD, ESM, and CJS builds included
|
|
60
|
+
- **Responsive** — fills its parent container and resizes automatically
|
|
61
|
+
- **Accessible** — ARIA roles and labels on all interactive elements
|
|
26
62
|
|
|
27
|
-
##
|
|
63
|
+
## Quick Start
|
|
28
64
|
|
|
29
|
-
|
|
65
|
+
### CDN
|
|
30
66
|
|
|
31
|
-
### Via CDN
|
|
32
67
|
```html
|
|
33
|
-
|
|
34
|
-
<
|
|
35
|
-
<head>
|
|
36
|
-
<link rel="stylesheet" href="https://unpkg.com/quikchat/dist/quikchat.css">
|
|
37
|
-
</head>
|
|
38
|
-
<body>
|
|
39
|
-
<div id="chat" style="width: 100%; height: 400px;"></div>
|
|
40
|
-
|
|
41
|
-
<script src="https://unpkg.com/quikchat"></script>
|
|
42
|
-
<script>
|
|
43
|
-
const chat = new quikchat('#chat', (instance, message) => {
|
|
44
|
-
// Echo user message
|
|
45
|
-
instance.messageAddNew(message, 'You', 'right');
|
|
46
|
-
|
|
47
|
-
// Add bot response
|
|
48
|
-
setTimeout(() => {
|
|
49
|
-
instance.messageAddNew('Thanks for your message!', 'Bot', 'left');
|
|
50
|
-
}, 1000);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// Add welcome message
|
|
54
|
-
chat.messageAddNew('Hello! How can I help you today?', 'Bot', 'left');
|
|
55
|
-
</script>
|
|
56
|
-
</body>
|
|
57
|
-
</html>
|
|
68
|
+
<script src="https://unpkg.com/quikchat"></script>
|
|
69
|
+
<link rel="stylesheet" href="https://unpkg.com/quikchat/dist/quikchat.css" />
|
|
58
70
|
```
|
|
59
71
|
|
|
60
|
-
###
|
|
72
|
+
### npm
|
|
73
|
+
|
|
61
74
|
```bash
|
|
62
75
|
npm install quikchat
|
|
63
76
|
```
|
|
64
77
|
|
|
65
78
|
```javascript
|
|
66
79
|
import quikchat from 'quikchat';
|
|
67
|
-
import 'quikchat/dist/quikchat.css';
|
|
68
|
-
|
|
69
|
-
const chat = new quikchat('#chat-container', (instance, message) => {
|
|
70
|
-
// Your message handling logic
|
|
71
|
-
console.log('User said:', message);
|
|
72
|
-
});
|
|
73
80
|
```
|
|
74
81
|
|
|
82
|
+
### With Markdown
|
|
75
83
|
|
|
76
|
-
|
|
77
|
-
## 📦 Installation Options
|
|
78
|
-
|
|
79
|
-
### NPM Package
|
|
80
|
-
```bash
|
|
81
|
-
npm install quikchat
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### CDN (Latest Version)
|
|
85
84
|
```html
|
|
86
|
-
<!--
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
<!-- JavaScript -->
|
|
90
|
-
<script src="https://unpkg.com/quikchat"></script>
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### Direct Download
|
|
94
|
-
Download the latest release from [GitHub Releases](https://github.com/deftio/quikchat/releases)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
## 🆕 What's New in v1.1.16
|
|
99
|
-
|
|
100
|
-
### ⚡ Virtual Scrolling for High Performance
|
|
101
|
-
QuikChat now includes built-in virtual scrolling that handles 10,000+ messages efficiently. Only visible messages are rendered in the DOM, providing massive performance improvements:
|
|
85
|
+
<!-- Basic markdown (bold, italic, code, tables, lists) — ~9 KB gzip -->
|
|
86
|
+
<script src="https://unpkg.com/quikchat/dist/quikchat-md.umd.min.js"></script>
|
|
102
87
|
|
|
103
|
-
|
|
104
|
-
-
|
|
105
|
-
- **Automatic activation**: Enables at 500+ messages by default
|
|
106
|
-
- **Dynamic height support**: Handles variable-length LLM responses
|
|
88
|
+
<!-- Full markdown (+ syntax highlighting, math, diagrams, maps) — ~14 KB gzip -->
|
|
89
|
+
<script src="https://unpkg.com/quikchat/dist/quikchat-md-full.umd.min.js"></script>
|
|
107
90
|
|
|
108
|
-
|
|
109
|
-
// Virtual scrolling is enabled by default
|
|
110
|
-
const chat = new quikchat('#chat', handler);
|
|
111
|
-
|
|
112
|
-
// Check if virtual scrolling is active
|
|
113
|
-
if (chat.isVirtualScrollingEnabled()) {
|
|
114
|
-
console.log('Virtual scrolling is active');
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Get virtual scrolling configuration
|
|
118
|
-
const config = chat.getVirtualScrollingConfig();
|
|
119
|
-
console.log(`Enabled: ${config.enabled}, Threshold: ${config.threshold}`);
|
|
120
|
-
|
|
121
|
-
// Disable if needed for specific use cases
|
|
122
|
-
const customChat = new quikchat('#custom-chat', handler, {
|
|
123
|
-
virtualScrolling: false
|
|
124
|
-
});
|
|
91
|
+
<link rel="stylesheet" href="https://unpkg.com/quikchat/dist/quikchat.css" />
|
|
125
92
|
```
|
|
126
93
|
|
|
127
|
-
|
|
128
|
-
Improved user experience when reading chat history:
|
|
94
|
+
The `-md-full` build uses [quikdown](https://github.com/deftio/quikdown)'s editor as a rendering engine. When your LLM returns a fenced code block with a language tag, highlight.js loads from CDN automatically. Same for math (MathJax), diagrams (Mermaid), and maps (Leaflet) — each loads on demand the first time it's encountered.
|
|
129
95
|
|
|
130
|
-
|
|
131
|
-
// Never auto-scroll (user has full control)
|
|
132
|
-
chat.messageAddNew('New message', 'Bot', 'left', 'assistant', false);
|
|
96
|
+
Same API across all three builds — just pick your script tag.
|
|
133
97
|
|
|
134
|
-
|
|
135
|
-
chat.messageAddNew('New message', 'Bot', 'left', 'assistant', 'smart');
|
|
136
|
-
|
|
137
|
-
// Always scroll to new messages (default)
|
|
138
|
-
chat.messageAddNew('New message', 'Bot', 'left', 'assistant', true);
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### 🔔 Enhanced Message Callbacks
|
|
142
|
-
Track message modifications for streaming and real-time updates:
|
|
98
|
+
## Usage
|
|
143
99
|
|
|
144
100
|
```javascript
|
|
145
|
-
|
|
146
|
-
chat
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
101
|
+
const chat = new quikchat(
|
|
102
|
+
'#chat-container', // CSS selector or DOM element
|
|
103
|
+
(chat, msg) => { // onSend callback
|
|
104
|
+
chat.messageAddNew(msg, 'me', 'right');
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
theme: 'quikchat-theme-light',
|
|
108
|
+
titleArea: { title: 'My Chat', align: 'left', show: true },
|
|
109
|
+
}
|
|
110
|
+
);
|
|
154
111
|
|
|
155
|
-
//
|
|
156
|
-
chat.
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
```
|
|
112
|
+
// Add messages programmatically
|
|
113
|
+
chat.messageAddNew('Hello!', 'Alice', 'left', 'user');
|
|
114
|
+
chat.messageAddNew('Hi there!', 'Bot', 'left', 'assistant');
|
|
115
|
+
chat.messageAddNew('System notice', 'system', 'center', 'system');
|
|
160
116
|
|
|
161
|
-
|
|
162
|
-
|
|
117
|
+
// Streaming pattern
|
|
118
|
+
const id = chat.messageAddTypingIndicator('bot'); // show "..." dots
|
|
119
|
+
chat.messageReplaceContent(id, firstToken); // first token clears dots
|
|
120
|
+
chat.messageAppendContent(id, nextToken); // append subsequent tokens
|
|
163
121
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
// Search through history
|
|
171
|
-
const results = chat.historySearch({
|
|
172
|
-
text: 'error',
|
|
173
|
-
userString: 'Support',
|
|
174
|
-
limit: 50
|
|
175
|
-
});
|
|
122
|
+
// Disable input while bot is responding
|
|
123
|
+
chat.inputAreaSetEnabled(false);
|
|
124
|
+
chat.inputAreaSetButtonText('Thinking...');
|
|
125
|
+
// ... after response completes ...
|
|
126
|
+
chat.inputAreaSetEnabled(true);
|
|
127
|
+
chat.inputAreaSetButtonText('Send');
|
|
176
128
|
|
|
177
|
-
//
|
|
178
|
-
const
|
|
179
|
-
console.log(`Total messages: ${info.totalMessages}`);
|
|
180
|
-
console.log(`Memory used: ${info.memoryUsage.estimatedSize} bytes`);
|
|
129
|
+
// History is LLM-API compatible
|
|
130
|
+
const history = chat.historyGet(); // [{ role: "user", content: "..." }, ...]
|
|
181
131
|
```
|
|
182
132
|
|
|
183
|
-
##
|
|
133
|
+
## Message Formatter & Sanitization
|
|
184
134
|
|
|
185
|
-
|
|
186
|
-
Group and control message visibility with powerful tagging:
|
|
135
|
+
Process message content before display — render markdown, sanitize HTML, or both:
|
|
187
136
|
|
|
188
137
|
```javascript
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
// Control visibility by tag
|
|
193
|
-
chat.setTagVisibility('system', false); // Hide all system messages
|
|
194
|
-
chat.setTagVisibility('system', true); // Show all system messages
|
|
138
|
+
const chat = new quikchat('#chat', onSend, {
|
|
139
|
+
// Sanitize user input (true = escape HTML entities, or pass a function)
|
|
140
|
+
sanitize: true,
|
|
195
141
|
|
|
196
|
-
//
|
|
197
|
-
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
### 🎯 Instance Scoping
|
|
201
|
-
Multiple chat instances with different styling and behavior:
|
|
202
|
-
|
|
203
|
-
```javascript
|
|
204
|
-
const salesChat = new quikchat('#sales', handler, {
|
|
205
|
-
theme: 'quikchat-theme-light',
|
|
206
|
-
instanceClass: 'sales-chat'
|
|
142
|
+
// Format content (e.g., markdown → HTML)
|
|
143
|
+
messageFormatter: (content) => myMarkdownParser(content),
|
|
207
144
|
});
|
|
208
145
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
});
|
|
146
|
+
// Change at runtime
|
|
147
|
+
chat.setMessageFormatter((content) => marked.parse(content));
|
|
148
|
+
chat.setSanitize((content) => DOMPurify.sanitize(content));
|
|
213
149
|
```
|
|
214
150
|
|
|
215
|
-
|
|
216
|
-
Fine-grained control over message display:
|
|
217
|
-
|
|
218
|
-
```javascript
|
|
219
|
-
// Hide individual messages
|
|
220
|
-
chat.messageSetVisibility(messageId, false);
|
|
221
|
-
|
|
222
|
-
// Check visibility status
|
|
223
|
-
const isVisible = chat.messageGetVisibility(messageId);
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
**[View Complete Changelog](https://github.com/deftio/quikchat/releases)**
|
|
227
|
-
|
|
151
|
+
The pipeline is: **sanitize → format → display**. Sanitize cleans untrusted input; the formatter's output is trusted.
|
|
228
152
|
|
|
153
|
+
The `-md` and `-md-full` builds pre-wire [quikdown](https://github.com/deftio/quikdown) as the formatter — no configuration needed. The `-md-full` build additionally renders syntax-highlighted code, math equations, Mermaid diagrams, and maps via dynamic CDN loading.
|
|
229
154
|
|
|
230
|
-
##
|
|
155
|
+
## Theming
|
|
231
156
|
|
|
232
|
-
|
|
157
|
+
Themes are pure CSS — colors, borders, and shadows only. The base CSS handles all layout.
|
|
233
158
|
|
|
234
159
|
```javascript
|
|
235
|
-
//
|
|
236
|
-
const chat = new quikchat('#chat', handler, {
|
|
237
|
-
theme: 'quikchat-theme-dark' // or 'quikchat-theme-light'
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
// Switch themes dynamically
|
|
160
|
+
// Built-in themes
|
|
241
161
|
chat.changeTheme('quikchat-theme-light');
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
### Custom Themes
|
|
245
|
-
Create your own themes with CSS:
|
|
246
|
-
|
|
247
|
-
```css
|
|
248
|
-
.my-custom-theme {
|
|
249
|
-
border: 2px solid #3b82f6;
|
|
250
|
-
border-radius: 12px;
|
|
251
|
-
font-family: 'SF Pro Display', sans-serif;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
.my-custom-theme .quikchat-message-content {
|
|
255
|
-
border-radius: 18px;
|
|
256
|
-
padding: 12px 16px;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/* Apply to chat */
|
|
260
|
-
const chat = new quikchat('#chat', handler, {
|
|
261
|
-
theme: 'my-custom-theme'
|
|
262
|
-
});
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
**📖 [Complete Theming Guide](docs/DEVELOPER-GUIDE.md#theming-guide)**
|
|
266
|
-
|
|
267
|
-
|
|
162
|
+
chat.changeTheme('quikchat-theme-dark');
|
|
163
|
+
chat.changeTheme('quikchat-theme-modern'); // chat-bubble style
|
|
268
164
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
### OpenAI Integration
|
|
272
|
-
```javascript
|
|
273
|
-
async function handleMessage(chat, message) {
|
|
274
|
-
chat.messageAddNew(message, 'You', 'right');
|
|
275
|
-
|
|
276
|
-
const response = await fetch('https://api.openai.com/v1/chat/completions', {
|
|
277
|
-
method: 'POST',
|
|
278
|
-
headers: {
|
|
279
|
-
'Authorization': `Bearer ${API_KEY}`,
|
|
280
|
-
'Content-Type': 'application/json'
|
|
281
|
-
},
|
|
282
|
-
body: JSON.stringify({
|
|
283
|
-
model: 'gpt-4',
|
|
284
|
-
messages: formatChatHistory(chat.historyGetAllCopy(), message)
|
|
285
|
-
})
|
|
286
|
-
});
|
|
287
|
-
|
|
288
|
-
const data = await response.json();
|
|
289
|
-
chat.messageAddNew(data.choices[0].message.content, 'Assistant', 'left');
|
|
290
|
-
}
|
|
165
|
+
// Or write your own — just color overrides
|
|
291
166
|
```
|
|
292
167
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
// Append content as it arrives
|
|
299
|
-
streamingAPI.onChunk(chunk => {
|
|
300
|
-
chat.messageAppendContent(botMsgId, chunk);
|
|
301
|
-
});
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
**🛠 [Complete LLM Integration Guide](docs/DEVELOPER-GUIDE.md#llm-integration-best-practices)**
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
## 🏗 Framework Integration
|
|
309
|
-
|
|
310
|
-
### React
|
|
311
|
-
```jsx
|
|
312
|
-
function ChatComponent() {
|
|
313
|
-
const chatRef = useRef(null);
|
|
314
|
-
const instanceRef = useRef(null);
|
|
315
|
-
|
|
316
|
-
useEffect(() => {
|
|
317
|
-
instanceRef.current = new quikchat(chatRef.current, handleMessage);
|
|
318
|
-
}, []);
|
|
319
|
-
|
|
320
|
-
return <div ref={chatRef} style={{ height: '400px' }} />;
|
|
321
|
-
}
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
### Vue
|
|
325
|
-
```vue
|
|
326
|
-
<template>
|
|
327
|
-
<div ref="chatContainer" class="chat-container"></div>
|
|
328
|
-
</template>
|
|
329
|
-
|
|
330
|
-
<script>
|
|
331
|
-
import quikchat from 'quikchat';
|
|
332
|
-
|
|
333
|
-
export default {
|
|
334
|
-
mounted() {
|
|
335
|
-
this.chat = new quikchat(this.$refs.chatContainer, this.handleMessage);
|
|
336
|
-
}
|
|
168
|
+
```css
|
|
169
|
+
.my-theme {
|
|
170
|
+
background-color: #f9f9f9;
|
|
171
|
+
border: 1px solid #ccc;
|
|
172
|
+
border-radius: 10px;
|
|
337
173
|
}
|
|
338
|
-
|
|
174
|
+
.my-theme .quikchat-title-area { color: #333; }
|
|
175
|
+
.my-theme .quikchat-messages-area { background-color: #fff; color: #333; }
|
|
176
|
+
.my-theme .quikchat-input-send-btn { background-color: #4caf50; color: white; border: none; border-radius: 4px; }
|
|
339
177
|
```
|
|
340
178
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
## 📖 Documentation
|
|
346
|
-
|
|
347
|
-
| Document | Description |
|
|
348
|
-
|-|-|
|
|
349
|
-
| **[API Reference](docs/API-REFERENCE.md)** | Complete technical reference for all methods and options |
|
|
350
|
-
| **[Developer Guide](docs/DEVELOPER-GUIDE.md)** | Practical recipes and advanced patterns |
|
|
351
|
-
| **[Examples](examples/)** | Working code examples and demos |
|
|
352
|
-
| **[Live Demo](https://deftio.github.io/quikchat/examples/)** | Interactive examples and showcase |
|
|
353
|
-
|
|
354
|
-
|
|
179
|
+
The **modern bubble theme** uses alignment classes (`quikchat-align-left`, `quikchat-align-right`) to position messages as chat bubbles with colored backgrounds — left-aligned messages appear as grey bubbles, right-aligned as blue.
|
|
355
180
|
|
|
356
|
-
|
|
181
|
+
Style messages by role with CSS hooks: `.quikchat-role-user`, `.quikchat-role-assistant`, `.quikchat-role-system`, `.quikchat-role-tool`.
|
|
357
182
|
|
|
358
|
-
|
|
359
|
-
- **[LLM Integration](examples/openai.html)** - OpenAI GPT integration
|
|
360
|
-
- **[Multi-Instance](examples/dual-chatrooms.html)** - Multiple chats on one page
|
|
361
|
-
- **[Visibility Controls](examples/hidden_message.html)** - Message visibility features
|
|
362
|
-
- **[Theme Showcase](https://deftio.github.io/quikchat/examples/)** - Light and dark themes
|
|
363
|
-
- **[React Integration](examples/quikchat-react.html)** - React component example
|
|
364
|
-
- **[Backend Examples](examples/)** - FastAPI and Node.js backends
|
|
183
|
+
## Documentation
|
|
365
184
|
|
|
366
|
-
|
|
185
|
+
| Guide | Description |
|
|
186
|
+
|---|---|
|
|
187
|
+
| [Getting Started](docs/getting-started.md) | Installation, minimal example, constructor options |
|
|
188
|
+
| [API Reference](docs/api-reference.md) | Every public method, property, and return value |
|
|
189
|
+
| [Streaming](docs/streaming.md) | Token-by-token LLM response display |
|
|
190
|
+
| [Multi-User Chat](docs/multi-user-chat.md) | Multiple users, dual instances, message routing |
|
|
191
|
+
| [LLM Integration](docs/llm-integration.md) | Ollama, OpenAI, LM Studio, tool calls, conversational memory |
|
|
192
|
+
| [Theming](docs/theming.md) | Custom themes, CSS architecture, built-in themes |
|
|
193
|
+
| [CSS Architecture](docs/css-architecture.md) | Base vs theme separation, ARIA accessibility |
|
|
367
194
|
|
|
195
|
+
## Demo & Examples
|
|
368
196
|
|
|
197
|
+
[Live Demo](https://deftio.github.io/quikchat/site/) | [Examples](https://deftio.github.io/quikchat/examples/)
|
|
369
198
|
|
|
370
|
-
|
|
199
|
+
Examples include: basic UMD/ESM usage, theme switching, dual chatrooms, markdown rendering ([basic](./examples/example_markdown.html) and [full with syntax highlighting + math + diagrams](./examples/example_md_full.html)), streaming with Ollama/OpenAI/LM Studio, and React integration.
|
|
371
200
|
|
|
372
|
-
|
|
201
|
+
## Build Variants
|
|
373
202
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
203
|
+
| Build | What you get | Network |
|
|
204
|
+
|---|---|---|
|
|
205
|
+
| **Base** (`quikchat.umd.min.js`) | Chat widget, zero deps | None |
|
|
206
|
+
| **Markdown** (`quikchat-md.umd.min.js`) | + bold, italic, code, tables, lists | None |
|
|
207
|
+
| **Full** (`quikchat-md-full.umd.min.js`) | + syntax highlighting, math, diagrams, maps | CDN on demand |
|
|
208
|
+
| **CSS** (`quikchat.css`) | All 8 themes | None |
|
|
378
209
|
|
|
379
|
-
|
|
210
|
+
All builds are also available in ESM and CJS formats with sourcemaps. See the [downloads page](https://deftio.github.io/quikchat/site/downloads.html) for exact sizes, SRI hashes, and CDN links.
|
|
380
211
|
|
|
212
|
+
The `-md` builds bundle [quikdown](https://github.com/deftio/quikdown). The `-md-full` build post-processes fence blocks with dynamically loaded renderers (highlight.js, MathJax, Mermaid, Leaflet). The base builds have zero runtime dependencies.
|
|
381
213
|
|
|
382
|
-
|
|
383
|
-
## 🛠 Building from Source
|
|
214
|
+
## Building from Source
|
|
384
215
|
|
|
385
216
|
```bash
|
|
386
|
-
# Clone repository
|
|
387
|
-
git clone https://github.com/deftio/quikchat.git
|
|
388
|
-
cd quikchat
|
|
389
|
-
|
|
390
|
-
# Install dependencies
|
|
391
217
|
npm install
|
|
392
|
-
|
|
393
|
-
#
|
|
394
|
-
npm run build
|
|
395
|
-
|
|
396
|
-
# Run tests
|
|
397
|
-
npm test
|
|
398
|
-
|
|
399
|
-
# Start development server
|
|
400
|
-
npm run dev
|
|
218
|
+
npm run build # lint, build all formats, report bundle sizes
|
|
219
|
+
npm test # jest unit tests with coverage
|
|
401
220
|
```
|
|
402
221
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
222
|
+
Build-time tooling (rollup, babel, eslint, jest) is all in devDependencies — zero runtime dependencies.
|
|
406
223
|
|
|
407
|
-
##
|
|
224
|
+
## Testing
|
|
408
225
|
|
|
409
|
-
We welcome contributions! Here's how you can help:
|
|
410
|
-
|
|
411
|
-
1. **🐛 Report Issues** - Found a bug? [Open an issue](https://github.com/deftio/quikchat/issues)
|
|
412
|
-
2. **💡 Feature Requests** - Have an idea? We'd love to hear it
|
|
413
|
-
3. **🔧 Code Contributions** - Submit pull requests for bug fixes or new features
|
|
414
|
-
4. **📖 Documentation** - Help improve our guides and examples
|
|
415
|
-
5. **🌟 Share Examples** - Show us what you've built with QuikChat
|
|
416
|
-
|
|
417
|
-
### Development Setup
|
|
418
226
|
```bash
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
npm install
|
|
422
|
-
npm run dev
|
|
227
|
+
npm test # unit tests (jest, 100% coverage)
|
|
228
|
+
npm run test:e2e # browser tests (playwright)
|
|
423
229
|
```
|
|
424
230
|
|
|
425
|
-
|
|
426
|
-
|
|
231
|
+
## Development
|
|
427
232
|
|
|
233
|
+
```bash
|
|
234
|
+
npm run feature my-feature-name # creates feature/my-feature-name, bumps patch
|
|
235
|
+
npm run feature my-feature-name minor # bumps minor
|
|
236
|
+
```
|
|
428
237
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
QuikChat is licensed under the [BSD-2-Clause License](LICENSE.txt).
|
|
238
|
+
A pre-commit hook runs lint and tests automatically before each commit.
|
|
432
239
|
|
|
240
|
+
See [RELEASE-PROCEDURE.md](RELEASE-PROCEDURE.md) for the full release workflow.
|
|
433
241
|
|
|
242
|
+
## License
|
|
434
243
|
|
|
435
|
-
|
|
244
|
+
BSD-2-Clause
|
|
436
245
|
|
|
437
|
-
|
|
438
|
-
- **🐙 [GitHub Repository](https://github.com/deftio/quikchat)**
|
|
439
|
-
- **🚀 [Live Examples](https://deftio.github.io/quikchat/examples/)**
|
|
440
|
-
- **📖 [Medium Article](https://medium.com/gitconnected/quikchat-4be8d4a849e5)**
|
|
441
|
-
- **💬 [Issues & Support](https://github.com/deftio/quikchat/issues)**
|
|
246
|
+
## Home Page
|
|
442
247
|
|
|
248
|
+
[github.com/deftio/quikchat](https://github.com/deftio/quikchat)
|