@kitnai/chat 0.6.0 → 0.7.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/dist/custom-elements.json +125 -73
- package/dist/kitn-chat.es.js +1 -1
- package/dist/llms/llms-full.txt +24 -24
- package/frameworks/react/index.tsx +46 -24
- package/llms-full.txt +24 -24
- package/package.json +1 -1
- package/src/elements/chat-workspace.tsx +28 -2
- package/src/elements/chat.tsx +22 -1
- package/src/elements/compiled.css +1 -1
- package/src/elements/conversation-list.tsx +10 -1
- package/src/elements/element-meta.json +2003 -0
- package/src/elements/kitn-attachments.stories.tsx +9 -0
- package/src/elements/kitn-chain-of-thought.stories.tsx +9 -0
- package/src/elements/kitn-chat-scope-picker.stories.tsx +9 -0
- package/src/elements/kitn-chat-workspace.stories.tsx +64 -14
- package/src/elements/kitn-chat.stories.tsx +58 -5
- package/src/elements/kitn-checkpoint.stories.tsx +9 -0
- package/src/elements/kitn-code-block.stories.tsx +9 -0
- package/src/elements/kitn-context-meter.stories.tsx +9 -0
- package/src/elements/kitn-conversation-list.stories.tsx +31 -10
- package/src/elements/kitn-empty.stories.tsx +9 -0
- package/src/elements/kitn-feedback-bar.stories.tsx +9 -0
- package/src/elements/kitn-file-upload.stories.tsx +9 -0
- package/src/elements/kitn-image.stories.tsx +9 -0
- package/src/elements/kitn-loader.stories.tsx +9 -0
- package/src/elements/kitn-markdown.stories.tsx +9 -0
- package/src/elements/kitn-message-skills.stories.tsx +9 -0
- package/src/elements/kitn-message.stories.tsx +9 -0
- package/src/elements/kitn-model-switcher.stories.tsx +9 -0
- package/src/elements/kitn-prompt-input.stories.tsx +35 -5
- package/src/elements/kitn-prompt-suggestions.stories.tsx +9 -0
- package/src/elements/kitn-reasoning.stories.tsx +9 -0
- package/src/elements/kitn-response-stream.stories.tsx +9 -0
- package/src/elements/kitn-source-list.stories.tsx +9 -0
- package/src/elements/kitn-source.stories.tsx +9 -0
- package/src/elements/kitn-text-shimmer.stories.tsx +9 -0
- package/src/elements/kitn-thinking-bar.stories.tsx +9 -0
- package/src/elements/kitn-tool.stories.tsx +9 -0
- package/src/elements/kitn-voice-input.stories.tsx +9 -0
- package/src/elements/prompt-input.tsx +2 -2
- package/src/stories/docs/element-controls.ts +28 -0
- package/src/stories/docs/element-spec.tsx +86 -0
package/dist/llms/llms-full.txt
CHANGED
|
@@ -240,14 +240,14 @@ _No events._
|
|
|
240
240
|
|
|
241
241
|
| Event | `detail` type | Description |
|
|
242
242
|
|---|---|---|
|
|
243
|
-
| `messageaction` | `CustomEvent<
|
|
244
|
-
| `modelchange` | `CustomEvent<
|
|
245
|
-
| `search` | `CustomEvent<
|
|
246
|
-
| `slashselect` | `CustomEvent<
|
|
247
|
-
| `submit` | `CustomEvent<
|
|
248
|
-
| `suggestionclick` | `CustomEvent<
|
|
249
|
-
| `valuechange` | `CustomEvent<
|
|
250
|
-
| `voice` | `CustomEvent<
|
|
243
|
+
| `messageaction` | `CustomEvent<{ messageId: string; action: "copy" \| "like" \| "dislike" \| "regenerate" \| "edit" }>` | An action button on a message was clicked. |
|
|
244
|
+
| `modelchange` | `CustomEvent<{ modelId: string }>` | The header model switcher changed. |
|
|
245
|
+
| `search` | `CustomEvent<Record<string, never>>` | The Search button was clicked. |
|
|
246
|
+
| `slashselect` | `CustomEvent<{ command: { id: string; label: string; description?: undefined \| string; category?: undefined \| string } }>` | A slash command was chosen from the palette. |
|
|
247
|
+
| `submit` | `CustomEvent<{ value: string; attachments: { id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[] }>` | User submitted a message. |
|
|
248
|
+
| `suggestionclick` | `CustomEvent<{ value: string }>` | A suggestion chip was clicked (only in `suggestion-mode="fill"`). |
|
|
249
|
+
| `valuechange` | `CustomEvent<{ value: string }>` | Fired on every input change. |
|
|
250
|
+
| `voice` | `CustomEvent<Record<string, never>>` | The Mic / voice button was clicked. |
|
|
251
251
|
|
|
252
252
|
---
|
|
253
253
|
|
|
@@ -306,17 +306,17 @@ _No events._
|
|
|
306
306
|
|
|
307
307
|
| Event | `detail` type | Description |
|
|
308
308
|
|---|---|---|
|
|
309
|
-
| `conversationselect` | `CustomEvent<
|
|
310
|
-
| `messageaction` | `CustomEvent<
|
|
311
|
-
| `modelchange` | `CustomEvent<
|
|
312
|
-
| `newchat` | `CustomEvent<
|
|
313
|
-
| `search` | `CustomEvent<
|
|
314
|
-
| `sidebartoggle` | `CustomEvent<
|
|
315
|
-
| `slashselect` | `CustomEvent<
|
|
316
|
-
| `submit` | `CustomEvent<
|
|
317
|
-
| `suggestionclick` | `CustomEvent<
|
|
318
|
-
| `valuechange` | `CustomEvent<
|
|
319
|
-
| `voice` | `CustomEvent<
|
|
309
|
+
| `conversationselect` | `CustomEvent<{ id: string }>` | A conversation was selected in the sidebar. |
|
|
310
|
+
| `messageaction` | `CustomEvent<{ messageId: string; action: "copy" \| "like" \| "dislike" \| "regenerate" \| "edit" }>` | An action button on a message was clicked. |
|
|
311
|
+
| `modelchange` | `CustomEvent<{ modelId: string }>` | The header model switcher changed. |
|
|
312
|
+
| `newchat` | `CustomEvent<Record<string, never>>` | The "New chat" button was clicked. |
|
|
313
|
+
| `search` | `CustomEvent<Record<string, never>>` | The Search button was clicked. |
|
|
314
|
+
| `sidebartoggle` | `CustomEvent<{ collapsed: false \| true }>` | The sidebar was collapsed or expanded. |
|
|
315
|
+
| `slashselect` | `CustomEvent<{ command: { id: string; label: string; description?: undefined \| string; category?: undefined \| string } }>` | A slash command was chosen from the palette. |
|
|
316
|
+
| `submit` | `CustomEvent<{ value: string; attachments: { id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[] }>` | User submitted a message. |
|
|
317
|
+
| `suggestionclick` | `CustomEvent<{ value: string }>` | A suggestion chip was clicked (only in `suggestion-mode="fill"`). |
|
|
318
|
+
| `valuechange` | `CustomEvent<{ value: string }>` | Fired on every input change. |
|
|
319
|
+
| `voice` | `CustomEvent<Record<string, never>>` | The Mic / voice button was clicked. |
|
|
320
320
|
|
|
321
321
|
---
|
|
322
322
|
|
|
@@ -381,9 +381,9 @@ _No events._
|
|
|
381
381
|
|
|
382
382
|
| Event | `detail` type | Description |
|
|
383
383
|
|---|---|---|
|
|
384
|
-
| `newchat` | `CustomEvent<
|
|
385
|
-
| `select` | `CustomEvent<
|
|
386
|
-
| `togglesidebar` | `CustomEvent<
|
|
384
|
+
| `newchat` | `CustomEvent<Record<string, never>>` | The "New chat" button was clicked. |
|
|
385
|
+
| `select` | `CustomEvent<{ id: string }>` | A conversation was selected. |
|
|
386
|
+
| `togglesidebar` | `CustomEvent<Record<string, never>>` | The sidebar toggle was clicked. |
|
|
387
387
|
|
|
388
388
|
---
|
|
389
389
|
|
|
@@ -555,12 +555,12 @@ _No events._
|
|
|
555
555
|
|
|
556
556
|
| Event | `detail` type | Description |
|
|
557
557
|
|---|---|---|
|
|
558
|
-
| `search` | `CustomEvent<
|
|
558
|
+
| `search` | `CustomEvent<Record<string, never>>` | The Search (Globe) toolbar button was clicked. |
|
|
559
559
|
| `slashselect` | `CustomEvent<{ command: { id: string; label: string; description?: undefined \| string; category?: undefined \| string } }>` | A slash command was chosen from the palette. |
|
|
560
560
|
| `submit` | `CustomEvent<{ value: string; attachments: { id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[] }>` | The user submitted the prompt (Enter or send button) with its attachments. |
|
|
561
561
|
| `suggestionclick` | `CustomEvent<{ value: string }>` | A suggestion was clicked while `suggestion-mode="fill"`. |
|
|
562
562
|
| `valuechange` | `CustomEvent<{ value: string }>` | The input text changed (fires on every keystroke). |
|
|
563
|
-
| `voice` | `CustomEvent<
|
|
563
|
+
| `voice` | `CustomEvent<Record<string, never>>` | The Voice (Mic) toolbar button was clicked. |
|
|
564
564
|
|
|
565
565
|
---
|
|
566
566
|
|
|
@@ -78,14 +78,22 @@ export interface KitnChatProps extends KitnBaseProps {
|
|
|
78
78
|
slashActiveIds?: string[];
|
|
79
79
|
/** Single-line palette rows. */
|
|
80
80
|
slashCompact?: boolean;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
/** An action button on a message was clicked. */
|
|
82
|
+
onMessageaction?: (event: CustomEvent<{ messageId: string; action: "copy" | "like" | "dislike" | "regenerate" | "edit" }>) => void;
|
|
83
|
+
/** The header model switcher changed. */
|
|
84
|
+
onModelchange?: (event: CustomEvent<{ modelId: string }>) => void;
|
|
85
|
+
/** The Search button was clicked. */
|
|
86
|
+
onSearch?: (event: CustomEvent<Record<string, never>>) => void;
|
|
87
|
+
/** A slash command was chosen from the palette. */
|
|
88
|
+
onSlashselect?: (event: CustomEvent<{ command: { id: string; label: string; description?: undefined | string; category?: undefined | string } }>) => void;
|
|
89
|
+
/** User submitted a message. */
|
|
90
|
+
onSubmit?: (event: CustomEvent<{ value: string; attachments: { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }[] }>) => void;
|
|
91
|
+
/** A suggestion chip was clicked (only in `suggestion-mode="fill"`). */
|
|
92
|
+
onSuggestionclick?: (event: CustomEvent<{ value: string }>) => void;
|
|
93
|
+
/** Fired on every input change. */
|
|
94
|
+
onValuechange?: (event: CustomEvent<{ value: string }>) => void;
|
|
95
|
+
/** The Mic / voice button was clicked. */
|
|
96
|
+
onVoice?: (event: CustomEvent<Record<string, never>>) => void;
|
|
89
97
|
}
|
|
90
98
|
|
|
91
99
|
export const KitnChat = createKitnComponent<KitnChatProps>(
|
|
@@ -146,17 +154,28 @@ export interface KitnChatWorkspaceProps extends KitnBaseProps {
|
|
|
146
154
|
sidebarMaxWidth?: number;
|
|
147
155
|
/** Initial collapsed state of the sidebar (default false). */
|
|
148
156
|
sidebarCollapsed?: boolean;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
/** A conversation was selected in the sidebar. */
|
|
158
|
+
onConversationselect?: (event: CustomEvent<{ id: string }>) => void;
|
|
159
|
+
/** An action button on a message was clicked. */
|
|
160
|
+
onMessageaction?: (event: CustomEvent<{ messageId: string; action: "copy" | "like" | "dislike" | "regenerate" | "edit" }>) => void;
|
|
161
|
+
/** The header model switcher changed. */
|
|
162
|
+
onModelchange?: (event: CustomEvent<{ modelId: string }>) => void;
|
|
163
|
+
/** The "New chat" button was clicked. */
|
|
164
|
+
onNewchat?: (event: CustomEvent<Record<string, never>>) => void;
|
|
165
|
+
/** The Search button was clicked. */
|
|
166
|
+
onSearch?: (event: CustomEvent<Record<string, never>>) => void;
|
|
167
|
+
/** The sidebar was collapsed or expanded. */
|
|
168
|
+
onSidebartoggle?: (event: CustomEvent<{ collapsed: boolean }>) => void;
|
|
169
|
+
/** A slash command was chosen from the palette. */
|
|
170
|
+
onSlashselect?: (event: CustomEvent<{ command: { id: string; label: string; description?: undefined | string; category?: undefined | string } }>) => void;
|
|
171
|
+
/** User submitted a message. */
|
|
172
|
+
onSubmit?: (event: CustomEvent<{ value: string; attachments: { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }[] }>) => void;
|
|
173
|
+
/** A suggestion chip was clicked (only in `suggestion-mode="fill"`). */
|
|
174
|
+
onSuggestionclick?: (event: CustomEvent<{ value: string }>) => void;
|
|
175
|
+
/** Fired on every input change. */
|
|
176
|
+
onValuechange?: (event: CustomEvent<{ value: string }>) => void;
|
|
177
|
+
/** The Mic / voice button was clicked. */
|
|
178
|
+
onVoice?: (event: CustomEvent<Record<string, never>>) => void;
|
|
160
179
|
}
|
|
161
180
|
|
|
162
181
|
export const KitnChatWorkspace = createKitnComponent<KitnChatWorkspaceProps>(
|
|
@@ -221,9 +240,12 @@ export interface KitnConversationListProps extends KitnBaseProps {
|
|
|
221
240
|
conversations: { id: string; title: string; groupId?: undefined | string; scope: { type: "document" | "collection"; documentId?: undefined | string; filters?: undefined | { tags?: undefined | string[]; authors?: undefined | string[]; contentType?: undefined | "transcript" | "markdown"; dateRange?: undefined | { from: string; to: string } } }; messageCount: number; lastMessageAt: string; updatedAt: string }[];
|
|
222
241
|
/** The id of the currently-open conversation, highlighted in the list. */
|
|
223
242
|
activeId?: string;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
243
|
+
/** The "New chat" button was clicked. */
|
|
244
|
+
onNewchat?: (event: CustomEvent<Record<string, never>>) => void;
|
|
245
|
+
/** A conversation was selected. */
|
|
246
|
+
onSelect?: (event: CustomEvent<{ id: string }>) => void;
|
|
247
|
+
/** The sidebar toggle was clicked. */
|
|
248
|
+
onTogglesidebar?: (event: CustomEvent<Record<string, never>>) => void;
|
|
227
249
|
}
|
|
228
250
|
|
|
229
251
|
export const KitnConversationList = createKitnComponent<KitnConversationListProps>(
|
|
@@ -407,7 +429,7 @@ export interface KitnPromptInputProps extends KitnBaseProps {
|
|
|
407
429
|
/** Attachments to seed the input with (so a consumer can pre-populate staged files without an upload). Set as a JS property; the element then manages its own attachment state from there (add via the paperclip, remove per chip). */
|
|
408
430
|
attachments?: { id: string; type: "file" | "source-document"; filename?: string; mediaType?: string; url?: string; title?: string }[];
|
|
409
431
|
/** The Search (Globe) toolbar button was clicked. */
|
|
410
|
-
onSearch?: (event: CustomEvent<
|
|
432
|
+
onSearch?: (event: CustomEvent<Record<string, never>>) => void;
|
|
411
433
|
/** A slash command was chosen from the palette. */
|
|
412
434
|
onSlashselect?: (event: CustomEvent<{ command: { id: string; label: string; description?: undefined | string; category?: undefined | string } }>) => void;
|
|
413
435
|
/** The user submitted the prompt (Enter or send button) with its attachments. */
|
|
@@ -417,7 +439,7 @@ export interface KitnPromptInputProps extends KitnBaseProps {
|
|
|
417
439
|
/** The input text changed (fires on every keystroke). */
|
|
418
440
|
onValuechange?: (event: CustomEvent<{ value: string }>) => void;
|
|
419
441
|
/** The Voice (Mic) toolbar button was clicked. */
|
|
420
|
-
onVoice?: (event: CustomEvent<
|
|
442
|
+
onVoice?: (event: CustomEvent<Record<string, never>>) => void;
|
|
421
443
|
}
|
|
422
444
|
|
|
423
445
|
export const KitnPromptInput = createKitnComponent<KitnPromptInputProps>(
|
package/llms-full.txt
CHANGED
|
@@ -240,14 +240,14 @@ _No events._
|
|
|
240
240
|
|
|
241
241
|
| Event | `detail` type | Description |
|
|
242
242
|
|---|---|---|
|
|
243
|
-
| `messageaction` | `CustomEvent<
|
|
244
|
-
| `modelchange` | `CustomEvent<
|
|
245
|
-
| `search` | `CustomEvent<
|
|
246
|
-
| `slashselect` | `CustomEvent<
|
|
247
|
-
| `submit` | `CustomEvent<
|
|
248
|
-
| `suggestionclick` | `CustomEvent<
|
|
249
|
-
| `valuechange` | `CustomEvent<
|
|
250
|
-
| `voice` | `CustomEvent<
|
|
243
|
+
| `messageaction` | `CustomEvent<{ messageId: string; action: "copy" \| "like" \| "dislike" \| "regenerate" \| "edit" }>` | An action button on a message was clicked. |
|
|
244
|
+
| `modelchange` | `CustomEvent<{ modelId: string }>` | The header model switcher changed. |
|
|
245
|
+
| `search` | `CustomEvent<Record<string, never>>` | The Search button was clicked. |
|
|
246
|
+
| `slashselect` | `CustomEvent<{ command: { id: string; label: string; description?: undefined \| string; category?: undefined \| string } }>` | A slash command was chosen from the palette. |
|
|
247
|
+
| `submit` | `CustomEvent<{ value: string; attachments: { id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[] }>` | User submitted a message. |
|
|
248
|
+
| `suggestionclick` | `CustomEvent<{ value: string }>` | A suggestion chip was clicked (only in `suggestion-mode="fill"`). |
|
|
249
|
+
| `valuechange` | `CustomEvent<{ value: string }>` | Fired on every input change. |
|
|
250
|
+
| `voice` | `CustomEvent<Record<string, never>>` | The Mic / voice button was clicked. |
|
|
251
251
|
|
|
252
252
|
---
|
|
253
253
|
|
|
@@ -306,17 +306,17 @@ _No events._
|
|
|
306
306
|
|
|
307
307
|
| Event | `detail` type | Description |
|
|
308
308
|
|---|---|---|
|
|
309
|
-
| `conversationselect` | `CustomEvent<
|
|
310
|
-
| `messageaction` | `CustomEvent<
|
|
311
|
-
| `modelchange` | `CustomEvent<
|
|
312
|
-
| `newchat` | `CustomEvent<
|
|
313
|
-
| `search` | `CustomEvent<
|
|
314
|
-
| `sidebartoggle` | `CustomEvent<
|
|
315
|
-
| `slashselect` | `CustomEvent<
|
|
316
|
-
| `submit` | `CustomEvent<
|
|
317
|
-
| `suggestionclick` | `CustomEvent<
|
|
318
|
-
| `valuechange` | `CustomEvent<
|
|
319
|
-
| `voice` | `CustomEvent<
|
|
309
|
+
| `conversationselect` | `CustomEvent<{ id: string }>` | A conversation was selected in the sidebar. |
|
|
310
|
+
| `messageaction` | `CustomEvent<{ messageId: string; action: "copy" \| "like" \| "dislike" \| "regenerate" \| "edit" }>` | An action button on a message was clicked. |
|
|
311
|
+
| `modelchange` | `CustomEvent<{ modelId: string }>` | The header model switcher changed. |
|
|
312
|
+
| `newchat` | `CustomEvent<Record<string, never>>` | The "New chat" button was clicked. |
|
|
313
|
+
| `search` | `CustomEvent<Record<string, never>>` | The Search button was clicked. |
|
|
314
|
+
| `sidebartoggle` | `CustomEvent<{ collapsed: false \| true }>` | The sidebar was collapsed or expanded. |
|
|
315
|
+
| `slashselect` | `CustomEvent<{ command: { id: string; label: string; description?: undefined \| string; category?: undefined \| string } }>` | A slash command was chosen from the palette. |
|
|
316
|
+
| `submit` | `CustomEvent<{ value: string; attachments: { id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[] }>` | User submitted a message. |
|
|
317
|
+
| `suggestionclick` | `CustomEvent<{ value: string }>` | A suggestion chip was clicked (only in `suggestion-mode="fill"`). |
|
|
318
|
+
| `valuechange` | `CustomEvent<{ value: string }>` | Fired on every input change. |
|
|
319
|
+
| `voice` | `CustomEvent<Record<string, never>>` | The Mic / voice button was clicked. |
|
|
320
320
|
|
|
321
321
|
---
|
|
322
322
|
|
|
@@ -381,9 +381,9 @@ _No events._
|
|
|
381
381
|
|
|
382
382
|
| Event | `detail` type | Description |
|
|
383
383
|
|---|---|---|
|
|
384
|
-
| `newchat` | `CustomEvent<
|
|
385
|
-
| `select` | `CustomEvent<
|
|
386
|
-
| `togglesidebar` | `CustomEvent<
|
|
384
|
+
| `newchat` | `CustomEvent<Record<string, never>>` | The "New chat" button was clicked. |
|
|
385
|
+
| `select` | `CustomEvent<{ id: string }>` | A conversation was selected. |
|
|
386
|
+
| `togglesidebar` | `CustomEvent<Record<string, never>>` | The sidebar toggle was clicked. |
|
|
387
387
|
|
|
388
388
|
---
|
|
389
389
|
|
|
@@ -555,12 +555,12 @@ _No events._
|
|
|
555
555
|
|
|
556
556
|
| Event | `detail` type | Description |
|
|
557
557
|
|---|---|---|
|
|
558
|
-
| `search` | `CustomEvent<
|
|
558
|
+
| `search` | `CustomEvent<Record<string, never>>` | The Search (Globe) toolbar button was clicked. |
|
|
559
559
|
| `slashselect` | `CustomEvent<{ command: { id: string; label: string; description?: undefined \| string; category?: undefined \| string } }>` | A slash command was chosen from the palette. |
|
|
560
560
|
| `submit` | `CustomEvent<{ value: string; attachments: { id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[] }>` | The user submitted the prompt (Enter or send button) with its attachments. |
|
|
561
561
|
| `suggestionclick` | `CustomEvent<{ value: string }>` | A suggestion was clicked while `suggestion-mode="fill"`. |
|
|
562
562
|
| `valuechange` | `CustomEvent<{ value: string }>` | The input text changed (fires on every keystroke). |
|
|
563
|
-
| `voice` | `CustomEvent<
|
|
563
|
+
| `voice` | `CustomEvent<Record<string, never>>` | The Voice (Mic) toolbar button was clicked. |
|
|
564
564
|
|
|
565
565
|
---
|
|
566
566
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitnai/chat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML. Authored in SolidJS.",
|
|
6
6
|
"keywords": [
|
|
@@ -5,8 +5,9 @@ import { ConversationList } from '../components/conversation-list';
|
|
|
5
5
|
import { ResizablePanelGroup, ResizablePanel, ResizableHandle } from '../ui/resizable';
|
|
6
6
|
import { Button } from '../ui/button';
|
|
7
7
|
import { PanelLeftOpen } from 'lucide-solid';
|
|
8
|
+
import type { AttachmentData } from '../components/attachments';
|
|
8
9
|
import type { SlashCommandItem } from '../components/slash-command';
|
|
9
|
-
import type { ChatMessage } from './chat-types';
|
|
10
|
+
import type { ChatMessage, ChatMessageAction } from './chat-types';
|
|
10
11
|
import type { ProseSize } from '../primitives/chat-config';
|
|
11
12
|
import type { ModelOption, ConversationGroup, ConversationSummary } from '../types';
|
|
12
13
|
|
|
@@ -47,7 +48,32 @@ interface Props extends Record<string, unknown> {
|
|
|
47
48
|
sidebarCollapsed?: boolean;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
interface Events {
|
|
52
|
+
/** A conversation was selected in the sidebar. */
|
|
53
|
+
conversationselect: { id: string };
|
|
54
|
+
/** The "New chat" button was clicked. */
|
|
55
|
+
newchat: Record<string, never>;
|
|
56
|
+
/** The sidebar was collapsed or expanded. */
|
|
57
|
+
sidebartoggle: { collapsed: boolean };
|
|
58
|
+
/** User submitted a message. */
|
|
59
|
+
submit: { value: string; attachments: AttachmentData[] };
|
|
60
|
+
/** Fired on every input change. */
|
|
61
|
+
valuechange: { value: string };
|
|
62
|
+
/** The header model switcher changed. */
|
|
63
|
+
modelchange: { modelId: string };
|
|
64
|
+
/** An action button on a message was clicked. */
|
|
65
|
+
messageaction: { messageId: string; action: ChatMessageAction };
|
|
66
|
+
/** The Search button was clicked. */
|
|
67
|
+
search: Record<string, never>;
|
|
68
|
+
/** The Mic / voice button was clicked. */
|
|
69
|
+
voice: Record<string, never>;
|
|
70
|
+
/** A slash command was chosen from the palette. */
|
|
71
|
+
slashselect: { command: SlashCommandItem };
|
|
72
|
+
/** A suggestion chip was clicked (only in `suggestion-mode="fill"`). */
|
|
73
|
+
suggestionclick: { value: string };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
defineKitnElement<Props, Events>('kitn-chat-workspace', {
|
|
51
77
|
groups: [], conversations: [], activeId: undefined, messages: [],
|
|
52
78
|
value: undefined, placeholder: 'Send a message...', loading: false,
|
|
53
79
|
suggestions: undefined, suggestionMode: 'submit', proseSize: 'sm',
|
package/src/elements/chat.tsx
CHANGED
|
@@ -1,14 +1,35 @@
|
|
|
1
1
|
import { defineKitnElement } from './define';
|
|
2
2
|
import { ChatThread, type ChatThreadProps, type ChatThreadContextUsage } from '../components/chat-thread';
|
|
3
|
+
import type { AttachmentData } from '../components/attachments';
|
|
3
4
|
import type { SlashCommandItem } from '../components/slash-command';
|
|
4
5
|
import type { ProseSize } from '../primitives/chat-config';
|
|
6
|
+
import type { ChatMessageAction } from './chat-types';
|
|
5
7
|
import type { ModelOption } from '../types';
|
|
6
8
|
|
|
7
9
|
type Props = Omit<ChatThreadProps,
|
|
8
10
|
'class' | 'onValueChange' | 'onSubmit' | 'onSuggestionClick' | 'onModelChange'
|
|
9
11
|
| 'onMessageAction' | 'onSearch' | 'onVoice' | 'onSlashSelect'> & Record<string, unknown>;
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
interface Events {
|
|
14
|
+
/** User submitted a message. */
|
|
15
|
+
submit: { value: string; attachments: AttachmentData[] };
|
|
16
|
+
/** Fired on every input change. */
|
|
17
|
+
valuechange: { value: string };
|
|
18
|
+
/** A suggestion chip was clicked (only in `suggestion-mode="fill"`). */
|
|
19
|
+
suggestionclick: { value: string };
|
|
20
|
+
/** An action button on a message was clicked. */
|
|
21
|
+
messageaction: { messageId: string; action: ChatMessageAction };
|
|
22
|
+
/** The header model switcher changed. */
|
|
23
|
+
modelchange: { modelId: string };
|
|
24
|
+
/** A slash command was chosen from the palette. */
|
|
25
|
+
slashselect: { command: SlashCommandItem };
|
|
26
|
+
/** The Search button was clicked. */
|
|
27
|
+
search: Record<string, never>;
|
|
28
|
+
/** The Mic / voice button was clicked. */
|
|
29
|
+
voice: Record<string, never>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
defineKitnElement<Props, Events>('kitn-chat', {
|
|
12
33
|
messages: [], value: undefined, placeholder: 'Send a message...', loading: false,
|
|
13
34
|
suggestions: undefined, suggestionMode: 'submit', proseSize: 'sm',
|
|
14
35
|
codeTheme: 'github-dark-dimmed', codeHighlight: true, chatTitle: undefined,
|