@gram-ai/elements 1.16.2 → 1.16.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.typedoc.md +26 -0
- package/dist/elements.cjs +2 -2
- package/dist/elements.css +1 -1
- package/dist/elements.js +81 -79
- package/dist/index.d.ts +1 -1
- package/dist/types/index.d.ts +50 -27
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export type Variant = (typeof VARIANTS)[number];
|
|
|
20
20
|
*
|
|
21
21
|
* @example
|
|
22
22
|
* const config: ElementsConfig = {
|
|
23
|
+
* mcp: 'https://app.getgram.ai/mcp/your-mcp-slug',
|
|
24
|
+
* projectSlug: 'my-project',
|
|
23
25
|
* systemPrompt: 'You are a helpful assistant.',
|
|
24
26
|
* }
|
|
25
27
|
*/
|
|
@@ -117,7 +119,7 @@ export interface ElementsConfig {
|
|
|
117
119
|
* @example
|
|
118
120
|
* const config: ElementsConfig = {
|
|
119
121
|
* model: {
|
|
120
|
-
*
|
|
122
|
+
* defaultModel: 'openai/gpt-4o',
|
|
121
123
|
* showModelPicker: true,
|
|
122
124
|
* },
|
|
123
125
|
* }
|
|
@@ -151,7 +153,7 @@ export interface ElementsConfig {
|
|
|
151
153
|
* },
|
|
152
154
|
* }
|
|
153
155
|
*/
|
|
154
|
-
welcome
|
|
156
|
+
welcome?: WelcomeConfig;
|
|
155
157
|
/**
|
|
156
158
|
* The configuration for the composer.
|
|
157
159
|
*
|
|
@@ -172,12 +174,14 @@ export interface ElementsConfig {
|
|
|
172
174
|
* modal: {
|
|
173
175
|
* title: 'Chat',
|
|
174
176
|
* position: 'bottom-right',
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
177
|
+
* expandable: true,
|
|
178
|
+
* defaultExpanded: false,
|
|
179
|
+
* dimensions: {
|
|
180
|
+
* default: {
|
|
181
|
+
* width: 400,
|
|
182
|
+
* height: 600,
|
|
183
|
+
* },
|
|
184
|
+
* },
|
|
181
185
|
* },
|
|
182
186
|
* }
|
|
183
187
|
*/
|
|
@@ -190,12 +194,14 @@ export interface ElementsConfig {
|
|
|
190
194
|
* const config: ElementsConfig = {
|
|
191
195
|
* sidecar: {
|
|
192
196
|
* title: 'Chat',
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
197
|
+
* expandable: true,
|
|
198
|
+
* defaultExpanded: false,
|
|
199
|
+
* dimensions: {
|
|
200
|
+
* default: {
|
|
201
|
+
* width: 400,
|
|
202
|
+
* height: 600,
|
|
203
|
+
* },
|
|
204
|
+
* },
|
|
199
205
|
* },
|
|
200
206
|
* }
|
|
201
207
|
*/
|
|
@@ -207,15 +213,12 @@ export interface ElementsConfig {
|
|
|
207
213
|
* const config: ElementsConfig = {
|
|
208
214
|
* tools: {
|
|
209
215
|
* expandToolGroupsByDefault: true,
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* },
|
|
217
|
-
* components: {
|
|
218
|
-
* fetchUrl: FetchToolComponent,
|
|
216
|
+
* frontendTools: {
|
|
217
|
+
* fetchUrl: FetchTool,
|
|
218
|
+
* },
|
|
219
|
+
* components: {
|
|
220
|
+
* fetchUrl: FetchToolComponent,
|
|
221
|
+
* },
|
|
219
222
|
* },
|
|
220
223
|
* }
|
|
221
224
|
*/
|
|
@@ -397,8 +400,10 @@ export interface ToolsConfig {
|
|
|
397
400
|
* 'fetchUrl'
|
|
398
401
|
* )
|
|
399
402
|
* const config: ElementsConfig = {
|
|
400
|
-
*
|
|
401
|
-
*
|
|
403
|
+
* tools: {
|
|
404
|
+
* frontendTools: {
|
|
405
|
+
* fetchUrl: FetchTool,
|
|
406
|
+
* },
|
|
402
407
|
* },
|
|
403
408
|
* }
|
|
404
409
|
* ```
|
|
@@ -491,6 +496,22 @@ export interface ModalConfig extends ExpandableConfig {
|
|
|
491
496
|
/**
|
|
492
497
|
* The icon to use for the modal window.
|
|
493
498
|
* Receives the current state of the modal window.
|
|
499
|
+
*
|
|
500
|
+
* @example
|
|
501
|
+
* ```ts
|
|
502
|
+
* import { MessageCircleIcon } from 'lucide-react'
|
|
503
|
+
* import { cn } from '@/lib/utils'
|
|
504
|
+
*
|
|
505
|
+
* const config: ElementsConfig = {
|
|
506
|
+
* modal: {
|
|
507
|
+
* icon: (state) => {
|
|
508
|
+
* return <div className={cn('size-6', state === 'open' ? 'rotate-90' : 'rotate-0')}>
|
|
509
|
+
* <MessageCircleIcon className="size-6" />
|
|
510
|
+
* </div>
|
|
511
|
+
* },
|
|
512
|
+
* },
|
|
513
|
+
* }
|
|
514
|
+
* ```
|
|
494
515
|
*/
|
|
495
516
|
icon?: (state: 'open' | 'closed' | undefined) => ReactNode;
|
|
496
517
|
}
|
|
@@ -511,9 +532,8 @@ export interface ComposerConfig {
|
|
|
511
532
|
}
|
|
512
533
|
/**
|
|
513
534
|
* AttachmentsConfig provides fine-grained control over file attachments.
|
|
514
|
-
* Inspired by OpenAI ChatKit's attachment options.
|
|
515
535
|
*
|
|
516
|
-
* Note: not yet implemented
|
|
536
|
+
* Note: not yet implemented. Attachments are not supported yet.
|
|
517
537
|
*/
|
|
518
538
|
export interface AttachmentsConfig {
|
|
519
539
|
/**
|
|
@@ -539,6 +559,9 @@ export interface SidecarConfig extends ExpandableConfig {
|
|
|
539
559
|
*/
|
|
540
560
|
title?: string;
|
|
541
561
|
}
|
|
562
|
+
/**
|
|
563
|
+
* @internal
|
|
564
|
+
*/
|
|
542
565
|
export type ElementsContextType = {
|
|
543
566
|
config: ElementsConfig;
|
|
544
567
|
setModel: (model: Model) => void;
|
package/package.json
CHANGED