@gentiq/ui 0.0.0-stage → 1.0.0-alpha.10
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/LICENSE +201 -0
- package/README.md +10 -2
- package/dist/FeedbackSettings-oq019el1.js +199 -0
- package/dist/MessageEditor-thFldVmz.js +25 -0
- package/dist/VoiceInput-sKSP-X3z.js +99 -0
- package/dist/assets/lato-400-latin-BEhtfm5r.woff2 +0 -0
- package/dist/assets/lato-700-latin-BUGMgin4.woff2 +0 -0
- package/dist/assets/vazirmatn-arabic-Cafbb7Zc.woff2 +0 -0
- package/dist/index.d.ts +1280 -0
- package/dist/index.es.js +49 -0
- package/dist/internal.d.ts +601 -0
- package/dist/internal.es.js +119 -0
- package/dist/loaders.css +412 -0
- package/dist/shared-BKh4GbRI.js +20 -0
- package/dist/shared-BtZa4J_w.js +632 -0
- package/dist/shared-DO5kF-Zj.js +5136 -0
- package/dist/style.css +1 -0
- package/package.json +119 -3
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { A as s, C as t, b as o, c as i, d as n, e as r, g as u, h as g, D as c, F as p, i as h, G as S, j as C, k as P, l, M as m, m as d, n as T, o as q, p as Q, P as A, Q as G, q as M, R, r as U, s as f, t as x, S as B, u as I, v as b, w as v, x as w, T as D, y, U as F, z as L, W, B as j, E as k, H as E, I as z } from "./shared-DO5kF-Zj.js";
|
|
3
|
+
import { T as O, j as V, i as J } from "./shared-BtZa4J_w.js";
|
|
4
|
+
export {
|
|
5
|
+
s as AppSidebar,
|
|
6
|
+
t as Chat,
|
|
7
|
+
o as ChatError,
|
|
8
|
+
i as ChatLayout,
|
|
9
|
+
n as ChoiceQuestionDock,
|
|
10
|
+
r as ChoiceQuestionPart,
|
|
11
|
+
u as ChoiceQuestionProvider,
|
|
12
|
+
g as CreditsBar,
|
|
13
|
+
c as DocumentSync,
|
|
14
|
+
p as FilePart,
|
|
15
|
+
h as FollowUpSuggestions,
|
|
16
|
+
S as GentiqChatApp,
|
|
17
|
+
C as GentiqProvider,
|
|
18
|
+
P as GentiqRoot,
|
|
19
|
+
l as GentiqUI,
|
|
20
|
+
m as MaintenanceBanner,
|
|
21
|
+
d as MaintenanceScreen,
|
|
22
|
+
T as MessageActions,
|
|
23
|
+
q as MessageList,
|
|
24
|
+
Q as PromptInputArea,
|
|
25
|
+
A as PromptInputButton,
|
|
26
|
+
G as QuotaBar,
|
|
27
|
+
M as QuotaWindows,
|
|
28
|
+
R as ReasoningPart,
|
|
29
|
+
U as ReferencePart,
|
|
30
|
+
f as Referenceable,
|
|
31
|
+
x as RequireAuth,
|
|
32
|
+
B as SettingsDialog,
|
|
33
|
+
I as SharedChatView,
|
|
34
|
+
b as SidebarProvider,
|
|
35
|
+
v as Suggestion,
|
|
36
|
+
w as Suggestions,
|
|
37
|
+
D as TextPart,
|
|
38
|
+
y as ToolPart,
|
|
39
|
+
O as Tooltip,
|
|
40
|
+
V as TooltipContent,
|
|
41
|
+
J as TooltipTrigger,
|
|
42
|
+
F as UsageMeter,
|
|
43
|
+
L as UserLoginPage,
|
|
44
|
+
W as WelcomeScreen,
|
|
45
|
+
j as useChoiceQuestion,
|
|
46
|
+
k as useGentiqUIOptions,
|
|
47
|
+
E as useSmoothStreamingConfig,
|
|
48
|
+
z as useSmoothText
|
|
49
|
+
};
|
|
@@ -0,0 +1,601 @@
|
|
|
1
|
+
import { AskUserPart } from '@gentiq/core';
|
|
2
|
+
import { ChatStatus } from '@gentiq/react';
|
|
3
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
4
|
+
import { ClassProp } from 'class-variance-authority/types';
|
|
5
|
+
import { ClassValue } from 'clsx';
|
|
6
|
+
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
7
|
+
import { ComponentProps } from 'react';
|
|
8
|
+
import { ComponentType } from 'react';
|
|
9
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
10
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
11
|
+
import { FC } from 'react';
|
|
12
|
+
import { GentiqUIMessage } from '@gentiq/core';
|
|
13
|
+
import { HTMLAttributes } from 'react';
|
|
14
|
+
import { JSX } from 'react/jsx-runtime';
|
|
15
|
+
import { MaintenanceStatus } from '@gentiq/core';
|
|
16
|
+
import { MessagePartComponents } from '@gentiq/react';
|
|
17
|
+
import { PlanDuration } from '@gentiq/core';
|
|
18
|
+
import { QuotaAnchor } from '@gentiq/core';
|
|
19
|
+
import { QuotaPeriod } from '@gentiq/core';
|
|
20
|
+
import * as React_2 from 'react';
|
|
21
|
+
import { ReferenceAdapter } from '@gentiq/core';
|
|
22
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
23
|
+
import { SendMessageInput } from '@gentiq/react';
|
|
24
|
+
import { Streamdown } from 'streamdown';
|
|
25
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
26
|
+
import { TFunction } from 'i18next';
|
|
27
|
+
import { VariantProps } from 'class-variance-authority';
|
|
28
|
+
|
|
29
|
+
export declare function Badge({ className, variant, asChild, ...props }: React_2.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & {
|
|
30
|
+
asChild?: boolean;
|
|
31
|
+
}): JSX.Element;
|
|
32
|
+
|
|
33
|
+
declare const badgeVariants: (props?: ({
|
|
34
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
|
|
35
|
+
} & ClassProp) | undefined) => string;
|
|
36
|
+
|
|
37
|
+
/** Meters gentiq counts itself. Anything else is app-defined and shown by its key. */
|
|
38
|
+
export declare const BUILT_IN_METERS: readonly ["messages", "tokens", "model_requests", "cost"];
|
|
39
|
+
|
|
40
|
+
export declare function Button({ className, variant, size, asChild, ...props }: React_2.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
41
|
+
asChild?: boolean;
|
|
42
|
+
}): JSX.Element;
|
|
43
|
+
|
|
44
|
+
declare const buttonVariants: (props?: ({
|
|
45
|
+
variant?: "default" | "destructive" | "link" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
46
|
+
size?: "default" | "icon" | "sm" | "lg" | null | undefined;
|
|
47
|
+
} & ClassProp) | undefined) => string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Props for the ChatError component, the notice under the transcript when a turn fails. Dismiss
|
|
51
|
+
* it with `useThread().clearError`.
|
|
52
|
+
*/
|
|
53
|
+
declare interface ChatErrorProps {
|
|
54
|
+
/**
|
|
55
|
+
* The failure, its message already localized. A refusal from the server is a `GentiqError`
|
|
56
|
+
* (check with `isGentiqError`) carrying the backend's `status` and `details` — for
|
|
57
|
+
* `quota_exceeded`, `{ meter, limit, used, window, resets_at, plan, subscription_ends_at }`.
|
|
58
|
+
*/
|
|
59
|
+
error: Error;
|
|
60
|
+
/** The error code when the server sent one (a `GentiqErrorCode`), else `undefined`. */
|
|
61
|
+
code?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export declare function Checkbox({ className, ...props }: React_2.ComponentProps<typeof CheckboxPrimitive.Root>): JSX.Element;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Structured assistant question that can be answered with one tap.
|
|
68
|
+
*/
|
|
69
|
+
declare interface ChoiceQuestion {
|
|
70
|
+
/** The question shown above the options. */
|
|
71
|
+
question: string;
|
|
72
|
+
/** Choices the user can select. */
|
|
73
|
+
choices: ChoiceQuestionChoice[];
|
|
74
|
+
/** Whether the default renderer should show a custom answer field. Defaults to true. */
|
|
75
|
+
allowCustom?: boolean;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* One selectable option shown in a Gentiq choice question.
|
|
80
|
+
*/
|
|
81
|
+
declare interface ChoiceQuestionChoice {
|
|
82
|
+
/** Human-readable option shown to the user and sent when selected. */
|
|
83
|
+
label: string;
|
|
84
|
+
/** Optional app-specific value for custom renderers. */
|
|
85
|
+
value?: unknown;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Props for the choice question docked on top of the composer.
|
|
90
|
+
*/
|
|
91
|
+
declare interface ChoiceQuestionDockProps {
|
|
92
|
+
/** The pending question. */
|
|
93
|
+
question: ChoiceQuestion;
|
|
94
|
+
/** Whether the choices can be picked yet (false while the turn streams). */
|
|
95
|
+
disabled?: boolean;
|
|
96
|
+
/** Close the dock without answering. The question is not discarded — it
|
|
97
|
+
* returns to the transcript, where it can be reopened. */
|
|
98
|
+
onDismiss?: () => void;
|
|
99
|
+
/** Submit the picked choice as a normal user message. */
|
|
100
|
+
onAnswer?: (answer: string) => void | Promise<void>;
|
|
101
|
+
/** Custom CSS class names. */
|
|
102
|
+
className?: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
declare interface ChoiceQuestionPartProps {
|
|
106
|
+
/** The `ask_user` tool call the question comes from. */
|
|
107
|
+
part: AskUserPart;
|
|
108
|
+
/** Parent message. */
|
|
109
|
+
message: GentiqUIMessage;
|
|
110
|
+
/** Whether the controls should accept an answer. */
|
|
111
|
+
disabled?: boolean;
|
|
112
|
+
/** Whether the user closed this question on the composer. It renders as a
|
|
113
|
+
* reopenable stub instead of a picker. */
|
|
114
|
+
dismissed?: boolean;
|
|
115
|
+
/** Put the question back on the composer. Absent when it can no longer be
|
|
116
|
+
* answered, which is what makes the stub inert on old messages. */
|
|
117
|
+
onReopen?: () => void;
|
|
118
|
+
/** Answer the question with a picked or typed answer. */
|
|
119
|
+
onAnswer?: (answer: string) => void | Promise<void>;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
123
|
+
|
|
124
|
+
export declare function Collapsible({ ...props }: React_2.ComponentProps<typeof CollapsiblePrimitive.Root>): JSX.Element;
|
|
125
|
+
|
|
126
|
+
export declare function CollapsibleContent({ ...props }: React_2.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>): JSX.Element;
|
|
127
|
+
|
|
128
|
+
export declare function CollapsibleTrigger({ ...props }: React_2.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>): JSX.Element;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Props for the ComposerFooter slot, rendered directly beneath the composer — e.g. prompt
|
|
132
|
+
* suggestions on the new-chat screen, mode toggles or quick actions.
|
|
133
|
+
*/
|
|
134
|
+
declare interface ComposerFooterProps {
|
|
135
|
+
/**
|
|
136
|
+
* Whether this is the new-chat screen, where the composer sits centered under the welcome
|
|
137
|
+
* header. Return `null` when it is `false` to show something only before the first message.
|
|
138
|
+
*/
|
|
139
|
+
newChat: boolean;
|
|
140
|
+
/** The thread's id, or `null` for a new thread. */
|
|
141
|
+
threadId?: string | null;
|
|
142
|
+
/** Current chat status. */
|
|
143
|
+
status: ChatStatus;
|
|
144
|
+
/** Whether a message can't be sent right now: a reply is in flight, or maintenance is on. */
|
|
145
|
+
disabled: boolean;
|
|
146
|
+
/** What the user has typed into the composer so far. */
|
|
147
|
+
draft: string;
|
|
148
|
+
/** Send `text` as the user's next message. Does nothing while `disabled`. */
|
|
149
|
+
send: (text: string) => void;
|
|
150
|
+
/** Replace the composer's text with `text` and focus it, for a prompt the user finishes. */
|
|
151
|
+
setDraft: (text: string) => void;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* One control inside the composer, registered in `components.composerTools`.
|
|
156
|
+
*/
|
|
157
|
+
declare interface ComposerToolConfig {
|
|
158
|
+
/** Stable, unique key for the control. */
|
|
159
|
+
id: string;
|
|
160
|
+
/** The control itself — usually an icon button; `PromptInputButton` matches the attach button. */
|
|
161
|
+
component: ComponentType<ComposerToolProps>;
|
|
162
|
+
/**
|
|
163
|
+
* Where it sits among the composer's tools. Lower comes first; equal values keep the order
|
|
164
|
+
* they were registered in. Defaults to `0`, so with no orders set the tools follow the
|
|
165
|
+
* order they were registered in.
|
|
166
|
+
*/
|
|
167
|
+
order?: number;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Props for a control registered in `components.composerTools`, drawn inside the composer
|
|
172
|
+
* beside the send button.
|
|
173
|
+
*/
|
|
174
|
+
declare interface ComposerToolProps extends ComposerFooterProps {
|
|
175
|
+
/**
|
|
176
|
+
* Whether the viewport is phone-sized. The tools share a row with the text box, so every
|
|
177
|
+
* control there takes width from what the user is typing; keep to an icon on a phone.
|
|
178
|
+
*/
|
|
179
|
+
isMobile: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Attach files to the message being drafted, as the attach button does: each uploads at once.
|
|
182
|
+
* A file of a type the backend doesn't accept, or over its size limit, is refused with the
|
|
183
|
+
* same notice.
|
|
184
|
+
*/
|
|
185
|
+
addFiles: (files: File[]) => void;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** "1 year", "3 months" — or "Until canceled" for a plan without a duration. */
|
|
189
|
+
export declare function describeDuration(t: TFunction, duration: PlanDuration | null | undefined): string;
|
|
190
|
+
|
|
191
|
+
/** "per day", "every 5 hours", "for the whole plan". */
|
|
192
|
+
export declare function describeWindow(t: TFunction, window: {
|
|
193
|
+
per: QuotaPeriod;
|
|
194
|
+
every?: number;
|
|
195
|
+
anchor?: QuotaAnchor;
|
|
196
|
+
}): string;
|
|
197
|
+
|
|
198
|
+
export declare function Dialog(props: React_2.ComponentProps<typeof DialogPrimitive.Root>): JSX.Element;
|
|
199
|
+
|
|
200
|
+
export declare function DialogClose(props: React_2.ComponentProps<typeof DialogPrimitive.Close>): JSX.Element;
|
|
201
|
+
|
|
202
|
+
export declare function DialogContent({ className, children, showCloseButton, ...props }: React_2.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
203
|
+
showCloseButton?: boolean;
|
|
204
|
+
}): JSX.Element;
|
|
205
|
+
|
|
206
|
+
export declare function DialogDescription({ className, ...props }: React_2.ComponentProps<typeof DialogPrimitive.Description>): JSX.Element;
|
|
207
|
+
|
|
208
|
+
export declare function DialogFooter({ className, ...props }: React_2.ComponentProps<'div'>): JSX.Element;
|
|
209
|
+
|
|
210
|
+
export declare function DialogHeader({ className, ...props }: React_2.ComponentProps<'div'>): JSX.Element;
|
|
211
|
+
|
|
212
|
+
export declare function DialogTitle({ className, ...props }: React_2.ComponentProps<typeof DialogPrimitive.Title>): JSX.Element;
|
|
213
|
+
|
|
214
|
+
export declare function DialogTrigger(props: React_2.ComponentProps<typeof DialogPrimitive.Trigger>): JSX.Element;
|
|
215
|
+
|
|
216
|
+
export declare function DropdownMenu(props: React_2.ComponentProps<typeof DropdownMenuPrimitive.Root>): JSX.Element;
|
|
217
|
+
|
|
218
|
+
export declare function DropdownMenuContent({ className, sideOffset, ...props }: React_2.ComponentProps<typeof DropdownMenuPrimitive.Content>): JSX.Element;
|
|
219
|
+
|
|
220
|
+
export declare function DropdownMenuItem({ className, inset, variant, ...props }: React_2.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
221
|
+
inset?: boolean;
|
|
222
|
+
variant?: 'default' | 'destructive';
|
|
223
|
+
}): JSX.Element;
|
|
224
|
+
|
|
225
|
+
export declare function DropdownMenuTrigger(props: React_2.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): JSX.Element;
|
|
226
|
+
|
|
227
|
+
/** The slots that always have a component: Gentiq's own unless the host replaced it. */
|
|
228
|
+
declare type FilledSlots = 'MessageList' | 'MessageActions' | 'PromptInput' | 'WelcomeScreen' | 'parts' | 'ChoiceQuestionPart' | 'ChoiceQuestionDock' | 'FollowUpSuggestions' | 'ChatError' | 'UsageMeter' | 'MaintenanceBanner' | 'MaintenanceScreen';
|
|
229
|
+
|
|
230
|
+
/** Suggested messages the user may send after a completed assistant response. */
|
|
231
|
+
declare interface FollowUpSuggestions {
|
|
232
|
+
/** One to three concise messages, displayed and sent verbatim. */
|
|
233
|
+
suggestions: string[];
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/** Props for the follow-up suggestion row beneath the latest assistant response. */
|
|
237
|
+
declare interface FollowUpSuggestionsProps extends FollowUpSuggestions {
|
|
238
|
+
/** Whether suggestions are temporarily non-interactive. */
|
|
239
|
+
disabled?: boolean;
|
|
240
|
+
/** Submit the selected suggestion as the next user message. */
|
|
241
|
+
onSelect?: (suggestion: string) => void | Promise<void>;
|
|
242
|
+
/** Custom CSS classes for the row wrapper. */
|
|
243
|
+
className?: string;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** An amount of a meter, formatted for reading: cost is stored in microunits. */
|
|
247
|
+
export declare function formatQuotaAmount(meter: string, amount: number, language?: string): string;
|
|
248
|
+
|
|
249
|
+
/** A date and time in the active language's calendar. */
|
|
250
|
+
export declare function formatQuotaDate(iso: string | null | undefined, language: string): string;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Override any UI component in ChatLayout/Chat without forking the framework.
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* <ChatLayout
|
|
257
|
+
* components={{
|
|
258
|
+
* WelcomeScreen: MyBrandedWelcome,
|
|
259
|
+
* parts: { text: MyBubble, 'tool-get_weather': WeatherCard, 'data-chart': Chart },
|
|
260
|
+
* }}
|
|
261
|
+
* />
|
|
262
|
+
*/
|
|
263
|
+
declare interface GentiqComponents {
|
|
264
|
+
/**
|
|
265
|
+
* Replaces the entire scrollable message list. It shows the thread of the enclosing
|
|
266
|
+
* `Thread.Root`: compose `Thread.Viewport`, `Thread.Messages` and the message primitives.
|
|
267
|
+
*/
|
|
268
|
+
MessageList?: ComponentType<MessageListProps>;
|
|
269
|
+
/**
|
|
270
|
+
* Replaces the row of actions under each message (copy, retry, feedback, edit), leaving the
|
|
271
|
+
* message itself as it is. It renders inside the message's scope: read the message with
|
|
272
|
+
* `useMessage()` and compose `ActionBar.*`.
|
|
273
|
+
*/
|
|
274
|
+
MessageActions?: ComponentType<MessageActionsProps>;
|
|
275
|
+
/** Replaces the entire prompt input area */
|
|
276
|
+
PromptInput?: ComponentType<PromptInputProps>;
|
|
277
|
+
/** Replaces the welcome / empty-state screen */
|
|
278
|
+
WelcomeScreen?: ComponentType<WelcomeScreenProps>;
|
|
279
|
+
/**
|
|
280
|
+
* Replaces the pending-reply and thread-loading indicator with a custom loader component.
|
|
281
|
+
*/
|
|
282
|
+
Loader?: ComponentType<LoaderProps>;
|
|
283
|
+
/**
|
|
284
|
+
* The component for each part type, over Gentiq's: `text`, `reasoning`, `file`, `tool` (any tool
|
|
285
|
+
* call without its own), `tool-<name>` (one tool's calls), `data-<name>` (a part the backend
|
|
286
|
+
* streams with `ctx.deps.emit(name, payload)`), or `null` to render nothing for a type. Each
|
|
287
|
+
* renders inside the message's scope, with an error boundary around it; tool calls and files
|
|
288
|
+
* also get a quote button. Write tool and data components with `defineToolUI` and
|
|
289
|
+
* `defineDataUI`.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```tsx
|
|
293
|
+
* parts: {
|
|
294
|
+
* 'tool-get_weather': defineToolUI<{ city: string }, { temp: number }>(({ part }) =>
|
|
295
|
+
* part.state === 'output-available' ? <p>{part.output.temp}°</p> : null,
|
|
296
|
+
* ),
|
|
297
|
+
* }
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
parts?: MessagePartComponents;
|
|
301
|
+
/** Replaces the multiple-choice question renderer used for past questions */
|
|
302
|
+
ChoiceQuestionPart?: ComponentType<ChoiceQuestionPartProps>;
|
|
303
|
+
/** Replaces the pending choice question docked on top of the composer */
|
|
304
|
+
ChoiceQuestionDock?: ComponentType<ChoiceQuestionDockProps>;
|
|
305
|
+
/** Replaces the clickable follow-up row beneath the latest assistant response. */
|
|
306
|
+
FollowUpSuggestions?: ComponentType<FollowUpSuggestionsProps>;
|
|
307
|
+
/**
|
|
308
|
+
* Your own content directly beneath the composer — prompt suggestions on the new-chat
|
|
309
|
+
* screen, as in ChatGPT, or mode toggles and quick actions. Empty by default. Rendered by
|
|
310
|
+
* the built-in composer; a custom `PromptInput` renders it itself, if at all.
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```tsx
|
|
314
|
+
* ComposerFooter: ({ newChat, disabled, send }) =>
|
|
315
|
+
* newChat ? (
|
|
316
|
+
* <Suggestions className="mx-auto pt-3">
|
|
317
|
+
* {['Plan a trip', 'Summarize a PDF'].map((s) => (
|
|
318
|
+
* <Suggestion key={s} suggestion={s} onClick={send} disabled={disabled} />
|
|
319
|
+
* ))}
|
|
320
|
+
* </Suggestions>
|
|
321
|
+
* ) : null
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
324
|
+
ComposerFooter?: ComponentType<ComposerFooterProps>;
|
|
325
|
+
/**
|
|
326
|
+
* Your own controls inside the composer, beside the send button — a prompt library, a
|
|
327
|
+
* shortcut that fills in a prompt. A tool can change the draft and attach files, but
|
|
328
|
+
* cannot send anything with a message besides its text. Each is placed by its `order`
|
|
329
|
+
* against the others.
|
|
330
|
+
* The attach button isn't among them; it leads the text box. Rendered by the built-in
|
|
331
|
+
* composer; a custom `PromptInput` renders them itself, if at all.
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```tsx
|
|
335
|
+
* composerTools: [
|
|
336
|
+
* {
|
|
337
|
+
* id: 'surprise',
|
|
338
|
+
* component: ({ disabled, setDraft }) => (
|
|
339
|
+
* <PromptInputButton disabled={disabled} onClick={() => setDraft('Surprise me')}>
|
|
340
|
+
* <Dices className="size-4" />
|
|
341
|
+
* </PromptInputButton>
|
|
342
|
+
* ),
|
|
343
|
+
* },
|
|
344
|
+
* ]
|
|
345
|
+
* ```
|
|
346
|
+
*/
|
|
347
|
+
composerTools?: ComposerToolConfig[];
|
|
348
|
+
/**
|
|
349
|
+
* Replaces the notice shown under the transcript when a turn fails — e.g. an upgrade card
|
|
350
|
+
* when `code` is `'quota_exceeded'`, `'credits_exhausted'` or `'plan_expired'`. Render the
|
|
351
|
+
* exported `ChatError` for the codes you don't handle.
|
|
352
|
+
*/
|
|
353
|
+
ChatError?: ComponentType<ChatErrorProps>;
|
|
354
|
+
/**
|
|
355
|
+
* Extra controls in the top bar, placed before the usage meter, new-chat and settings
|
|
356
|
+
* buttons — e.g. an "Upgrade" button. Not rendered on shared-chat pages. Read the user's
|
|
357
|
+
* access with `useGentiqEntitlement()` to decide whether to show anything.
|
|
358
|
+
*/
|
|
359
|
+
HeaderActions?: ComponentType<HeaderActionsProps>;
|
|
360
|
+
/**
|
|
361
|
+
* The same thing, but as named entries an admin can switch on and off from the admin panel
|
|
362
|
+
* (Settings › Chat). They render after {@link GentiqComponents.HeaderActions}, in the order
|
|
363
|
+
* given here. Only register an action once — the admin panel keys its toggle off `id`.
|
|
364
|
+
*/
|
|
365
|
+
headerActions?: HeaderActionConfig[];
|
|
366
|
+
/**
|
|
367
|
+
* Replaces the usage meter in the top bar. Render the exported `UsageMeter` to keep the
|
|
368
|
+
* built-in pill and decide yourself when it shows — return `null` to hide it for the current
|
|
369
|
+
* user, route, plan or anything else your app knows. Rendered only while
|
|
370
|
+
* `app.showUsageBar` is on, so an admin can still switch it off for everyone.
|
|
371
|
+
*/
|
|
372
|
+
UsageMeter?: ComponentType<UsageMeterProps>;
|
|
373
|
+
/**
|
|
374
|
+
* Replaces the strip shown above the chat while maintenance is on and its display is
|
|
375
|
+
* `banner`. `null` shows nothing (the composer is still disabled while the backend refuses
|
|
376
|
+
* messages).
|
|
377
|
+
*/
|
|
378
|
+
MaintenanceBanner?: ComponentType<MaintenanceNoticeProps> | null;
|
|
379
|
+
/**
|
|
380
|
+
* Replaces the page shown in place of the chat while maintenance is on and its display is
|
|
381
|
+
* `fullscreen`. `null` falls back to the banner.
|
|
382
|
+
*/
|
|
383
|
+
MaintenanceScreen?: ComponentType<MaintenanceNoticeProps> | null;
|
|
384
|
+
/**
|
|
385
|
+
* Per-tool/card reference display adapters.
|
|
386
|
+
* Return label/excerpt/data overrides used in composer chips, sent context,
|
|
387
|
+
* and reference badges.
|
|
388
|
+
*
|
|
389
|
+
* @example
|
|
390
|
+
* ```ts
|
|
391
|
+
* referenceAdapters: {
|
|
392
|
+
* get_weather: ({ part }) => ({
|
|
393
|
+
* label: 'Weather',
|
|
394
|
+
* excerpt: `Weather: ${part.output.city}: ${part.output.condition}`,
|
|
395
|
+
* }),
|
|
396
|
+
* }
|
|
397
|
+
* ```
|
|
398
|
+
*/
|
|
399
|
+
referenceAdapters?: Record<string, ReferenceAdapter>;
|
|
400
|
+
/** Custom components mapping for markdown rendering overrides. */
|
|
401
|
+
textComponents?: StreamdownProps['components'];
|
|
402
|
+
/** Custom remark plugins for markdown parsing. */
|
|
403
|
+
remarkPlugins?: StreamdownProps['remarkPlugins'];
|
|
404
|
+
/** Custom rehype plugins for markdown parsing. */
|
|
405
|
+
rehypePlugins?: StreamdownProps['rehypePlugins'];
|
|
406
|
+
/**
|
|
407
|
+
* Extra URL schemes a markdown link may carry, without the `:`.
|
|
408
|
+
*
|
|
409
|
+
* Links are sanitized down to the schemes the renderer allows (`http`,
|
|
410
|
+
* `https`, `mailto`, `irc`, `ircs`, `xmpp`, `tel`); anything else loses its
|
|
411
|
+
* `href` and renders as `text [blocked]`. List a scheme here to render app
|
|
412
|
+
* components off links that use it:
|
|
413
|
+
*
|
|
414
|
+
* ```tsx
|
|
415
|
+
* linkProtocols: ['carcard'],
|
|
416
|
+
* textComponents: {
|
|
417
|
+
* a: (props) =>
|
|
418
|
+
* props.href?.startsWith('carcard://')
|
|
419
|
+
* ? <CarCard id={props.href.slice('carcard://'.length)} />
|
|
420
|
+
* : <a {...props} />,
|
|
421
|
+
* }
|
|
422
|
+
* ```
|
|
423
|
+
*
|
|
424
|
+
* `javascript:`, `data:`, `vbscript:` and `file:` are always blocked.
|
|
425
|
+
*/
|
|
426
|
+
linkProtocols?: string[];
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/** The URL of Gentiq's logo, which the header and the admin panel show. */
|
|
430
|
+
export declare const gentiqLogo: string;
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* One named top-bar control, registered in `components.headerActions`.
|
|
434
|
+
*
|
|
435
|
+
* Registering an action rather than passing the bare {@link GentiqComponents.HeaderActions}
|
|
436
|
+
* slot puts it in the admin panel: Settings › Chat grows a toggle per entry, so an admin can
|
|
437
|
+
* show or hide it at runtime without a deploy. The component itself decides nothing about
|
|
438
|
+
* that — it is simply not rendered while the toggle is off.
|
|
439
|
+
*/
|
|
440
|
+
declare interface HeaderActionConfig {
|
|
441
|
+
/** Stable key the admin's choice is stored under. Renaming it resets that choice. */
|
|
442
|
+
id: string;
|
|
443
|
+
/** The control itself. */
|
|
444
|
+
component: ComponentType<HeaderActionsProps>;
|
|
445
|
+
/** The name the admin's toggle carries — plain text, or an i18n key like `chat:upgrade_plan`. */
|
|
446
|
+
label: string;
|
|
447
|
+
/** An optional line under that name explaining what the control does. */
|
|
448
|
+
help?: string;
|
|
449
|
+
/** Whether it shows before an admin has ever touched the toggle. Defaults to `true`. */
|
|
450
|
+
defaultEnabled?: boolean;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Props for the HeaderActions slot, rendered at the start of the top bar's action buttons.
|
|
455
|
+
*/
|
|
456
|
+
declare interface HeaderActionsProps {
|
|
457
|
+
/**
|
|
458
|
+
* Whether the viewport is phone-sized.
|
|
459
|
+
*/
|
|
460
|
+
isMobile: boolean;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
export declare function Input({ className, type, ...props }: React_2.ComponentProps<'input'>): JSX.Element;
|
|
464
|
+
|
|
465
|
+
export declare const Label: React_2.ForwardRefExoticComponent<React_2.LabelHTMLAttributes<HTMLLabelElement> & VariantProps<(props?: ClassProp | undefined) => string> & React_2.RefAttributes<HTMLLabelElement>>;
|
|
466
|
+
|
|
467
|
+
export declare const Loader: ({ className, variant, ...props }: LoaderProps) => JSX.Element;
|
|
468
|
+
|
|
469
|
+
declare type LoaderProps = HTMLAttributes<HTMLDivElement> & {
|
|
470
|
+
size?: number;
|
|
471
|
+
/**
|
|
472
|
+
* Indicator variant. Retained for compatibility with custom renderers;
|
|
473
|
+
* Gentiq's built-in loader renders a three-dot acrobatic loop.
|
|
474
|
+
*/
|
|
475
|
+
variant?: string;
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Props for the `MaintenanceBanner` and `MaintenanceScreen` slots.
|
|
480
|
+
*/
|
|
481
|
+
declare interface MaintenanceNoticeProps {
|
|
482
|
+
/** The raw status, for anything the resolved fields below leave out. */
|
|
483
|
+
status: MaintenanceStatus;
|
|
484
|
+
/** The title to show: the admin's, else `maintenance.title` from the config, else the default. */
|
|
485
|
+
title: string;
|
|
486
|
+
/** The message to show, resolved the same way. */
|
|
487
|
+
message: string;
|
|
488
|
+
/** When maintenance is expected to end, if the admin said. */
|
|
489
|
+
endsAt?: Date;
|
|
490
|
+
/** Whether new messages are refused meanwhile. */
|
|
491
|
+
blocksChat: boolean;
|
|
492
|
+
/** Check the status again now. */
|
|
493
|
+
refresh: () => void;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/** Props for the row of actions under a message: which of them the app's options turn on. */
|
|
497
|
+
declare interface MessageActionsProps {
|
|
498
|
+
/** Whether to offer to retry the last answer (`threadActions.retry`). */
|
|
499
|
+
retry: boolean;
|
|
500
|
+
/** Whether to offer feedback on answers (`threadActions.feedback`). */
|
|
501
|
+
feedback: boolean;
|
|
502
|
+
/** Whether to offer to edit the last message the user sent (`threadActions.edit`). */
|
|
503
|
+
edit: boolean;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Props for the MessageList component: the scrollable transcript of the thread the enclosing
|
|
508
|
+
* `Thread.Root` shows.
|
|
509
|
+
*/
|
|
510
|
+
declare interface MessageListProps {
|
|
511
|
+
/** Custom CSS class names. */
|
|
512
|
+
className?: string;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/** The human name of a meter, falling back to its key for app-defined meters. */
|
|
516
|
+
export declare function meterLabel(t: TFunction, meter: string): string;
|
|
517
|
+
|
|
518
|
+
export declare const ModeToggle: FC<{
|
|
519
|
+
className?: string;
|
|
520
|
+
}>;
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Props for the PromptInput component, where the user types messages.
|
|
524
|
+
*/
|
|
525
|
+
declare interface PromptInputProps {
|
|
526
|
+
/** Sends a message: `useThread().send`. */
|
|
527
|
+
onSend: (message: SendMessageInput) => void;
|
|
528
|
+
/** Current chat status. */
|
|
529
|
+
status: ChatStatus;
|
|
530
|
+
/** Whether to show the error message. */
|
|
531
|
+
isErrorVisible: boolean;
|
|
532
|
+
/** The thread's id, or `null` for a new thread. */
|
|
533
|
+
threadId?: string | null;
|
|
534
|
+
/** Whether this is the centered new-chat composer (enables the animated placeholder). */
|
|
535
|
+
newChat?: boolean;
|
|
536
|
+
/** Custom CSS class names. */
|
|
537
|
+
className?: string;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
export declare const QUOTA_PERIODS: QuotaPeriod[];
|
|
541
|
+
|
|
542
|
+
/** The slot map in force: every filled slot has a component (or `null` for a notice). */
|
|
543
|
+
declare type ResolvedSlots = Required<Pick<GentiqComponents, FilledSlots>> & Omit<GentiqComponents, FilledSlots>;
|
|
544
|
+
|
|
545
|
+
export declare function Select(props: React_2.ComponentProps<typeof SelectPrimitive.Root>): JSX.Element;
|
|
546
|
+
|
|
547
|
+
export declare function SelectContent({ className, children, position, ...props }: React_2.ComponentProps<typeof SelectPrimitive.Content>): JSX.Element;
|
|
548
|
+
|
|
549
|
+
export declare function SelectItem({ className, children, ...props }: React_2.ComponentProps<typeof SelectPrimitive.Item>): JSX.Element;
|
|
550
|
+
|
|
551
|
+
export declare function SelectTrigger({ className, size, children, ...props }: React_2.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
552
|
+
size?: 'sm' | 'default';
|
|
553
|
+
}): JSX.Element;
|
|
554
|
+
|
|
555
|
+
export declare function SelectValue(props: React_2.ComponentProps<typeof SelectPrimitive.Value>): JSX.Element;
|
|
556
|
+
|
|
557
|
+
export declare function Sheet(props: React_2.ComponentProps<typeof DialogPrimitive.Root>): JSX.Element;
|
|
558
|
+
|
|
559
|
+
export declare function SheetContent({ className, children, side, ...props }: React_2.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
560
|
+
side?: 'top' | 'end' | 'bottom' | 'start';
|
|
561
|
+
}): JSX.Element;
|
|
562
|
+
|
|
563
|
+
export declare function SheetDescription({ className, ...props }: React_2.ComponentProps<typeof DialogPrimitive.Description>): JSX.Element;
|
|
564
|
+
|
|
565
|
+
export declare function SheetHeader({ className, ...props }: React_2.ComponentProps<'div'>): JSX.Element;
|
|
566
|
+
|
|
567
|
+
export declare function SheetTitle({ className, ...props }: React_2.ComponentProps<typeof DialogPrimitive.Title>): JSX.Element;
|
|
568
|
+
|
|
569
|
+
declare type StreamdownProps = ComponentProps<typeof Streamdown>;
|
|
570
|
+
|
|
571
|
+
export declare function Switch({ className, ...props }: React_2.ComponentProps<typeof SwitchPrimitive.Root>): JSX.Element;
|
|
572
|
+
|
|
573
|
+
export declare function Textarea({ className, ...props }: React_2.ComponentProps<'textarea'>): JSX.Element;
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* Props for the UsageMeter slot, the allowance pill in the top bar.
|
|
577
|
+
*/
|
|
578
|
+
declare interface UsageMeterProps {
|
|
579
|
+
className?: string;
|
|
580
|
+
/**
|
|
581
|
+
* Whether hovering or tapping the meter opens a card with the length and percentage left of
|
|
582
|
+
* every limit. When `false`, the meter shows only its own percentage and opens nothing.
|
|
583
|
+
* Defaults to `true`; the top bar passes `app.showUsageDetails`.
|
|
584
|
+
*/
|
|
585
|
+
details?: boolean;
|
|
586
|
+
/** Whether the viewport is phone-sized. */
|
|
587
|
+
isMobile?: boolean;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/** The slot map in force: Gentiq's components, with the nearest `GentiqUI`'s replacements. */
|
|
591
|
+
export declare function useSlots(): ResolvedSlots;
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Props for the WelcomeScreen component.
|
|
595
|
+
*/
|
|
596
|
+
declare interface WelcomeScreenProps {
|
|
597
|
+
/** Sends a suggestion as the thread's first message, for a welcome screen that offers some. */
|
|
598
|
+
onSuggestionClick: (suggestion: string) => void;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
export { }
|