@crestapps/ai-chat-ui 1.0.0-preview-22-preview.1

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 ADDED
@@ -0,0 +1,145 @@
1
+ # @crestapps/ai-chat-ui
2
+
3
+ Browser-ready JavaScript widgets and CSS for **CrestApps AI** chat sessions and chat interactions. Drop them into any page that uses the [CrestApps.Core](https://github.com/CrestApps/CrestApps.Core) backend to get a fully functional AI chat experience with streaming responses, document uploads, image generation, interactive charts, copy-to-clipboard, and user feedback buttons.
4
+
5
+ ## Features
6
+
7
+ | Feature | Details |
8
+ |---------|---------|
9
+ | **Streaming responses** | Real-time token-by-token output via SignalR or REST |
10
+ | **Image generation** | Inline rendering of images produced by `GenerateImageTool` |
11
+ | **Interactive charts** | [Chart.js](https://www.chartjs.org/) rendering of charts produced by `GenerateChartTool` (optional peer dependency) |
12
+ | **Document uploads** | Drag-and-drop or file-picker uploads attached to chat sessions |
13
+ | **Copy to clipboard** | One-click copy of any assistant message |
14
+ | **Feedback buttons** | Thumbs-up / thumbs-down per message |
15
+ | **Markdown rendering** | Powered by [marked](https://github.com/markedjs/marked) and [DOMPurify](https://github.com/cure53/DOMPurify) |
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install @crestapps/ai-chat-ui
21
+ ```
22
+
23
+ ### Optional: Chart.js Support
24
+
25
+ To render interactive charts, also install Chart.js:
26
+
27
+ ```bash
28
+ npm install chart.js
29
+ ```
30
+
31
+ ## Included Files
32
+
33
+ After installation the `dist/` directory contains:
34
+
35
+ | File | Description |
36
+ |------|-------------|
37
+ | `ai-chat.js` / `.min.js` | AI Chat widget — manages sessions, uploads, streaming, and the full chat UI |
38
+ | `chat-interaction.js` / `.min.js` | Chat Interaction widget — lighter standalone chat experience |
39
+ | `document-drop-zone.js` / `.min.js` | Drag-and-drop file upload component |
40
+ | `technical-name-generator.js` / `.min.js` | Auto-generates URL-safe technical names from display names |
41
+ | `chat-widget.css` / `.min.css` | Styles for the floating AI Chat widget |
42
+ | `document-drop-zone.css` / `.min.css` | Styles for the document drop-zone component |
43
+
44
+ ## Usage
45
+
46
+ ### Via CDN (simplest)
47
+
48
+ Use [jsDelivr](https://www.jsdelivr.com/) to load files directly — no install required:
49
+
50
+ ```html
51
+ <!-- CSS -->
52
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@crestapps/ai-chat-ui@1.0.0-preview-22/dist/chat-widget.min.css" />
53
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@crestapps/ai-chat-ui@1.0.0-preview-22/dist/document-drop-zone.min.css" />
54
+
55
+ <!-- Required dependencies -->
56
+ <script src="https://cdn.jsdelivr.net/npm/vue@3/dist/vue.global.prod.js"></script>
57
+ <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
58
+ <script src="https://cdn.jsdelivr.net/npm/dompurify/dist/purify.min.js"></script>
59
+ <script src="https://cdn.jsdelivr.net/npm/@microsoft/signalr/dist/browser/signalr.min.js"></script>
60
+
61
+ <!-- Optional: Chart.js for interactive charts -->
62
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
63
+
64
+ <!-- CrestApps AI Chat UI -->
65
+ <script src="https://cdn.jsdelivr.net/npm/@crestapps/ai-chat-ui@1.0.0-preview-22/dist/ai-chat.min.js"></script>
66
+ <script src="https://cdn.jsdelivr.net/npm/@crestapps/ai-chat-ui@1.0.0-preview-22/dist/document-drop-zone.min.js"></script>
67
+ ```
68
+
69
+ > **Tip:** Replace `@1.0.0-preview-22` with the version you want, or omit it to always get the latest release.
70
+
71
+ ### Via npm
72
+
73
+ ```bash
74
+ npm install @crestapps/ai-chat-ui
75
+ ```
76
+
77
+ Then copy the files from `node_modules/@crestapps/ai-chat-ui/dist/` into your web application's static assets folder and reference them with `<script>` and `<link>` tags.
78
+
79
+ ### CDN URL Pattern
80
+
81
+ All files in the package are available via jsDelivr using this pattern:
82
+
83
+ ```
84
+ https://cdn.jsdelivr.net/npm/@crestapps/ai-chat-ui@<version>/dist/<file>
85
+ ```
86
+
87
+ | Asset | CDN URL |
88
+ |-------|---------|
89
+ | `ai-chat.min.js` | `https://cdn.jsdelivr.net/npm/@crestapps/ai-chat-ui@1.0.0-preview-22/dist/ai-chat.min.js` |
90
+ | `chat-interaction.min.js` | `https://cdn.jsdelivr.net/npm/@crestapps/ai-chat-ui@1.0.0-preview-22/dist/chat-interaction.min.js` |
91
+ | `document-drop-zone.min.js` | `https://cdn.jsdelivr.net/npm/@crestapps/ai-chat-ui@1.0.0-preview-22/dist/document-drop-zone.min.js` |
92
+ | `technical-name-generator.min.js` | `https://cdn.jsdelivr.net/npm/@crestapps/ai-chat-ui@1.0.0-preview-22/dist/technical-name-generator.min.js` |
93
+ | `chat-widget.min.css` | `https://cdn.jsdelivr.net/npm/@crestapps/ai-chat-ui@1.0.0-preview-22/dist/chat-widget.min.css` |
94
+ | `document-drop-zone.min.css` | `https://cdn.jsdelivr.net/npm/@crestapps/ai-chat-ui@1.0.0-preview-22/dist/document-drop-zone.min.css` |
95
+
96
+ ### Initializing the AI Chat Widget
97
+
98
+ ```javascript
99
+ var chatManager = window.openAIChatManager();
100
+ chatManager.createInstance({
101
+ containerEl: '#ai-chat-container',
102
+ profileId: 'your-profile-id',
103
+ baseUrl: '/ai/chat-sessions',
104
+ hubUrl: '/ai-chat-hub'
105
+ });
106
+ ```
107
+
108
+ ### Initializing the Chat Interaction Widget
109
+
110
+ ```javascript
111
+ var interactionManager = window.chatInteractionManager();
112
+ interactionManager.createInstance({
113
+ containerEl: '#chat-interaction-container',
114
+ deploymentName: 'your-deployment-name',
115
+ baseUrl: '/chat-interactions',
116
+ hubUrl: '/chat-interaction-hub'
117
+ });
118
+ ```
119
+
120
+ ## Client-Side Dependencies
121
+
122
+ Both widgets expect these libraries to be loaded on the page **before** the CrestApps script:
123
+
124
+ | Library | Required | Purpose |
125
+ |---------|----------|---------|
126
+ | [Vue 3](https://vuejs.org/) | ✅ Yes | Reactive UI rendering |
127
+ | [marked](https://github.com/markedjs/marked) | ✅ Yes | Markdown → HTML conversion |
128
+ | [DOMPurify](https://github.com/cure53/DOMPurify) | ✅ Yes | HTML sanitization |
129
+ | [SignalR](https://learn.microsoft.com/aspnet/core/signalr/) | ✅ Yes | Real-time streaming |
130
+ | [Chart.js](https://www.chartjs.org/) | ❌ Optional | Interactive chart rendering |
131
+ | [highlight.js](https://highlightjs.org/) | ❌ Optional | Code syntax highlighting |
132
+
133
+ ## Backend Requirements
134
+
135
+ These widgets are designed to work with the [CrestApps.Core](https://github.com/CrestApps/CrestApps.Core) .NET backend. You need:
136
+
137
+ 1. **AI Chat sessions** — register with `.AddAISuite(ai => ai.AddChatInteractions(...))` or AI Profiles
138
+ 2. **At least one AI provider** — e.g., `.AddOpenAI()`, `.AddAzureOpenAI()`, `.AddOllama()`
139
+ 3. **SignalR hubs** — register with `.AddSignalR()`
140
+
141
+ See the [CrestApps.Core documentation](https://crestapps.com/docs/core/chat) for full backend setup instructions.
142
+
143
+ ## License
144
+
145
+ [MIT](https://github.com/CrestApps/CrestApps.Core/blob/main/LICENSE)