@doderasoftware/restify-ai 0.1.0-beta.5 โ†’ 0.1.0-beta.6

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.
Files changed (2) hide show
  1. package/README.md +123 -299
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,79 +1,41 @@
1
- <div align="center">
2
- <h1>๐Ÿค– Restify AI</h1>
3
- <p><strong>Professional AI Chatbot Component for Vue 3 + Laravel Restify</strong></p>
4
- <p>Build intelligent, context-aware AI assistants that integrate seamlessly with your Laravel backend</p>
5
-
6
- <a href="https://www.npmjs.com/package/@doderasoftware/restify-ai"><img src="https://img.shields.io/npm/v/@doderasoftware/restify-ai.svg?style=flat-square" alt="npm version"></a>
7
- <a href="https://www.npmjs.com/package/@doderasoftware/restify-ai"><img src="https://img.shields.io/npm/dm/@doderasoftware/restify-ai.svg?style=flat-square" alt="npm downloads"></a>
8
- <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square" alt="License: MIT"></a>
9
- <a href="https://vuejs.org/"><img src="https://img.shields.io/badge/Vue-3.x-brightgreen.svg?style=flat-square" alt="Vue 3"></a>
10
- <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-5.x-blue.svg?style=flat-square" alt="TypeScript"></a>
11
- <a href="https://tailwindcss.com/"><img src="https://img.shields.io/badge/TailwindCSS-3.x-38bdf8.svg?style=flat-square" alt="TailwindCSS"></a>
12
-
13
- <br /><br />
14
-
15
- <a href="https://laravel-restify.com">Laravel Restify</a> โ€ข
16
- <a href="https://binarcode.com">BinarCode</a> โ€ข
17
- <a href="#features">Features</a> โ€ข
18
- <a href="#installation">Installation</a> โ€ข
19
- <a href="#quick-start">Quick Start</a> โ€ข
20
- <a href="#configuration">Configuration</a>
21
- </div>
22
-
23
- ---
24
-
25
- ## Overview
26
-
27
- **Restify AI** is a production-ready Vue 3 component library that provides a fully-featured AI chatbot interface designed to work seamlessly with [Laravel Restify](https://laravel-restify.com) backends. Built by [BinarCode](https://binarcode.com), the team behind Laravel Restify, this package enables you to add powerful AI capabilities to your Vue.js applications in minutes.
28
-
29
- Whether you are building a customer support system, an intelligent assistant for your SaaS application, or an AI-powered admin panel, Restify AI provides all the building blocks you need.
30
-
31
- ## Features
32
-
33
- ### ๐ŸŽฏ Core Features
34
- - **Real-time SSE Streaming** - Smooth, character-by-character response streaming
35
- - **File Attachments** - Upload and process documents, images, and more
36
- - **@Mentions System** - Reference entities from your application (users, documents, etc.)
37
- - **Context-Aware Suggestions** - Smart prompts based on current page/route
38
- - **Chat History** - Persistent conversation memory with configurable limits
39
- - **Markdown Rendering** - Beautiful formatting with syntax highlighting
40
- - **Quota Management** - Track and display API usage limits
41
-
42
- ### ๐ŸŽจ UI/UX
43
- - **Fully Customizable** - Override any style with Tailwind CSS classes
44
- - **Dark Mode Support** - Automatic dark/light theme detection
45
- - **Responsive Design** - Works on desktop, tablet, and mobile
46
- - **Keyboard Shortcuts** - Quick access with configurable shortcuts (Cmd/Ctrl+G)
47
- - **Fullscreen Mode** - Expandable chat interface
48
- - **Animations** - Smooth transitions and loading states
49
- - **Customizable Avatars** - Use custom components or images
50
-
51
- ### ๐Ÿ”ง Developer Experience
52
- - **TypeScript First** - Full type definitions included
53
- - **Vue 3 Composition API** - Modern Vue patterns
54
- - **Pinia Integration** - State management built-in
55
- - **Slot-Based Customization** - Override any component section
56
- - **Lifecycle Hooks** - Tap into every stage of the chat flow
57
- - **i18n Ready** - Full internationalization support
58
-
59
- ### ๐Ÿ”’ Enterprise Ready
60
- - **Support Mode** - Route conversations to human agents
61
- - **Permission System** - Control features based on user permissions
62
- - **Request/Response Interceptors** - Customize API communication
63
- - **Retry Logic** - Automatic retry with configurable backoff
64
- - **Error Handling** - User-friendly error messages
65
-
66
- ## Installation
1
+ # @doderasoftware/restify-ai
2
+
3
+ A production-ready AI chatbot component for Vue 3 with real-time SSE streaming, file attachments, @mentions, and seamless Laravel Restify integration.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@doderasoftware/restify-ai.svg)](https://www.npmjs.com/package/@doderasoftware/restify-ai)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+ [![Vue 3](https://img.shields.io/badge/Vue-3.x-brightgreen.svg)](https://vuejs.org/)
8
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-blue.svg)](https://www.typescriptlang.org/)
9
+ [![TailwindCSS](https://img.shields.io/badge/TailwindCSS-3.x-38bdf8.svg)](https://tailwindcss.com/)
10
+
11
+ **๐Ÿ“– [Laravel Restify](https://laravel-restify.com) | ๐Ÿ“ฆ [npm](https://www.npmjs.com/package/@doderasoftware/restify-ai) | ๐Ÿข [BinarCode](https://binarcode.com)**
12
+
13
+ ## โœจ Features
14
+
15
+ - ๐ŸŒŠ **Real-time SSE Streaming** - Smooth character-by-character response streaming
16
+ - ๐Ÿ“Ž **File Attachments** - Upload and process documents, images, and more
17
+ - ๐Ÿ‘ฅ **@Mentions System** - Reference entities from your application (users, documents, etc.)
18
+ - ๐Ÿ’ก **Context-Aware Suggestions** - Smart prompts based on current page/route
19
+ - ๐Ÿ’ฌ **Chat History** - Persistent conversation memory with configurable limits
20
+ - ๐Ÿ“ **Markdown Rendering** - Beautiful formatting with syntax highlighting
21
+ - ๐Ÿ“Š **Quota Management** - Track and display API usage limits
22
+ - ๐ŸŽจ **Fully Customizable** - Override any style with Tailwind CSS classes
23
+ - ๐ŸŒ™ **Dark Mode Support** - Automatic dark/light theme detection
24
+ - ๐Ÿ“ฑ **Responsive Design** - Works on desktop, tablet, and mobile
25
+ - โŒจ๏ธ **Keyboard Shortcuts** - Quick access with configurable shortcuts (Cmd/Ctrl+G)
26
+ - ๐Ÿ”ณ **Fullscreen Mode** - Expandable chat interface
27
+ - ๐ŸŽฏ **TypeScript First** - Full type definitions included
28
+ - ๐Ÿ—ƒ๏ธ **Pinia Integration** - State management built-in
29
+ - ๐Ÿ”ง **Slot-Based Customization** - Override any component section
30
+ - ๐ŸŒ **i18n Ready** - Full internationalization support
31
+ - ๐Ÿ†˜ **Support Mode** - Route conversations to human agents
32
+ - ๐Ÿ”„ **Retry Logic** - Automatic retry with configurable backoff
33
+ - โš ๏ธ **Error Handling** - User-friendly error messages
34
+
35
+ ## ๐Ÿ“ฆ Installation
67
36
 
68
37
  ```bash
69
- # npm
70
38
  npm install @doderasoftware/restify-ai
71
-
72
- # yarn
73
- yarn add @doderasoftware/restify-ai
74
-
75
- # pnpm
76
- pnpm add @doderasoftware/restify-ai
77
39
  ```
78
40
 
79
41
  ### Peer Dependencies
@@ -82,7 +44,7 @@ pnpm add @doderasoftware/restify-ai
82
44
  npm install vue@^3.3.0 pinia@^2.1.0 tailwindcss@^3.3.0
83
45
  ```
84
46
 
85
- ## Quick Start
47
+ ## ๐Ÿš€ Quick Start
86
48
 
87
49
  ### 1. Configure Tailwind CSS
88
50
 
@@ -169,7 +131,7 @@ import { useAiDrawerShortcut } from "@doderasoftware/restify-ai"
169
131
  useAiDrawerShortcut()
170
132
  ```
171
133
 
172
- ## Configuration
134
+ ## โš™๏ธ Configuration
173
135
 
174
136
  ### Full Configuration Options
175
137
 
@@ -200,16 +162,20 @@ app.use(RestifyAiPlugin, {
200
162
  loadingText: "Thinking...",
201
163
  },
202
164
 
203
- // PROVIDERS
165
+ // MENTION PROVIDERS
204
166
  mentionProviders: [{
205
167
  type: "user",
206
168
  label: "Users",
207
- search: async (q) => api.searchUsers(q),
169
+ search: async (query) => api.searchUsers(query),
208
170
  }],
171
+
172
+ // SUGGESTION PROVIDERS
209
173
  suggestionProviders: [{
210
174
  id: "invoices",
211
175
  routes: ["/invoices/*"],
212
- getSuggestions: (ctx) => [{ id: "1", title: "Create Invoice", prompt: "Help me create an invoice" }],
176
+ getSuggestions: (ctx) => [
177
+ { id: "1", title: "Create Invoice", prompt: "Help me create an invoice" }
178
+ ],
213
179
  }],
214
180
 
215
181
  // THEMING
@@ -228,7 +194,7 @@ app.use(RestifyAiPlugin, {
228
194
  keyboardShortcut: "cmd+g",
229
195
  enableSupportMode: true,
230
196
 
231
- // CUSTOM COMPONENTS
197
+ // CUSTOM AVATARS
232
198
  assistantAvatar: CustomAvatarComponent,
233
199
  userAvatar: () => currentUser.value?.avatarUrl,
234
200
 
@@ -240,9 +206,59 @@ app.use(RestifyAiPlugin, {
240
206
  })
241
207
  ```
242
208
 
243
- ## Component API
209
+ ## ๐ŸŽจ UI Customization
244
210
 
245
- ### AiChatDrawer Props
211
+ The `:ui` prop allows complete control over every element's styling:
212
+
213
+ ```vue
214
+ <AiChatDrawer
215
+ v-model="isOpen"
216
+ :ui="{
217
+ backdrop: 'bg-black/50 backdrop-blur-sm',
218
+ drawer: 'shadow-2xl',
219
+ panel: 'bg-gray-50 dark:bg-gray-900',
220
+ header: 'border-b-2 border-blue-500',
221
+ newChatButton: 'bg-gradient-to-r from-blue-500 to-purple-500',
222
+ }"
223
+ />
224
+ ```
225
+
226
+ ### Available UI Keys - AiChatDrawer
227
+
228
+ | Key | Description |
229
+ |-----|-------------|
230
+ | `backdrop` | Backdrop overlay |
231
+ | `drawer` | Drawer container |
232
+ | `panel` | Inner panel |
233
+ | `header` | Header container |
234
+ | `headerTitle` | Header title text |
235
+ | `body` | Chat body area |
236
+ | `footer` | Footer container |
237
+ | `newChatButton` | New chat button |
238
+ | `errorContainer` | Error message container |
239
+ | `retryButton` | Retry button |
240
+
241
+ ### Available UI Keys - ChatInput
242
+
243
+ | Key | Description |
244
+ |-----|-------------|
245
+ | `root` | Input root container |
246
+ | `textarea` | Textarea element |
247
+ | `sendButton` | Send button |
248
+ | `attachButton` | Attachment button |
249
+ | `suggestionsDropdown` | Suggestions dropdown |
250
+
251
+ ### Available UI Keys - ChatMessage
252
+
253
+ | Key | Description |
254
+ |-----|-------------|
255
+ | `root` | Message root container |
256
+ | `userBubble` | User message bubble |
257
+ | `assistantBubble` | Assistant message bubble |
258
+ | `content` | Message content |
259
+ | `loadingDots` | Loading animation dots |
260
+
261
+ ## ๐Ÿ“‹ Props
246
262
 
247
263
  | Prop | Type | Default | Description |
248
264
  |------|------|---------|-------------|
@@ -258,7 +274,7 @@ app.use(RestifyAiPlugin, {
258
274
  | `ui` | `AiChatDrawerUI` | `{}` | Custom CSS classes |
259
275
  | `texts` | `AiChatDrawerTexts` | `{}` | Custom text labels |
260
276
 
261
- ### Events
277
+ ## ๐Ÿ“ก Events
262
278
 
263
279
  | Event | Payload | Description |
264
280
  |-------|---------|-------------|
@@ -267,7 +283,14 @@ app.use(RestifyAiPlugin, {
267
283
  | `contact-support` | - | Support mode activated |
268
284
  | `new-chat` | - | New chat started |
269
285
 
270
- ### Slots
286
+ ## ๐ŸŽฐ Slots
287
+
288
+ | Slot | Props | Description |
289
+ |------|-------|-------------|
290
+ | `header` | `{ quota, isFullscreen, onNewChat, onClose }` | Custom header |
291
+ | `empty-state` | `{ suggestions, onClick }` | Custom empty state |
292
+ | `message` | `{ message, isUser, isLoading }` | Custom message bubble |
293
+ | `input` | `{ modelValue, sending, onSubmit }` | Custom input area |
271
294
 
272
295
  ```vue
273
296
  <AiChatDrawer v-model="isOpen">
@@ -286,57 +309,7 @@ app.use(RestifyAiPlugin, {
286
309
  </AiChatDrawer>
287
310
  ```
288
311
 
289
- ## UI Customization
290
-
291
- Every component accepts a `ui` prop for CSS class customization:
292
-
293
- ```vue
294
- <AiChatDrawer
295
- v-model="isOpen"
296
- :ui="{
297
- backdrop: "bg-black/50 backdrop-blur-sm",
298
- drawer: "shadow-2xl",
299
- panel: "bg-gray-50 dark:bg-gray-900",
300
- header: "border-b-2 border-blue-500",
301
- newChatButton: "bg-gradient-to-r from-blue-500 to-purple-500",
302
- }"
303
- />
304
- ```
305
-
306
- ### Available UI Interfaces
307
-
308
- ```typescript
309
- interface AiChatDrawerUI {
310
- backdrop?: string
311
- drawer?: string
312
- panel?: string
313
- header?: string
314
- headerTitle?: string
315
- body?: string
316
- footer?: string
317
- newChatButton?: string
318
- errorContainer?: string
319
- retryButton?: string
320
- }
321
-
322
- interface ChatInputUI {
323
- root?: string
324
- textarea?: string
325
- sendButton?: string
326
- attachButton?: string
327
- suggestionsDropdown?: string
328
- }
329
-
330
- interface ChatMessageUI {
331
- root?: string
332
- userBubble?: string
333
- assistantBubble?: string
334
- content?: string
335
- loadingDots?: string
336
- }
337
- ```
338
-
339
- ## Store API
312
+ ## ๐Ÿช Store API
340
313
 
341
314
  Access the Pinia store for advanced use cases:
342
315
 
@@ -362,156 +335,11 @@ store.fetchQuota()
362
335
  store.uploadFile(file)
363
336
  ```
364
337
 
365
- ## Composables
338
+ ## ๐Ÿช Composables
366
339
 
367
340
  ### useAiDrawerShortcut
368
341
 
369
- ```typescript
370
- import { useAiDrawerShortcut } from "@doderasoftware/restify-ai"
371
-
372
- // Uses store directly (recommended)
373
- useAiDrawerShortcut()
374
-
375
- // Or pass a ref
376
- const drawerRef = ref(false)
377
- useAiDrawerShortcut(drawerRef)
378
- ```
379
-
380
- ### usePageAiContext
381
-
382
- ```typescript
383
- import { usePageAiContext } from "@doderasoftware/restify-ai"
384
-
385
- usePageAiContext({
386
- pageType: "invoice-detail",
387
- entityId: route.params.id,
388
- entityType: "invoice",
389
- metadata: { customerName: invoice.value?.customer?.name },
390
- })
391
- ```
392
-
393
- ## Backend Integration
394
-
395
- ### Laravel Restify Setup
396
-
397
- This package is designed to work with [Laravel Restify](https://laravel-restify.com):
398
-
399
- ```php
400
- // routes/api.php
401
- Route::middleware("auth:sanctum")->group(function () {
402
- Route::post("/ai/ask", [AiController::class, "ask"]);
403
- Route::post("/ai/upload", [AiController::class, "upload"]);
404
- Route::get("/ai/quota", [AiController::class, "quota"]);
405
- });
406
- ```
407
-
408
- ### Expected Request/Response Formats
409
-
410
- **Ask Endpoint (SSE Stream):**
411
-
412
- ```typescript
413
- // Request
414
- {
415
- question: string
416
- history: Array<{ role: string, message: string }>
417
- stream: true
418
- files?: Array<{ id: string, name: string }>
419
- mentions?: Array<{ id: string, type: string, name: string }>
420
- }
421
-
422
- // Response: Server-Sent Events (OpenAI format)
423
- data: {"choices":[{"delta":{"content":"Hello"}}]}
424
- data: {"choices":[{"delta":{"content":" world"}}]}
425
- data: [DONE]
426
- ```
427
-
428
- **Upload Endpoint:**
429
-
430
- ```typescript
431
- { id: string, name: string, url: string, type: string, size: number }
432
- ```
433
-
434
- **Quota Endpoint:**
435
-
436
- ```typescript
437
- { limit: number, used: number, remaining: number }
438
- ```
439
-
440
- ## TypeScript Support
441
-
442
- Full TypeScript support with exported types:
443
-
444
- ```typescript
445
- import type {
446
- ChatMessage,
447
- ChatAttachment,
448
- Mention,
449
- ChatQuota,
450
- RestifyAiConfig,
451
- MentionProvider,
452
- SuggestionProvider,
453
- AISuggestion,
454
- AiChatDrawerUI,
455
- AiChatDrawerTexts,
456
- } from "@doderasoftware/restify-ai"
457
- ```
458
-
459
- ## Browser Support
460
-
461
- - Chrome 80+
462
- - Firefox 75+
463
- - Safari 13+
464
- - Edge 80+
465
-
466
- ## Contributing
467
-
468
- We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
469
-
470
- ## License
471
-
472
- [MIT](LICENSE) - [BinarCode](https://binarcode.com)
473
-
474
- ---
475
-
476
- <div align="center">
477
- <p><strong>Built with love by <a href="https://binarcode.com">BinarCode</a></strong></p>
478
- <p>
479
- <a href="https://laravel-restify.com">Laravel Restify</a> |
480
- <a href="https://github.com/BinarCode/laravel-restify">GitHub</a> |
481
- <a href="https://binarcode.com">Website</a>
482
- </p>
483
- <p><sub>Published by <a href="https://doderasoft.com">Dodera Software</a></sub></p>
484
- </div>
485
-
486
- ## Store API
487
-
488
- Access the Pinia store for advanced use cases:
489
-
490
- ```typescript
491
- import { useRestifyAiStore } from "@doderasoftware/restify-ai"
492
-
493
- const store = useRestifyAiStore()
494
-
495
- // State
496
- store.chatHistory // ChatMessage[]
497
- store.loading // boolean
498
- store.sending // boolean
499
- store.quota // { limit, used, remaining }
500
- store.error // { message, failedQuestion, timestamp }
501
-
502
- // Actions
503
- store.toggleChat()
504
- store.sendMessage(payload)
505
- store.cancelRequest()
506
- store.retryLastMessage()
507
- store.clearChatHistory()
508
- store.fetchQuota()
509
- store.uploadFile(file)
510
- ```
511
-
512
- ## Composables
513
-
514
- ### useAiDrawerShortcut
342
+ Enable keyboard shortcuts to toggle the chat drawer:
515
343
 
516
344
  ```typescript
517
345
  import { useAiDrawerShortcut } from "@doderasoftware/restify-ai"
@@ -526,6 +354,8 @@ useAiDrawerShortcut(drawerRef)
526
354
 
527
355
  ### usePageAiContext
528
356
 
357
+ Provide page context to the AI for smarter responses:
358
+
529
359
  ```typescript
530
360
  import { usePageAiContext } from "@doderasoftware/restify-ai"
531
361
 
@@ -537,9 +367,7 @@ usePageAiContext({
537
367
  })
538
368
  ```
539
369
 
540
- ## Backend Integration
541
-
542
- ### Laravel Restify Setup
370
+ ## ๐Ÿ”Œ Backend Integration
543
371
 
544
372
  This package is designed to work with [Laravel Restify](https://laravel-restify.com):
545
373
 
@@ -575,16 +403,18 @@ data: [DONE]
575
403
  **Upload Endpoint:**
576
404
 
577
405
  ```typescript
406
+ // Response
578
407
  { id: string, name: string, url: string, type: string, size: number }
579
408
  ```
580
409
 
581
410
  **Quota Endpoint:**
582
411
 
583
412
  ```typescript
413
+ // Response
584
414
  { limit: number, used: number, remaining: number }
585
415
  ```
586
416
 
587
- ## TypeScript Support
417
+ ## ๐Ÿ“ TypeScript
588
418
 
589
419
  Full TypeScript support with exported types:
590
420
 
@@ -603,29 +433,23 @@ import type {
603
433
  } from "@doderasoftware/restify-ai"
604
434
  ```
605
435
 
606
- ## Browser Support
436
+ ## ๐ŸŒ Browser Support
607
437
 
608
438
  - Chrome 80+
609
439
  - Firefox 75+
610
440
  - Safari 13+
611
441
  - Edge 80+
612
442
 
613
- ## Contributing
443
+ ## ๐Ÿ”— Links
614
444
 
615
- We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
445
+ - [๐Ÿ“– Laravel Restify Documentation](https://laravel-restify.com)
446
+ - [๐Ÿ“ฆ npm Package](https://www.npmjs.com/package/@doderasoftware/restify-ai)
447
+ - [๐Ÿข BinarCode](https://binarcode.com)
616
448
 
617
- ## License
449
+ ## ๐Ÿ“„ License
618
450
 
619
- [MIT](LICENSE) - [BinarCode](https://binarcode.com)
451
+ MIT ยฉ [BinarCode](https://binarcode.com)
620
452
 
621
453
  ---
622
454
 
623
- <div align="center">
624
- <p><strong>Built with love by <a href="https://binarcode.com">BinarCode</a></strong></p>
625
- <p>
626
- <a href="https://laravel-restify.com">Laravel Restify</a> |
627
- <a href="https://github.com/BinarCode/laravel-restify">GitHub</a> |
628
- <a href="https://binarcode.com">Website</a>
629
- </p>
630
- <p><sub>Published by <a href="https://doderasoft.com">Dodera Software</a></sub></p>
631
- </div>
455
+ Built with โค๏ธ by [BinarCode](https://binarcode.com) ยท Published by [Dodera Software](https://doderasoft.com)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doderasoftware/restify-ai",
3
- "version": "0.1.0-beta.5",
3
+ "version": "0.1.0-beta.6",
4
4
  "description": "Professional AI Chatbot Vue 3 component for Laravel Restify backends. SSE streaming, file uploads, @mentions, context-aware suggestions, and full TypeScript support.",
5
5
  "type": "module",
6
6
  "main": "./dist/restify-ai.umd.cjs",