orbitchat 1.0.0
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 +314 -0
- package/bin/orbitchat.js +435 -0
- package/dist/assets/Tableau10-D7jGxypv-Cyu9clx1.js +1 -0
- package/dist/assets/__vite-browser-external-BIHI7g3E.js +1 -0
- package/dist/assets/api-m_QXEYxU.js +2 -0
- package/dist/assets/arc-hH97QygY-EgRQ19vy.js +1 -0
- package/dist/assets/blockDiagram-c4efeb88-CLLcV2XJ-BlzQog67.js +118 -0
- package/dist/assets/c4Diagram-c83219d4-Bq976NrW-DIPXTaap.js +10 -0
- package/dist/assets/channel-CSC8iKVS-o3Tgkjx3.js +1 -0
- package/dist/assets/classDiagram-beda092f-7G8Y9ObP-CrnhVq3q.js +2 -0
- package/dist/assets/classDiagram-v2-2358418a-CYz_KHej-BnPcDcYV.js +2 -0
- package/dist/assets/clone-vCPXKFeo-DdQ4WIiO.js +1 -0
- package/dist/assets/createText-1719965b-Cbn6MBZp-zrb_KsAx.js +7 -0
- package/dist/assets/edges-96097737-XAH6P1yX-hj5ay2ub.js +4 -0
- package/dist/assets/erDiagram-0228fc6a-Bj5SeSQq-SNOEiwxn.js +51 -0
- package/dist/assets/flowDb-c6c81e3f-CaVKc_SB-DeOFQ2aw.js +10 -0
- package/dist/assets/flowDiagram-50d868cf-BcT1Qv7E-CI_0iUc_.js +4 -0
- package/dist/assets/flowDiagram-v2-4f6560a1-B0fti9Da-D8Np9r9b.js +1 -0
- package/dist/assets/flowchart-elk-definition-6af322e1-CIF5zs_e-CA7galDX.js +139 -0
- package/dist/assets/ganttDiagram-a2739b55-wX4z0bcl-BV5WSU0F.js +257 -0
- package/dist/assets/gitGraphDiagram-82fe8481-BTMrrqSM-BAXm_J1X.js +70 -0
- package/dist/assets/graph-Bc6U-Oet-BbypjADy.js +1 -0
- package/dist/assets/index-5325376f-DCLsNwAa-BxOfAZRl.js +1 -0
- package/dist/assets/index-BKRCw_DF.js +966 -0
- package/dist/assets/index-BbD-jy76.css +1 -0
- package/dist/assets/infoDiagram-8eee0895-CGdieI3d-CeI4A8me.js +7 -0
- package/dist/assets/journeyDiagram-c64418c1-D741T7Vx-D7bBbz5a.js +139 -0
- package/dist/assets/layout-BtHnec7v-DPk8SWBY.js +1 -0
- package/dist/assets/mindmap-definition-8da855dc-DYXCEYTW-C9VeqS3S.js +425 -0
- package/dist/assets/pieDiagram-a8764435-56nwm0bs-OTliuzET.js +35 -0
- package/dist/assets/quadrantDiagram-1e28029f-BPDrTwrc-BeDUiVSw.js +7 -0
- package/dist/assets/requirementDiagram-08caed73-ErOyM087-fZE1bidE.js +52 -0
- package/dist/assets/sankeyDiagram-a04cb91d-Dr_h6k2R-DV92AQzo.js +8 -0
- package/dist/assets/sequenceDiagram-c5b8d532-wtK0ihCE-CMdlx77G.js +122 -0
- package/dist/assets/stateDiagram-1ecb1508-D6rDYnWS-BXgBNGIv.js +1 -0
- package/dist/assets/stateDiagram-v2-c2b004d7-K0flL3uN-DMmV3VwJ.js +1 -0
- package/dist/assets/styles-b4e223ce-CPkoRhK8-B88f_9TS.js +160 -0
- package/dist/assets/styles-ca3715f6-FCD4s0nN-BJNUoxcm.js +207 -0
- package/dist/assets/styles-d45a18b0-7fTS_K4G-BSFqTrx5.js +116 -0
- package/dist/assets/svgDrawCommon-b86b1483-C9ebAubK-DzwEtGVK.js +1 -0
- package/dist/assets/timeline-definition-faaaa080-C-TPmIif-CPB6N7Tu.js +61 -0
- package/dist/assets/xychartDiagram-f5964ef8-Dy6Sev6Z-UG5jLwgB.js +7 -0
- package/dist/index.html +26 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
# ORBIT Chat App
|
|
2
|
+
|
|
3
|
+
A standalone chat application for ORBIT that can be installed as an npm package and run as a CLI tool. Integrates with the `@schmitech/chatbot-api` package for real-time streaming chat responses and file upload capabilities.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### As an npm Package (CLI Tool)
|
|
8
|
+
|
|
9
|
+
Install globally:
|
|
10
|
+
```bash
|
|
11
|
+
npm install -g orbitchat
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Or install locally:
|
|
15
|
+
```bash
|
|
16
|
+
npm install orbitchat
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### CLI Tool
|
|
22
|
+
|
|
23
|
+
After installing globally, run:
|
|
24
|
+
```bash
|
|
25
|
+
orbitchat
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The app will start a server at `http://localhost:5173` by default.
|
|
29
|
+
|
|
30
|
+
#### CLI Options
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
orbitchat [options]
|
|
34
|
+
|
|
35
|
+
Options:
|
|
36
|
+
--api-url URL API URL (default: http://localhost:3000)
|
|
37
|
+
--api-key KEY Default API key (default: default-key)
|
|
38
|
+
--use-local-api BOOLEAN Use local API build (default: false)
|
|
39
|
+
--local-api-path PATH Path to local API
|
|
40
|
+
--console-debug BOOLEAN Enable console debug (default: false)
|
|
41
|
+
--enable-upload-button BOOLEAN Enable upload button (default: false)
|
|
42
|
+
--enable-feedback-buttons BOOLEAN Enable feedback buttons (default: false)
|
|
43
|
+
--max-files-per-conversation N Max files per conversation (default: 5)
|
|
44
|
+
--max-file-size-mb N Max file size in MB (default: 50)
|
|
45
|
+
--max-total-files N Max total files (default: 100, 0 = unlimited)
|
|
46
|
+
--max-conversations N Max conversations (default: 10, 0 = unlimited)
|
|
47
|
+
--max-messages-per-conversation N Max messages per conversation (default: 1000, 0 = unlimited)
|
|
48
|
+
--max-total-messages N Max total messages (default: 10000, 0 = unlimited)
|
|
49
|
+
--max-message-length N Max message length (default: 1000)
|
|
50
|
+
--port PORT Server port (default: 5173)
|
|
51
|
+
--host HOST Server host (default: localhost)
|
|
52
|
+
--open Open browser automatically
|
|
53
|
+
--config PATH Path to config file (default: ~/.orbit-chat-app/config.json)
|
|
54
|
+
--help, -h Show help message
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### Examples
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Start with custom API URL and port
|
|
61
|
+
orbitchat --api-url http://localhost:3000 --port 8080
|
|
62
|
+
|
|
63
|
+
# Start with API key and open browser
|
|
64
|
+
orbitchat --api-key my-key --open
|
|
65
|
+
|
|
66
|
+
# Start with custom config file
|
|
67
|
+
orbitchat --config /path/to/config.json
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Configuration File
|
|
71
|
+
|
|
72
|
+
Create a config file at `~/.orbit-chat-app/config.json`:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"apiUrl": "http://localhost:3000",
|
|
77
|
+
"defaultKey": "default-key",
|
|
78
|
+
"port": 5173,
|
|
79
|
+
"host": "localhost",
|
|
80
|
+
"enableUploadButton": false,
|
|
81
|
+
"enableFeedbackButtons": false,
|
|
82
|
+
"maxFilesPerConversation": 5,
|
|
83
|
+
"maxFileSizeMB": 50,
|
|
84
|
+
"maxTotalFiles": 100,
|
|
85
|
+
"maxConversations": 10,
|
|
86
|
+
"maxMessagesPerConversation": 1000,
|
|
87
|
+
"maxTotalMessages": 10000,
|
|
88
|
+
"maxMessageLength": 1000
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Configuration Priority
|
|
93
|
+
|
|
94
|
+
Configuration is loaded in the following priority order:
|
|
95
|
+
1. CLI arguments (highest priority)
|
|
96
|
+
2. Config file (`~/.orbit-chat-app/config.json`)
|
|
97
|
+
3. Environment variables (`VITE_*`)
|
|
98
|
+
4. Default values (lowest priority)
|
|
99
|
+
|
|
100
|
+
**Note:** GitHub stats and GitHub owner/repo are always shown and default to "schmitech/orbit". These are only configurable via build-time environment variables (`VITE_SHOW_GITHUB_STATS`, `VITE_GITHUB_OWNER`, `VITE_GITHUB_REPO`) for developers who fork the repository and build their own version.
|
|
101
|
+
|
|
102
|
+
### Environment Variables
|
|
103
|
+
|
|
104
|
+
You can also set configuration via environment variables (for development):
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
VITE_API_URL=http://localhost:3000
|
|
108
|
+
VITE_DEFAULT_KEY=default-key
|
|
109
|
+
VITE_ENABLE_UPLOAD_BUTTON=false
|
|
110
|
+
VITE_CONSOLE_DEBUG=false
|
|
111
|
+
# ... etc
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Development
|
|
115
|
+
|
|
116
|
+
### Local Development Setup
|
|
117
|
+
|
|
118
|
+
For local development, clone the repository and install dependencies:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npm install
|
|
122
|
+
npm run dev
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Configuration
|
|
126
|
+
|
|
127
|
+
The application supports multiple ways to configure the API:
|
|
128
|
+
|
|
129
|
+
### 1. Environment Variables (Vite)
|
|
130
|
+
Create a `.env.local` file in the root directory:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
VITE_API_URL=https://your-api-endpoint.com
|
|
134
|
+
VITE_DEFAULT_KEY=default-key # Default API key used when no key is configured
|
|
135
|
+
VITE_USE_LOCAL_API=true # Set to 'true' to use local API build
|
|
136
|
+
VITE_LOCAL_API_PATH=/api.mjs # Path to local API (defaults to /api.mjs from public directory)
|
|
137
|
+
VITE_CONSOLE_DEBUG=false # Enable debug logging
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 2. Window Variables
|
|
141
|
+
Set global variables in your HTML or before the app loads:
|
|
142
|
+
|
|
143
|
+
```javascript
|
|
144
|
+
window.CHATBOT_API_URL = 'https://your-api-endpoint.com';
|
|
145
|
+
window.CHATBOT_API_KEY = 'your-api-key-here';
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 3. Runtime Configuration
|
|
149
|
+
Use the "Configure API" button in the chat interface to set the API URL and key at runtime.
|
|
150
|
+
|
|
151
|
+
## Local Development Setup
|
|
152
|
+
|
|
153
|
+
### Using Local API Build
|
|
154
|
+
|
|
155
|
+
For local development, you can use the local API build instead of the npm package:
|
|
156
|
+
|
|
157
|
+
**Option 1: Use the convenience script** (recommended):
|
|
158
|
+
```bash
|
|
159
|
+
npm run dev:with-api
|
|
160
|
+
```
|
|
161
|
+
This script automatically:
|
|
162
|
+
1. Builds the API from `../node-api`
|
|
163
|
+
2. Copies the built files to `public/api.mjs`
|
|
164
|
+
3. Starts the dev server with local API enabled
|
|
165
|
+
|
|
166
|
+
**Option 2: Manual setup**:
|
|
167
|
+
```bash
|
|
168
|
+
# Build and copy API files
|
|
169
|
+
npm run build:api
|
|
170
|
+
|
|
171
|
+
# Start dev server with local API
|
|
172
|
+
npm run dev:local
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Option 3: Build API separately**:
|
|
176
|
+
```bash
|
|
177
|
+
# From node-api directory
|
|
178
|
+
cd ../node-api
|
|
179
|
+
npm run build:chat-app
|
|
180
|
+
|
|
181
|
+
# Then start chat-app
|
|
182
|
+
cd ../chat-app
|
|
183
|
+
npm run dev:local
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
The local API files will be copied to `src/api/local/` directory. When `VITE_USE_LOCAL_API=true` is set, the app will load `./local/api.mjs` from the src directory instead of the npm package.
|
|
187
|
+
|
|
188
|
+
## Features
|
|
189
|
+
|
|
190
|
+
- **Streaming Responses**: Real-time streaming of AI responses
|
|
191
|
+
- **File Upload**: Upload and attach files (PDF, DOCX, TXT, CSV, JSON, HTML, images, audio) to conversations
|
|
192
|
+
- **File Context**: Query uploaded files and include them in chat context
|
|
193
|
+
- **Session Management**: Automatic session ID generation and persistence
|
|
194
|
+
- **Error Handling**: Comprehensive error handling with user-friendly messages
|
|
195
|
+
- **Conversation Persistence**: Chat history is saved to localStorage
|
|
196
|
+
- **API Configuration**: Flexible API configuration options
|
|
197
|
+
|
|
198
|
+
## Usage
|
|
199
|
+
|
|
200
|
+
### Basic Chat
|
|
201
|
+
|
|
202
|
+
1. Configure your API settings using one of the methods above
|
|
203
|
+
2. Start a conversation by typing a message
|
|
204
|
+
3. The AI will respond with streaming text
|
|
205
|
+
4. Use the regenerate button (↻) to regenerate responses
|
|
206
|
+
5. Use the copy button to copy AI responses to clipboard
|
|
207
|
+
|
|
208
|
+
### File Upload
|
|
209
|
+
|
|
210
|
+
1. Click the paperclip icon (📎) in the message input
|
|
211
|
+
2. Upload files using drag-and-drop or file picker
|
|
212
|
+
3. Supported formats: PDF, DOCX, TXT, CSV, JSON, HTML, Markdown, images (PNG, JPEG, TIFF), audio (WAV, MP3)
|
|
213
|
+
4. Files are automatically processed and indexed
|
|
214
|
+
5. Attach files to messages - they will be included in the chat context
|
|
215
|
+
6. Files are chunked and stored in the vector store for semantic search
|
|
216
|
+
|
|
217
|
+
**File Upload Flow**:
|
|
218
|
+
- Upload files using the file upload UI
|
|
219
|
+
- Files are processed on the server (extraction, chunking, embedding)
|
|
220
|
+
- File IDs are automatically included with your messages
|
|
221
|
+
- The AI can query and reference uploaded files in responses
|
|
222
|
+
|
|
223
|
+
## File Upload Details
|
|
224
|
+
|
|
225
|
+
### Supported File Types
|
|
226
|
+
|
|
227
|
+
| Type | Formats | Processing |
|
|
228
|
+
|------|---------|------------|
|
|
229
|
+
| Documents | PDF, DOCX, PPTX, XLSX | Text extraction, chunking, vector indexing |
|
|
230
|
+
| Text | TXT, MD, HTML | Direct chunking and indexing |
|
|
231
|
+
| Data | CSV, Parquet | DuckDB integration or vector store |
|
|
232
|
+
| Images | PNG, JPEG, TIFF | OCR via vision service |
|
|
233
|
+
| Audio | WAV, MP3 | ASR (Automatic Speech Recognition) |
|
|
234
|
+
|
|
235
|
+
### File Size Limits
|
|
236
|
+
|
|
237
|
+
- Maximum file size: 50MB
|
|
238
|
+
- Maximum files per conversation: 5 (configurable)
|
|
239
|
+
|
|
240
|
+
### File Processing
|
|
241
|
+
|
|
242
|
+
Files are processed through the following pipeline:
|
|
243
|
+
1. **Upload**: File uploaded via `/api/files/upload`
|
|
244
|
+
2. **Validation**: File type and size validation
|
|
245
|
+
3. **Storage**: File saved to filesystem (or S3 in production)
|
|
246
|
+
4. **Extraction**: Text and metadata extracted using format-specific processors
|
|
247
|
+
5. **Chunking**: Content chunked using configured strategy (fixed or semantic)
|
|
248
|
+
6. **Indexing**: Chunks indexed in vector store for semantic search
|
|
249
|
+
7. **Metadata**: Processing status tracked in SQLite
|
|
250
|
+
|
|
251
|
+
## Available Scripts
|
|
252
|
+
|
|
253
|
+
- `npm run dev` - Start dev server (uses npm package)
|
|
254
|
+
- `npm run dev:local` - Start dev server with local API enabled
|
|
255
|
+
- `npm run dev:with-api` - Build API and start dev server with local API
|
|
256
|
+
- `npm run build` - Build for production (uses npm package)
|
|
257
|
+
- `npm run build:local` - Build for production with local API
|
|
258
|
+
- `npm run build:api` - Build API and copy to public directory
|
|
259
|
+
- `npm run preview` - Preview production build
|
|
260
|
+
- `npm run preview:local` - Preview production build with local API
|
|
261
|
+
|
|
262
|
+
## Integration Details
|
|
263
|
+
|
|
264
|
+
The integration uses:
|
|
265
|
+
- **Zustand** for state management (replacing React Context)
|
|
266
|
+
- **@schmitech/chatbot-api** for streaming chat functionality and file operations
|
|
267
|
+
- **localStorage** for persistent session and conversation storage
|
|
268
|
+
- **TypeScript** for type safety throughout the integration
|
|
269
|
+
- **File Upload Service** for handling file uploads with progress tracking
|
|
270
|
+
- **Vector Store** for semantic search over uploaded file content
|
|
271
|
+
|
|
272
|
+
## Troubleshooting
|
|
273
|
+
|
|
274
|
+
### Local API Not Loading
|
|
275
|
+
|
|
276
|
+
If you see a 404 error for `api.mjs`:
|
|
277
|
+
|
|
278
|
+
1. **Ensure API is built**:
|
|
279
|
+
```bash
|
|
280
|
+
cd ../node-api
|
|
281
|
+
npm run build
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
2. **Copy files to src/api/local directory**:
|
|
285
|
+
```bash
|
|
286
|
+
mkdir -p ../chat-app/src/api/local
|
|
287
|
+
cp dist/api.mjs ../chat-app/src/api/local/api.mjs
|
|
288
|
+
cp dist/api.d.ts ../chat-app/src/api/local/api.d.ts
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
3. **Restart dev server with local API enabled**:
|
|
292
|
+
```bash
|
|
293
|
+
npm run dev:local
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
4. **Check environment variable**:
|
|
297
|
+
- Ensure `VITE_USE_LOCAL_API=true` is set (or use `npm run dev:local`)
|
|
298
|
+
- The default path `./local/api.mjs` should work if files are in `src/api/local/`
|
|
299
|
+
|
|
300
|
+
### File Upload Issues
|
|
301
|
+
|
|
302
|
+
- **File size exceeded**: Check file size (max 50MB)
|
|
303
|
+
- **Unsupported format**: Verify file type is in supported list
|
|
304
|
+
- **Upload fails**: Check server logs and API key configuration
|
|
305
|
+
- **Processing fails**: Ensure file processing service is initialized on server
|
|
306
|
+
|
|
307
|
+
### Debug Mode
|
|
308
|
+
|
|
309
|
+
Enable debug logging by setting:
|
|
310
|
+
```bash
|
|
311
|
+
VITE_CONSOLE_DEBUG=true
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
This will show detailed API loading and file upload information in the console.
|