@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.d.ts
ADDED
|
@@ -0,0 +1,1280 @@
|
|
|
1
|
+
import { ApiConfig } from '@gentiq/core';
|
|
2
|
+
import { AskUserPart } from '@gentiq/core';
|
|
3
|
+
import { ChatStatus } from '@gentiq/react';
|
|
4
|
+
import { ClassProp } from 'class-variance-authority/types';
|
|
5
|
+
import { ComponentProps } from 'react';
|
|
6
|
+
import { ComponentType } from 'react';
|
|
7
|
+
import { CreditsStatus } from '@gentiq/core';
|
|
8
|
+
import { EntitlementWindow } from '@gentiq/core';
|
|
9
|
+
import { FileUIPart } from 'ai';
|
|
10
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
11
|
+
import { GentiqMessagePart } from '@gentiq/core';
|
|
12
|
+
import { GentiqRuntimeProviderProps } from '@gentiq/react';
|
|
13
|
+
import { GentiqToolPart } from '@gentiq/core';
|
|
14
|
+
import { GentiqUIMessage } from '@gentiq/core';
|
|
15
|
+
import { GentiqUser } from '@gentiq/core';
|
|
16
|
+
import { HTMLAttributes } from 'react';
|
|
17
|
+
import { JSX } from 'react/jsx-runtime';
|
|
18
|
+
import { LucideIcon } from 'lucide-react';
|
|
19
|
+
import { MaintenanceStatus } from '@gentiq/core';
|
|
20
|
+
import { MessagePartComponents } from '@gentiq/react';
|
|
21
|
+
import { PartProps } from '@gentiq/react';
|
|
22
|
+
import * as React_2 from 'react';
|
|
23
|
+
import { ReactNode } from 'react';
|
|
24
|
+
import { ReasoningUIPart } from 'ai';
|
|
25
|
+
import { RefAttributes } from 'react';
|
|
26
|
+
import { ReferenceAdapter } from '@gentiq/core';
|
|
27
|
+
import { ReferencesSourceProps } from '@gentiq/react';
|
|
28
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
29
|
+
import { SendMessageInput } from '@gentiq/react';
|
|
30
|
+
import { SettingsFieldMode } from '@gentiq/react';
|
|
31
|
+
import { Streamdown } from 'streamdown';
|
|
32
|
+
import { TextUIPart } from 'ai';
|
|
33
|
+
import { TFunction } from 'i18next';
|
|
34
|
+
import { ToolOutputResponse } from '@gentiq/core';
|
|
35
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
36
|
+
import { UnauthenticatedReason } from '@gentiq/react';
|
|
37
|
+
import { VariantProps } from 'class-variance-authority';
|
|
38
|
+
|
|
39
|
+
/** Fields available in the Account section. */
|
|
40
|
+
export declare interface AccountSettingsFields {
|
|
41
|
+
/** The user's plan, credits or usage limits. */
|
|
42
|
+
usage?: SettingsFieldMode;
|
|
43
|
+
logout?: SettingsFieldMode;
|
|
44
|
+
[key: string]: SettingsFieldMode | undefined;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The default sidebar: a new-conversation button and the user's conversations, built from
|
|
49
|
+
* `ThreadList.*`. Switches into the grouped settings navigation while settings are open.
|
|
50
|
+
*/
|
|
51
|
+
export declare function AppSidebar({ side }: {
|
|
52
|
+
side?: 'start' | 'end';
|
|
53
|
+
}): JSX.Element;
|
|
54
|
+
|
|
55
|
+
declare function Button({ className, variant, size, asChild, ...props }: React_2.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
56
|
+
asChild?: boolean;
|
|
57
|
+
}): JSX.Element;
|
|
58
|
+
|
|
59
|
+
declare const buttonVariants: (props?: ({
|
|
60
|
+
variant?: "default" | "destructive" | "link" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
61
|
+
size?: "default" | "icon" | "sm" | "lg" | null | undefined;
|
|
62
|
+
} & ClassProp) | undefined) => string;
|
|
63
|
+
|
|
64
|
+
export declare const Chat: ({ threadId, onThreadChange, components: localComponents, welcome, threadActions, composer, disclaimer, ...rest }: ChatProps) => JSX.Element;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The notice under the transcript when a turn fails. Replace it with `components.ChatError`,
|
|
68
|
+
* e.g. to offer an upgrade when `error.code` is `quota_exceeded`, and render this one for the
|
|
69
|
+
* rest.
|
|
70
|
+
*/
|
|
71
|
+
export declare function ChatError({ error, code }: ChatErrorProps): JSX.Element;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Props for the ChatError component, the notice under the transcript when a turn fails. Dismiss
|
|
75
|
+
* it with `useThread().clearError`.
|
|
76
|
+
*/
|
|
77
|
+
export declare interface ChatErrorProps {
|
|
78
|
+
/**
|
|
79
|
+
* The failure, its message already localized. A refusal from the server is a `GentiqError`
|
|
80
|
+
* (check with `isGentiqError`) carrying the backend's `status` and `details` — for
|
|
81
|
+
* `quota_exceeded`, `{ meter, limit, used, window, resets_at, plan, subscription_ends_at }`.
|
|
82
|
+
*/
|
|
83
|
+
error: Error;
|
|
84
|
+
/** The error code when the server sent one (a `GentiqErrorCode`), else `undefined`. */
|
|
85
|
+
code?: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export declare function ChatLayout({ components, disclaimer, welcome, ...rest }: ChatLayoutProps): JSX.Element;
|
|
89
|
+
|
|
90
|
+
export declare interface ChatLayoutProps {
|
|
91
|
+
/**
|
|
92
|
+
* The thread to show, or `null` for a new one. Leave it out to let the chat keep track of the
|
|
93
|
+
* thread itself. Spread `useRouterThread()` from `gentiq/react-router` to keep it in the URL.
|
|
94
|
+
*/
|
|
95
|
+
threadId?: string | null;
|
|
96
|
+
/**
|
|
97
|
+
* Called when the chat shows another thread: one opened from the sidebar, `null` for a new
|
|
98
|
+
* one, or the id a new thread is given when its first message is sent.
|
|
99
|
+
*/
|
|
100
|
+
onThreadChange?: (threadId: string | null) => void;
|
|
101
|
+
/** A thread's URL, so the sidebar's rows are links that can open in a new tab. */
|
|
102
|
+
getThreadHref?: (threadId: string | null) => string;
|
|
103
|
+
/** A share link's path, for an app that serves shared threads somewhere other than `/shared/<id>`. */
|
|
104
|
+
getShareHref?: (shareId: string) => string;
|
|
105
|
+
/**
|
|
106
|
+
* Replaces built-in components in this layout, over the enclosing `GentiqUI`'s. `welcome` and
|
|
107
|
+
* `disclaimer` apply here the same way.
|
|
108
|
+
*/
|
|
109
|
+
components?: GentiqComponents;
|
|
110
|
+
/** Provide a custom sidebar node, or `null` to hide it entirely. */
|
|
111
|
+
sidebar?: ReactNode;
|
|
112
|
+
/** Provide a custom header node, or `null` to hide it entirely. */
|
|
113
|
+
header?: ReactNode;
|
|
114
|
+
classNames?: ChatProps['classNames'];
|
|
115
|
+
disclaimer?: ChatProps['disclaimer'];
|
|
116
|
+
welcome?: ChatProps['welcome'];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export declare interface ChatProps {
|
|
120
|
+
/**
|
|
121
|
+
* The thread to show, or `null` for a new one. Leave it out to let the chat keep track of the
|
|
122
|
+
* thread itself, or, inside `ChatLayout`, to show `ChatLayout`'s. Pair it with `onThreadChange`, or
|
|
123
|
+
* spread `useRouterThread()` from `gentiq/react-router` to keep it in the URL.
|
|
124
|
+
*/
|
|
125
|
+
threadId?: string | null;
|
|
126
|
+
/**
|
|
127
|
+
* Called when the chat shows another thread: `null` for a new one, or the id a new thread is
|
|
128
|
+
* given when its first message is sent.
|
|
129
|
+
*/
|
|
130
|
+
onThreadChange?: (threadId: string | null) => void;
|
|
131
|
+
/**
|
|
132
|
+
* Replaces built-in components in this chat. The options below apply to this chat too; each
|
|
133
|
+
* keeps what it leaves out from the enclosing `GentiqUI`, and the admin's settings still take
|
|
134
|
+
* precedence. Wrapping the chat in a `GentiqUI` does the same.
|
|
135
|
+
*/
|
|
136
|
+
components?: GentiqComponents;
|
|
137
|
+
classNames?: {
|
|
138
|
+
container?: string;
|
|
139
|
+
messageList?: string;
|
|
140
|
+
inputArea?: string;
|
|
141
|
+
};
|
|
142
|
+
disclaimer?: GentiqUIOptionsInput['disclaimer'];
|
|
143
|
+
welcome?: GentiqUIOptionsInput['welcome'];
|
|
144
|
+
threadActions?: GentiqUIOptionsInput['threadActions'];
|
|
145
|
+
composer?: GentiqUIOptionsInput['composer'];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Structured assistant question that can be answered with one tap.
|
|
150
|
+
*/
|
|
151
|
+
export declare interface ChoiceQuestion {
|
|
152
|
+
/** The question shown above the options. */
|
|
153
|
+
question: string;
|
|
154
|
+
/** Choices the user can select. */
|
|
155
|
+
choices: ChoiceQuestionChoice[];
|
|
156
|
+
/** Whether the default renderer should show a custom answer field. Defaults to true. */
|
|
157
|
+
allowCustom?: boolean;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* One selectable option shown in a Gentiq choice question.
|
|
162
|
+
*/
|
|
163
|
+
export declare interface ChoiceQuestionChoice {
|
|
164
|
+
/** Human-readable option shown to the user and sent when selected. */
|
|
165
|
+
label: string;
|
|
166
|
+
/** Optional app-specific value for custom renderers. */
|
|
167
|
+
value?: unknown;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
declare interface ChoiceQuestionContextValue {
|
|
171
|
+
/** The question docked on top of the composer, or null when there is none. */
|
|
172
|
+
question: ChoiceQuestion | null;
|
|
173
|
+
/** Message the docked question came from — the message list uses it to
|
|
174
|
+
* suppress the inline picker that the dock has taken over. */
|
|
175
|
+
messageId: string | null;
|
|
176
|
+
/** True while the turn is still streaming: the dock shows, but is inert. */
|
|
177
|
+
disabled: boolean;
|
|
178
|
+
/** Whether the user closed the docked question. It is still pending and still
|
|
179
|
+
* answerable — it has just moved back into the transcript. Reset by the next
|
|
180
|
+
* question, since a fresh one was never dismissed. */
|
|
181
|
+
dismissed: boolean;
|
|
182
|
+
setDismissed: (dismissed: boolean) => void;
|
|
183
|
+
/** Answer the docked question with a picked or typed answer. */
|
|
184
|
+
answer: (value: string) => void;
|
|
185
|
+
/** Measured dock height, so the transcript can keep its tail clear of it.
|
|
186
|
+
* One option per line makes the dock tall and variable, so it is measured
|
|
187
|
+
* rather than guessed at. */
|
|
188
|
+
dockHeight: number;
|
|
189
|
+
reportDockHeight: (height: number) => void;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The pending choice question, docked on top of the composer.
|
|
194
|
+
*
|
|
195
|
+
* It shares the composer's surface and tucks its bottom edge underneath it, so
|
|
196
|
+
* the two read as one control. Options are stacked one per line and span the
|
|
197
|
+
* composer's full width, which lines their edges up with the input below and
|
|
198
|
+
* makes them a list to scan rather than a scattering of pills. There is no
|
|
199
|
+
* custom-answer field here — the composer itself is the "other answer" slot.
|
|
200
|
+
*
|
|
201
|
+
* A question is an offer, not a modal, so it closes. Closing does not answer it
|
|
202
|
+
* and does not throw it away: the question drops back into the transcript on the
|
|
203
|
+
* message that asked it, where it stays reopenable for as long as it is the
|
|
204
|
+
* live one (see `ChoiceQuestionPart`).
|
|
205
|
+
*/
|
|
206
|
+
export declare function ChoiceQuestionDock({ question, disabled, onDismiss, onAnswer, className, }: ChoiceQuestionDockProps): JSX.Element;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Props for the choice question docked on top of the composer.
|
|
210
|
+
*/
|
|
211
|
+
export declare interface ChoiceQuestionDockProps {
|
|
212
|
+
/** The pending question. */
|
|
213
|
+
question: ChoiceQuestion;
|
|
214
|
+
/** Whether the choices can be picked yet (false while the turn streams). */
|
|
215
|
+
disabled?: boolean;
|
|
216
|
+
/** Close the dock without answering. The question is not discarded — it
|
|
217
|
+
* returns to the transcript, where it can be reopened. */
|
|
218
|
+
onDismiss?: () => void;
|
|
219
|
+
/** Submit the picked choice as a normal user message. */
|
|
220
|
+
onAnswer?: (answer: string) => void | Promise<void>;
|
|
221
|
+
/** Custom CSS class names. */
|
|
222
|
+
className?: string;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* A choice question inside the transcript.
|
|
227
|
+
*
|
|
228
|
+
* The question itself is just something the assistant said, so it renders as an
|
|
229
|
+
* ordinary assistant message — same typography, same markdown, same width as
|
|
230
|
+
* any other reply. The options are a control, not content: they appear only
|
|
231
|
+
* while the question can still be answered, and once it is answered the user's
|
|
232
|
+
* own message carries the reply. What is left behind is a plain exchange of
|
|
233
|
+
* bubbles, which is all a past question ever was.
|
|
234
|
+
*
|
|
235
|
+
* In the default chat the live question is docked on the composer instead (see
|
|
236
|
+
* `ChoiceQuestionDock`), so the picker below is the fallback for a message list
|
|
237
|
+
* rendered without that dock — and the landing place for a question the user
|
|
238
|
+
* closed there, which comes back as a stub that puts it on the composer again.
|
|
239
|
+
*/
|
|
240
|
+
export declare function ChoiceQuestionPart({ part, message, disabled, dismissed, onReopen, onAnswer, }: ChoiceQuestionPartProps): JSX.Element | null;
|
|
241
|
+
|
|
242
|
+
export declare interface ChoiceQuestionPartProps {
|
|
243
|
+
/** The `ask_user` tool call the question comes from. */
|
|
244
|
+
part: AskUserPart;
|
|
245
|
+
/** Parent message. */
|
|
246
|
+
message: GentiqUIMessage;
|
|
247
|
+
/** Whether the controls should accept an answer. */
|
|
248
|
+
disabled?: boolean;
|
|
249
|
+
/** Whether the user closed this question on the composer. It renders as a
|
|
250
|
+
* reopenable stub instead of a picker. */
|
|
251
|
+
dismissed?: boolean;
|
|
252
|
+
/** Put the question back on the composer. Absent when it can no longer be
|
|
253
|
+
* answered, which is what makes the stub inert on old messages. */
|
|
254
|
+
onReopen?: () => void;
|
|
255
|
+
/** Answer the question with a picked or typed answer. */
|
|
256
|
+
onAnswer?: (answer: string) => void | Promise<void>;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Lifts the pending choice question out of the message list so the composer can
|
|
261
|
+
* dock it on top of itself, Claude-style: the choices sit on the composer's own
|
|
262
|
+
* surface and the text input doubles as the "other answer" slot.
|
|
263
|
+
*
|
|
264
|
+
* Only an `ask_user` call in the last assistant message that waits on its answer can own the
|
|
265
|
+
* dock; answering it carries the turn on, which is what makes the question historical again.
|
|
266
|
+
*/
|
|
267
|
+
export declare function ChoiceQuestionProvider({ message, disabled, readonly, cacheNamespace, onAnswer, children, }: ChoiceQuestionProviderProps): JSX.Element;
|
|
268
|
+
|
|
269
|
+
declare interface ChoiceQuestionProviderProps {
|
|
270
|
+
/** Last message of the thread; only an assistant message can hold a question. */
|
|
271
|
+
message?: GentiqUIMessage;
|
|
272
|
+
/** Whether the chat can accept an answer right now. */
|
|
273
|
+
disabled?: boolean;
|
|
274
|
+
/** Read-only surfaces (e.g. a shared thread) have no composer to dock onto. */
|
|
275
|
+
readonly?: boolean;
|
|
276
|
+
/** Prefix for the stored dismissals, so they cannot collide with a host app's
|
|
277
|
+
* own keys. Passed in rather than read from the options, which
|
|
278
|
+
* registers the dock and would therefore import this module back. */
|
|
279
|
+
cacheNamespace?: string;
|
|
280
|
+
/** Gives the question's `ask_user` call the user's answer as its result. */
|
|
281
|
+
onAnswer?: (response: ToolOutputResponse) => void;
|
|
282
|
+
children: ReactNode;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Configuration for the composer (input area).
|
|
287
|
+
*/
|
|
288
|
+
export declare interface ComposerConfig {
|
|
289
|
+
/** Placeholder text for the input. */
|
|
290
|
+
placeholder?: string;
|
|
291
|
+
/** The most characters a message may have. Defaults to 10,000. */
|
|
292
|
+
maxLength?: number;
|
|
293
|
+
/**
|
|
294
|
+
* Sent messages taller than this many lines are collapsed in the transcript,
|
|
295
|
+
* with a button to expand them. Defaults to 8; `0` never collapses.
|
|
296
|
+
*/
|
|
297
|
+
collapseLines?: number;
|
|
298
|
+
/** Configuration for file attachments. */
|
|
299
|
+
attachments?: {
|
|
300
|
+
/**
|
|
301
|
+
* Whether attachments are enabled. What the backend accepts (`GentiqApp(attachment_types=...)`
|
|
302
|
+
* and `MAX_ATTACHMENT_SIZE`) comes from `/config`.
|
|
303
|
+
*/
|
|
304
|
+
enabled?: boolean;
|
|
305
|
+
};
|
|
306
|
+
/** Configuration for chat references. */
|
|
307
|
+
references?: {
|
|
308
|
+
/** Whether users can reference earlier chat content from the composer. */
|
|
309
|
+
enabled?: boolean;
|
|
310
|
+
/** Maximum number of active references in the composer. Defaults to 5. */
|
|
311
|
+
maxItems?: number;
|
|
312
|
+
/** Maximum excerpt length stored/sent for each reference. Defaults to 500. */
|
|
313
|
+
maxExcerptLength?: number;
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* Voice input: a microphone button that records the user and writes what they said into
|
|
317
|
+
* the composer, to edit and send like anything typed. Shown only when the backend has a
|
|
318
|
+
* transcriber (`GentiqApp(transcriber=...)`) and the browser can record.
|
|
319
|
+
*/
|
|
320
|
+
voice?: {
|
|
321
|
+
/**
|
|
322
|
+
* Set `false` to hide the microphone even though the backend can transcribe. Admins can
|
|
323
|
+
* override it in Settings › Chat.
|
|
324
|
+
*/
|
|
325
|
+
enabled?: boolean;
|
|
326
|
+
/**
|
|
327
|
+
* The longest recording, in seconds. When it's reached, recording stops and what was
|
|
328
|
+
* said so far is transcribed. Defaults to 300.
|
|
329
|
+
*/
|
|
330
|
+
maxDuration?: number;
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Props for the ComposerFooter slot, rendered directly beneath the composer — e.g. prompt
|
|
336
|
+
* suggestions on the new-chat screen, mode toggles or quick actions.
|
|
337
|
+
*/
|
|
338
|
+
export declare interface ComposerFooterProps {
|
|
339
|
+
/**
|
|
340
|
+
* Whether this is the new-chat screen, where the composer sits centered under the welcome
|
|
341
|
+
* header. Return `null` when it is `false` to show something only before the first message.
|
|
342
|
+
*/
|
|
343
|
+
newChat: boolean;
|
|
344
|
+
/** The thread's id, or `null` for a new thread. */
|
|
345
|
+
threadId?: string | null;
|
|
346
|
+
/** Current chat status. */
|
|
347
|
+
status: ChatStatus;
|
|
348
|
+
/** Whether a message can't be sent right now: a reply is in flight, or maintenance is on. */
|
|
349
|
+
disabled: boolean;
|
|
350
|
+
/** What the user has typed into the composer so far. */
|
|
351
|
+
draft: string;
|
|
352
|
+
/** Send `text` as the user's next message. Does nothing while `disabled`. */
|
|
353
|
+
send: (text: string) => void;
|
|
354
|
+
/** Replace the composer's text with `text` and focus it, for a prompt the user finishes. */
|
|
355
|
+
setDraft: (text: string) => void;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* One control inside the composer, registered in `components.composerTools`.
|
|
360
|
+
*/
|
|
361
|
+
export declare interface ComposerToolConfig {
|
|
362
|
+
/** Stable, unique key for the control. */
|
|
363
|
+
id: string;
|
|
364
|
+
/** The control itself — usually an icon button; `PromptInputButton` matches the attach button. */
|
|
365
|
+
component: ComponentType<ComposerToolProps>;
|
|
366
|
+
/**
|
|
367
|
+
* Where it sits among the composer's tools. Lower comes first; equal values keep the order
|
|
368
|
+
* they were registered in. Defaults to `0`, so with no orders set the tools follow the
|
|
369
|
+
* order they were registered in.
|
|
370
|
+
*/
|
|
371
|
+
order?: number;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Props for a control registered in `components.composerTools`, drawn inside the composer
|
|
376
|
+
* beside the send button.
|
|
377
|
+
*/
|
|
378
|
+
export declare interface ComposerToolProps extends ComposerFooterProps {
|
|
379
|
+
/**
|
|
380
|
+
* Whether the viewport is phone-sized. The tools share a row with the text box, so every
|
|
381
|
+
* control there takes width from what the user is typing; keep to an icon on a phone.
|
|
382
|
+
*/
|
|
383
|
+
isMobile: boolean;
|
|
384
|
+
/**
|
|
385
|
+
* Attach files to the message being drafted, as the attach button does: each uploads at once.
|
|
386
|
+
* A file of a type the backend doesn't accept, or over its size limit, is refused with the
|
|
387
|
+
* same notice.
|
|
388
|
+
*/
|
|
389
|
+
addFiles: (files: File[]) => void;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/** A user's credits: what is left of what they were granted. Credits never reset. */
|
|
393
|
+
export declare function CreditsBar({ credits, action }: {
|
|
394
|
+
credits: CreditsStatus;
|
|
395
|
+
action?: ReactNode;
|
|
396
|
+
}): JSX.Element;
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* A custom section added to the settings sidebar and page by the host application.
|
|
400
|
+
*/
|
|
401
|
+
export declare interface CustomSettingsSection {
|
|
402
|
+
/** Unique identifier for the section (e.g. `'notifications'`, `'personalization'`). */
|
|
403
|
+
id: string;
|
|
404
|
+
/** Display title or translation key for the sidebar item and page heading. */
|
|
405
|
+
label: string;
|
|
406
|
+
/** Optional subtitle or translation key shown under the page heading. */
|
|
407
|
+
subtitle?: string;
|
|
408
|
+
/**
|
|
409
|
+
* Sidebar group this section belongs to: `'account'`, `'general'`, or a custom group title /
|
|
410
|
+
* translation key. Defaults to `'general'`.
|
|
411
|
+
*/
|
|
412
|
+
group?: string;
|
|
413
|
+
/** Optional icon rendered beside the label in the sidebar and popover menu. */
|
|
414
|
+
icon?: LucideIcon;
|
|
415
|
+
/** Whether to also show a shortcut to this section in the floating settings popover menu. */
|
|
416
|
+
showInMenu?: boolean;
|
|
417
|
+
/** Component rendered in the main settings page when this section is active. */
|
|
418
|
+
component: ComponentType;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Mirrors Gentiq's state onto the page, for an app whose whole page is Gentiq, such as the
|
|
423
|
+
* starter: `<html lang>` and `dir` follow the chat's language, `<html>` gets the theme's `light`
|
|
424
|
+
* or `dark` class and `color-scheme`, the title is `app.name`, and the favicon `app.favicon`.
|
|
425
|
+
* Gentiq writes none of these unless this is rendered, inside `GentiqProvider`. Each goes back
|
|
426
|
+
* to what it was when this unmounts.
|
|
427
|
+
*/
|
|
428
|
+
export declare function DocumentSync(): null;
|
|
429
|
+
|
|
430
|
+
/** Fields available in the Feedback section. */
|
|
431
|
+
export declare interface FeedbackSettingsFields {
|
|
432
|
+
category?: SettingsFieldMode;
|
|
433
|
+
attachment?: SettingsFieldMode;
|
|
434
|
+
[key: string]: SettingsFieldMode | undefined;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/** The built-in renderer of `file` parts: an image's preview, or a file to download. */
|
|
438
|
+
export declare function FilePart({ part }: FilePartProps): JSX.Element;
|
|
439
|
+
|
|
440
|
+
/** Props for `FilePart`, the built-in renderer of `file` parts. */
|
|
441
|
+
export declare type FilePartProps = PartProps<FileUIPart>;
|
|
442
|
+
|
|
443
|
+
/** Clickable next messages emitted by the assistant's follow-up signal. */
|
|
444
|
+
export declare function FollowUpSuggestions({ suggestions, disabled, onSelect, className, }: FollowUpSuggestionsProps): JSX.Element;
|
|
445
|
+
|
|
446
|
+
/** Suggested messages the user may send after a completed assistant response. */
|
|
447
|
+
declare interface FollowUpSuggestions_2 {
|
|
448
|
+
/** One to three concise messages, displayed and sent verbatim. */
|
|
449
|
+
suggestions: string[];
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/** Props for the follow-up suggestion row beneath the latest assistant response. */
|
|
453
|
+
export declare interface FollowUpSuggestionsProps extends FollowUpSuggestions_2 {
|
|
454
|
+
/** Whether suggestions are temporarily non-interactive. */
|
|
455
|
+
disabled?: boolean;
|
|
456
|
+
/** Submit the selected suggestion as the next user message. */
|
|
457
|
+
onSelect?: (suggestion: string) => void | Promise<void>;
|
|
458
|
+
/** Custom CSS classes for the row wrapper. */
|
|
459
|
+
className?: string;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/** Fields available in the General section. */
|
|
463
|
+
export declare interface GeneralSettingsFields {
|
|
464
|
+
theme?: SettingsFieldMode;
|
|
465
|
+
language?: SettingsFieldMode;
|
|
466
|
+
[key: string]: SettingsFieldMode | undefined;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* A whole chat app on the browser's URL: sign-in, the chat with its sidebar, shared
|
|
471
|
+
* conversations and, when given, the admin panel. It owns the page, so it also keeps the
|
|
472
|
+
* document's language, theme, title and favicon in step (`DocumentSync`).
|
|
473
|
+
*
|
|
474
|
+
* Takes every `GentiqProvider` and `GentiqUI` option. For a chat inside a page of your own, use
|
|
475
|
+
* those two with `ChatLayout` instead.
|
|
476
|
+
*/
|
|
477
|
+
export declare function GentiqChatApp({ url, api, basePath, paths, admin, components, history, welcome, threadActions, composer, disclaimer, settings, ...provider }: GentiqChatAppProps): JSX.Element | null;
|
|
478
|
+
|
|
479
|
+
/** Where `GentiqChatApp`'s screens live, each relative to its `basePath`. */
|
|
480
|
+
export declare interface GentiqChatAppPaths {
|
|
481
|
+
/** The chat: this path for a new thread, `<chat>/<id>` for a stored one. Defaults to `/chat`. */
|
|
482
|
+
chat?: string;
|
|
483
|
+
/** The sign-in page signed-out visitors are sent to. Defaults to `/login`. */
|
|
484
|
+
login?: string;
|
|
485
|
+
/** A shared conversation, at `<shared>/<shareId>`. Defaults to `/shared`. */
|
|
486
|
+
shared?: string;
|
|
487
|
+
/**
|
|
488
|
+
* The admin panel, when `GentiqChatApp` has one. Defaults to `/admin`. Give the panel the same
|
|
489
|
+
* full path (`basePath` included) as its own `path`.
|
|
490
|
+
*/
|
|
491
|
+
admin?: string;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/** Props of {@link GentiqChatApp}: its own, and every `GentiqProvider` and `GentiqUI` option. */
|
|
495
|
+
export declare interface GentiqChatAppProps extends Omit<GentiqProviderProps, 'api' | 'children'>, Omit<GentiqUIProps, 'children'> {
|
|
496
|
+
/** Where the backend's API is mounted, such as `/api` or `https://chat.example.com/api`. */
|
|
497
|
+
url: string;
|
|
498
|
+
/** The rest of the connection: auth adapter, timeout, `fetch`, attachment URLs. */
|
|
499
|
+
api?: Omit<ApiConfig, 'basePath'>;
|
|
500
|
+
/** Where the app is mounted on the site. Every path below is under it. Defaults to `/`. */
|
|
501
|
+
basePath?: string;
|
|
502
|
+
/** Where each screen lives, under `basePath`. */
|
|
503
|
+
paths?: GentiqChatAppPaths;
|
|
504
|
+
/**
|
|
505
|
+
* The admin panel, shown at `paths.admin`, such as `@gentiq/admin`'s `AdminPanel` loaded with
|
|
506
|
+
* `React.lazy` so chat users never download it. Leave it out for no admin panel.
|
|
507
|
+
*/
|
|
508
|
+
admin?: ReactNode;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Override any UI component in ChatLayout/Chat without forking the framework.
|
|
513
|
+
*
|
|
514
|
+
* @example
|
|
515
|
+
* <ChatLayout
|
|
516
|
+
* components={{
|
|
517
|
+
* WelcomeScreen: MyBrandedWelcome,
|
|
518
|
+
* parts: { text: MyBubble, 'tool-get_weather': WeatherCard, 'data-chart': Chart },
|
|
519
|
+
* }}
|
|
520
|
+
* />
|
|
521
|
+
*/
|
|
522
|
+
export declare interface GentiqComponents {
|
|
523
|
+
/**
|
|
524
|
+
* Replaces the entire scrollable message list. It shows the thread of the enclosing
|
|
525
|
+
* `Thread.Root`: compose `Thread.Viewport`, `Thread.Messages` and the message primitives.
|
|
526
|
+
*/
|
|
527
|
+
MessageList?: ComponentType<MessageListProps>;
|
|
528
|
+
/**
|
|
529
|
+
* Replaces the row of actions under each message (copy, retry, feedback, edit), leaving the
|
|
530
|
+
* message itself as it is. It renders inside the message's scope: read the message with
|
|
531
|
+
* `useMessage()` and compose `ActionBar.*`.
|
|
532
|
+
*/
|
|
533
|
+
MessageActions?: ComponentType<MessageActionsProps>;
|
|
534
|
+
/** Replaces the entire prompt input area */
|
|
535
|
+
PromptInput?: ComponentType<PromptInputProps>;
|
|
536
|
+
/** Replaces the welcome / empty-state screen */
|
|
537
|
+
WelcomeScreen?: ComponentType<WelcomeScreenProps>;
|
|
538
|
+
/**
|
|
539
|
+
* Replaces the pending-reply and thread-loading indicator with a custom loader component.
|
|
540
|
+
*/
|
|
541
|
+
Loader?: ComponentType<LoaderProps>;
|
|
542
|
+
/**
|
|
543
|
+
* The component for each part type, over Gentiq's: `text`, `reasoning`, `file`, `tool` (any tool
|
|
544
|
+
* call without its own), `tool-<name>` (one tool's calls), `data-<name>` (a part the backend
|
|
545
|
+
* streams with `ctx.deps.emit(name, payload)`), or `null` to render nothing for a type. Each
|
|
546
|
+
* renders inside the message's scope, with an error boundary around it; tool calls and files
|
|
547
|
+
* also get a quote button. Write tool and data components with `defineToolUI` and
|
|
548
|
+
* `defineDataUI`.
|
|
549
|
+
*
|
|
550
|
+
* @example
|
|
551
|
+
* ```tsx
|
|
552
|
+
* parts: {
|
|
553
|
+
* 'tool-get_weather': defineToolUI<{ city: string }, { temp: number }>(({ part }) =>
|
|
554
|
+
* part.state === 'output-available' ? <p>{part.output.temp}°</p> : null,
|
|
555
|
+
* ),
|
|
556
|
+
* }
|
|
557
|
+
* ```
|
|
558
|
+
*/
|
|
559
|
+
parts?: MessagePartComponents;
|
|
560
|
+
/** Replaces the multiple-choice question renderer used for past questions */
|
|
561
|
+
ChoiceQuestionPart?: ComponentType<ChoiceQuestionPartProps>;
|
|
562
|
+
/** Replaces the pending choice question docked on top of the composer */
|
|
563
|
+
ChoiceQuestionDock?: ComponentType<ChoiceQuestionDockProps>;
|
|
564
|
+
/** Replaces the clickable follow-up row beneath the latest assistant response. */
|
|
565
|
+
FollowUpSuggestions?: ComponentType<FollowUpSuggestionsProps>;
|
|
566
|
+
/**
|
|
567
|
+
* Your own content directly beneath the composer — prompt suggestions on the new-chat
|
|
568
|
+
* screen, as in ChatGPT, or mode toggles and quick actions. Empty by default. Rendered by
|
|
569
|
+
* the built-in composer; a custom `PromptInput` renders it itself, if at all.
|
|
570
|
+
*
|
|
571
|
+
* @example
|
|
572
|
+
* ```tsx
|
|
573
|
+
* ComposerFooter: ({ newChat, disabled, send }) =>
|
|
574
|
+
* newChat ? (
|
|
575
|
+
* <Suggestions className="mx-auto pt-3">
|
|
576
|
+
* {['Plan a trip', 'Summarize a PDF'].map((s) => (
|
|
577
|
+
* <Suggestion key={s} suggestion={s} onClick={send} disabled={disabled} />
|
|
578
|
+
* ))}
|
|
579
|
+
* </Suggestions>
|
|
580
|
+
* ) : null
|
|
581
|
+
* ```
|
|
582
|
+
*/
|
|
583
|
+
ComposerFooter?: ComponentType<ComposerFooterProps>;
|
|
584
|
+
/**
|
|
585
|
+
* Your own controls inside the composer, beside the send button — a prompt library, a
|
|
586
|
+
* shortcut that fills in a prompt. A tool can change the draft and attach files, but
|
|
587
|
+
* cannot send anything with a message besides its text. Each is placed by its `order`
|
|
588
|
+
* against the others.
|
|
589
|
+
* The attach button isn't among them; it leads the text box. Rendered by the built-in
|
|
590
|
+
* composer; a custom `PromptInput` renders them itself, if at all.
|
|
591
|
+
*
|
|
592
|
+
* @example
|
|
593
|
+
* ```tsx
|
|
594
|
+
* composerTools: [
|
|
595
|
+
* {
|
|
596
|
+
* id: 'surprise',
|
|
597
|
+
* component: ({ disabled, setDraft }) => (
|
|
598
|
+
* <PromptInputButton disabled={disabled} onClick={() => setDraft('Surprise me')}>
|
|
599
|
+
* <Dices className="size-4" />
|
|
600
|
+
* </PromptInputButton>
|
|
601
|
+
* ),
|
|
602
|
+
* },
|
|
603
|
+
* ]
|
|
604
|
+
* ```
|
|
605
|
+
*/
|
|
606
|
+
composerTools?: ComposerToolConfig[];
|
|
607
|
+
/**
|
|
608
|
+
* Replaces the notice shown under the transcript when a turn fails — e.g. an upgrade card
|
|
609
|
+
* when `code` is `'quota_exceeded'`, `'credits_exhausted'` or `'plan_expired'`. Render the
|
|
610
|
+
* exported `ChatError` for the codes you don't handle.
|
|
611
|
+
*/
|
|
612
|
+
ChatError?: ComponentType<ChatErrorProps>;
|
|
613
|
+
/**
|
|
614
|
+
* Extra controls in the top bar, placed before the usage meter, new-chat and settings
|
|
615
|
+
* buttons — e.g. an "Upgrade" button. Not rendered on shared-chat pages. Read the user's
|
|
616
|
+
* access with `useGentiqEntitlement()` to decide whether to show anything.
|
|
617
|
+
*/
|
|
618
|
+
HeaderActions?: ComponentType<HeaderActionsProps>;
|
|
619
|
+
/**
|
|
620
|
+
* The same thing, but as named entries an admin can switch on and off from the admin panel
|
|
621
|
+
* (Settings › Chat). They render after {@link GentiqComponents.HeaderActions}, in the order
|
|
622
|
+
* given here. Only register an action once — the admin panel keys its toggle off `id`.
|
|
623
|
+
*/
|
|
624
|
+
headerActions?: HeaderActionConfig[];
|
|
625
|
+
/**
|
|
626
|
+
* Replaces the usage meter in the top bar. Render the exported `UsageMeter` to keep the
|
|
627
|
+
* built-in pill and decide yourself when it shows — return `null` to hide it for the current
|
|
628
|
+
* user, route, plan or anything else your app knows. Rendered only while
|
|
629
|
+
* `app.showUsageBar` is on, so an admin can still switch it off for everyone.
|
|
630
|
+
*/
|
|
631
|
+
UsageMeter?: ComponentType<UsageMeterProps>;
|
|
632
|
+
/**
|
|
633
|
+
* Replaces the strip shown above the chat while maintenance is on and its display is
|
|
634
|
+
* `banner`. `null` shows nothing (the composer is still disabled while the backend refuses
|
|
635
|
+
* messages).
|
|
636
|
+
*/
|
|
637
|
+
MaintenanceBanner?: ComponentType<MaintenanceNoticeProps> | null;
|
|
638
|
+
/**
|
|
639
|
+
* Replaces the page shown in place of the chat while maintenance is on and its display is
|
|
640
|
+
* `fullscreen`. `null` falls back to the banner.
|
|
641
|
+
*/
|
|
642
|
+
MaintenanceScreen?: ComponentType<MaintenanceNoticeProps> | null;
|
|
643
|
+
/**
|
|
644
|
+
* Per-tool/card reference display adapters.
|
|
645
|
+
* Return label/excerpt/data overrides used in composer chips, sent context,
|
|
646
|
+
* and reference badges.
|
|
647
|
+
*
|
|
648
|
+
* @example
|
|
649
|
+
* ```ts
|
|
650
|
+
* referenceAdapters: {
|
|
651
|
+
* get_weather: ({ part }) => ({
|
|
652
|
+
* label: 'Weather',
|
|
653
|
+
* excerpt: `Weather: ${part.output.city}: ${part.output.condition}`,
|
|
654
|
+
* }),
|
|
655
|
+
* }
|
|
656
|
+
* ```
|
|
657
|
+
*/
|
|
658
|
+
referenceAdapters?: Record<string, ReferenceAdapter>;
|
|
659
|
+
/** Custom components mapping for markdown rendering overrides. */
|
|
660
|
+
textComponents?: StreamdownProps['components'];
|
|
661
|
+
/** Custom remark plugins for markdown parsing. */
|
|
662
|
+
remarkPlugins?: StreamdownProps['remarkPlugins'];
|
|
663
|
+
/** Custom rehype plugins for markdown parsing. */
|
|
664
|
+
rehypePlugins?: StreamdownProps['rehypePlugins'];
|
|
665
|
+
/**
|
|
666
|
+
* Extra URL schemes a markdown link may carry, without the `:`.
|
|
667
|
+
*
|
|
668
|
+
* Links are sanitized down to the schemes the renderer allows (`http`,
|
|
669
|
+
* `https`, `mailto`, `irc`, `ircs`, `xmpp`, `tel`); anything else loses its
|
|
670
|
+
* `href` and renders as `text [blocked]`. List a scheme here to render app
|
|
671
|
+
* components off links that use it:
|
|
672
|
+
*
|
|
673
|
+
* ```tsx
|
|
674
|
+
* linkProtocols: ['carcard'],
|
|
675
|
+
* textComponents: {
|
|
676
|
+
* a: (props) =>
|
|
677
|
+
* props.href?.startsWith('carcard://')
|
|
678
|
+
* ? <CarCard id={props.href.slice('carcard://'.length)} />
|
|
679
|
+
* : <a {...props} />,
|
|
680
|
+
* }
|
|
681
|
+
* ```
|
|
682
|
+
*
|
|
683
|
+
* `javascript:`, `data:`, `vbscript:` and `file:` are always blocked.
|
|
684
|
+
*/
|
|
685
|
+
linkProtocols?: string[];
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Gentiq's runtime (`GentiqRuntimeProvider`) with the default UI's pieces: a loading screen until
|
|
690
|
+
* `/config` settles, a toaster, the built-in part renderers for a message list outside any
|
|
691
|
+
* `GentiqUI`, and a toast when `/config` can't be fetched (unless `onConfigUnavailable` is given).
|
|
692
|
+
*/
|
|
693
|
+
export declare function GentiqProvider({ toaster, fallback, onConfigUnavailable, children, ...props }: GentiqProviderProps): JSX.Element;
|
|
694
|
+
|
|
695
|
+
export declare interface GentiqProviderProps extends Omit<GentiqRuntimeProviderProps, 'overlay'> {
|
|
696
|
+
/**
|
|
697
|
+
* Whether Gentiq renders its own toaster for its notices (a failed upload, a refused rename).
|
|
698
|
+
* Set to `false` when the app already renders sonner's `<Toaster />`: Gentiq's toasts then show
|
|
699
|
+
* in the app's, since both use sonner's one toast store. Defaults to `true`.
|
|
700
|
+
*/
|
|
701
|
+
toaster?: boolean;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* The element Gentiq's styles apply inside. It carries the theme (`dark` or `light`), the
|
|
706
|
+
* language and its direction, and the `theme` option's accent, radius and font as
|
|
707
|
+
* `--gentiq-*` tokens, all read from the enclosing `GentiqProvider`, and holds the container
|
|
708
|
+
* that dialogs, menus and tooltips portal into. It renders no box of its own
|
|
709
|
+
* (`display: contents`), so what it wraps sits in your layout where you put it.
|
|
710
|
+
*
|
|
711
|
+
* `Chat`, `ChatLayout`, `AdminPanel`, `UserLoginPage` and `SharedChatView` render one for
|
|
712
|
+
* themselves. Wrap your own layout in one when it places Gentiq's styled components, such as
|
|
713
|
+
* `AppSidebar` or `SettingsDialog`, outside those. Restyle Gentiq by setting `--gentiq-*`
|
|
714
|
+
* variables on `.gentiq` in your stylesheet.
|
|
715
|
+
*/
|
|
716
|
+
export declare const GentiqRoot: ForwardRefExoticComponent<GentiqRootProps & RefAttributes<HTMLDivElement>>;
|
|
717
|
+
|
|
718
|
+
/** A `div`'s props: they reach the root element, beside the theme, language and tokens it sets. */
|
|
719
|
+
export declare type GentiqRootProps = HTMLAttributes<HTMLDivElement>;
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* The presentational options and slots for the Gentiq UI inside it: the chat, the sidebar, the
|
|
723
|
+
* settings dialog and the admin panel. Place it inside `GentiqProvider`. Without one, the UI
|
|
724
|
+
* uses Gentiq's defaults with the admin's settings on top.
|
|
725
|
+
*
|
|
726
|
+
* A `GentiqUI` inside another changes only what it sets, so one part of a page can differ.
|
|
727
|
+
*/
|
|
728
|
+
export declare function GentiqUI({ components, children, history, welcome, threadActions, composer, disclaimer, settings, }: GentiqUIProps): JSX.Element;
|
|
729
|
+
|
|
730
|
+
/**
|
|
731
|
+
* The presentational options in force, as `useGentiqUIOptions` reads them: the app's, with the
|
|
732
|
+
* admin's settings from `/config` on top and Gentiq's defaults filled in.
|
|
733
|
+
*/
|
|
734
|
+
export declare interface GentiqUIOptions {
|
|
735
|
+
history: Required<HistoryConfig>;
|
|
736
|
+
welcome: WelcomeScreenConfig;
|
|
737
|
+
threadActions: Required<ThreadItemActionsConfig>;
|
|
738
|
+
/**
|
|
739
|
+
* The composer. `voice.enabled` already says whether the backend can transcribe, and stays
|
|
740
|
+
* `false` until `/config` has said so.
|
|
741
|
+
*/
|
|
742
|
+
composer: ComposerConfig;
|
|
743
|
+
disclaimer: string | ReactNode | undefined;
|
|
744
|
+
settings: SettingsConfig;
|
|
745
|
+
/**
|
|
746
|
+
* The admin's on/off choice per registered header action. An id missing here has never been
|
|
747
|
+
* toggled and falls back to the entry's `defaultEnabled`.
|
|
748
|
+
*/
|
|
749
|
+
headerActionsEnabled: Record<string, boolean> | undefined;
|
|
750
|
+
/** The options as the app's code passed them, before the admin's settings. */
|
|
751
|
+
configured: GentiqUIOptionsInput;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
/** The presentational options `GentiqUI` takes, as the app's code passes them. */
|
|
755
|
+
export declare interface GentiqUIOptionsInput {
|
|
756
|
+
/** The sidebar's thread history. */
|
|
757
|
+
history?: HistoryConfig;
|
|
758
|
+
/** The welcome screen. */
|
|
759
|
+
welcome?: WelcomeScreenConfig;
|
|
760
|
+
/** The actions under each answer. */
|
|
761
|
+
threadActions?: ThreadItemActionsConfig;
|
|
762
|
+
/** The composer. */
|
|
763
|
+
composer?: ComposerConfig;
|
|
764
|
+
/** A line under the composer, as text, a translation key, or a node. */
|
|
765
|
+
disclaimer?: string | ReactNode;
|
|
766
|
+
/** The settings dialog's sections and fields. */
|
|
767
|
+
settings?: SettingsConfig;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
export declare interface GentiqUIProps extends GentiqUIOptionsInput {
|
|
771
|
+
/** Replaces built-in components. A slot left out keeps the one from the `GentiqUI` above. */
|
|
772
|
+
components?: GentiqComponents;
|
|
773
|
+
children?: ReactNode;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* One named top-bar control, registered in `components.headerActions`.
|
|
778
|
+
*
|
|
779
|
+
* Registering an action rather than passing the bare {@link GentiqComponents.HeaderActions}
|
|
780
|
+
* slot puts it in the admin panel: Settings › Chat grows a toggle per entry, so an admin can
|
|
781
|
+
* show or hide it at runtime without a deploy. The component itself decides nothing about
|
|
782
|
+
* that — it is simply not rendered while the toggle is off.
|
|
783
|
+
*/
|
|
784
|
+
export declare interface HeaderActionConfig {
|
|
785
|
+
/** Stable key the admin's choice is stored under. Renaming it resets that choice. */
|
|
786
|
+
id: string;
|
|
787
|
+
/** The control itself. */
|
|
788
|
+
component: ComponentType<HeaderActionsProps>;
|
|
789
|
+
/** The name the admin's toggle carries — plain text, or an i18n key like `chat:upgrade_plan`. */
|
|
790
|
+
label: string;
|
|
791
|
+
/** An optional line under that name explaining what the control does. */
|
|
792
|
+
help?: string;
|
|
793
|
+
/** Whether it shows before an admin has ever touched the toggle. Defaults to `true`. */
|
|
794
|
+
defaultEnabled?: boolean;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* Props for the HeaderActions slot, rendered at the start of the top bar's action buttons.
|
|
799
|
+
*/
|
|
800
|
+
export declare interface HeaderActionsProps {
|
|
801
|
+
/**
|
|
802
|
+
* Whether the viewport is phone-sized.
|
|
803
|
+
*/
|
|
804
|
+
isMobile: boolean;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* Configuration for the chat history sidebar.
|
|
809
|
+
*/
|
|
810
|
+
export declare interface HistoryConfig {
|
|
811
|
+
/** Whether the history sidebar is enabled. */
|
|
812
|
+
enabled?: boolean;
|
|
813
|
+
/** Whether to show the delete action for threads. */
|
|
814
|
+
showDelete?: boolean;
|
|
815
|
+
/** Whether to show the rename action for threads. */
|
|
816
|
+
showRename?: boolean;
|
|
817
|
+
/** Whether to show the share action for threads. */
|
|
818
|
+
showShare?: boolean;
|
|
819
|
+
/** Whether to show the pin action for threads. */
|
|
820
|
+
showPin?: boolean;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
declare type LoaderProps = HTMLAttributes<HTMLDivElement> & {
|
|
824
|
+
size?: number;
|
|
825
|
+
/**
|
|
826
|
+
* Indicator variant. Retained for compatibility with custom renderers;
|
|
827
|
+
* Gentiq's built-in loader renders a three-dot acrobatic loop.
|
|
828
|
+
*/
|
|
829
|
+
variant?: string;
|
|
830
|
+
};
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* The strip shown above the chat while maintenance is on. Replace it with
|
|
834
|
+
* `components.MaintenanceBanner`.
|
|
835
|
+
*/
|
|
836
|
+
export declare function MaintenanceBanner({ title, message, endsAt }: MaintenanceNoticeProps): JSX.Element;
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* Props for the `MaintenanceBanner` and `MaintenanceScreen` slots.
|
|
840
|
+
*/
|
|
841
|
+
export declare interface MaintenanceNoticeProps {
|
|
842
|
+
/** The raw status, for anything the resolved fields below leave out. */
|
|
843
|
+
status: MaintenanceStatus;
|
|
844
|
+
/** The title to show: the admin's, else `maintenance.title` from the config, else the default. */
|
|
845
|
+
title: string;
|
|
846
|
+
/** The message to show, resolved the same way. */
|
|
847
|
+
message: string;
|
|
848
|
+
/** When maintenance is expected to end, if the admin said. */
|
|
849
|
+
endsAt?: Date;
|
|
850
|
+
/** Whether new messages are refused meanwhile. */
|
|
851
|
+
blocksChat: boolean;
|
|
852
|
+
/** Check the status again now. */
|
|
853
|
+
refresh: () => void;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* The page shown in place of the chat while maintenance is on and its display is
|
|
858
|
+
* `fullscreen`. Replace it with `components.MaintenanceScreen`.
|
|
859
|
+
*/
|
|
860
|
+
export declare function MaintenanceScreen({ title, message, endsAt, refresh }: MaintenanceNoticeProps): JSX.Element;
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* The row under a message: copy, and the retry, feedback and edit actions the options turn on.
|
|
864
|
+
* Read the message with `useMessage()`; the row is built from `ActionBar.*`.
|
|
865
|
+
*/
|
|
866
|
+
export declare function MessageActions({ retry, feedback, edit }: MessageActionsProps): JSX.Element;
|
|
867
|
+
|
|
868
|
+
/** Props for the row of actions under a message: which of them the app's options turn on. */
|
|
869
|
+
export declare interface MessageActionsProps {
|
|
870
|
+
/** Whether to offer to retry the last answer (`threadActions.retry`). */
|
|
871
|
+
retry: boolean;
|
|
872
|
+
/** Whether to offer feedback on answers (`threadActions.feedback`). */
|
|
873
|
+
feedback: boolean;
|
|
874
|
+
/** Whether to offer to edit the last message the user sent (`threadActions.edit`). */
|
|
875
|
+
edit: boolean;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* The built-in transcript: the messages of the thread the enclosing `Thread.Root` shows, with
|
|
880
|
+
* the pending indicator, progress notes and the turn's error, built from `Thread.*`, `Message.*`
|
|
881
|
+
* and the `MessageActions` slot.
|
|
882
|
+
*/
|
|
883
|
+
export declare function MessageList({ className }: MessageListProps): JSX.Element;
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* Props for the MessageList component: the scrollable transcript of the thread the enclosing
|
|
887
|
+
* `Thread.Root` shows.
|
|
888
|
+
*/
|
|
889
|
+
export declare interface MessageListProps {
|
|
890
|
+
/** Custom CSS class names. */
|
|
891
|
+
className?: string;
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
/** Fields available in the Profile section. */
|
|
895
|
+
export declare interface ProfileSettingsFields {
|
|
896
|
+
name?: SettingsFieldMode;
|
|
897
|
+
surname?: SettingsFieldMode;
|
|
898
|
+
phone?: SettingsFieldMode;
|
|
899
|
+
password?: SettingsFieldMode;
|
|
900
|
+
/**
|
|
901
|
+
* Additional custom metadata fields.
|
|
902
|
+
* Keys must match the 'key' property in UserMetadataField.
|
|
903
|
+
*/
|
|
904
|
+
[key: string]: SettingsFieldMode | undefined;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
export declare function PromptInputArea({ onSend, status, isErrorVisible, threadId, newChat, className, }: PromptInputProps): JSX.Element;
|
|
908
|
+
|
|
909
|
+
export declare const PromptInputButton: ({ variant, className, size, ...props }: PromptInputButtonProps) => JSX.Element;
|
|
910
|
+
|
|
911
|
+
export declare type PromptInputButtonProps = ComponentProps<typeof Button>;
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* Props for the PromptInput component, where the user types messages.
|
|
915
|
+
*/
|
|
916
|
+
export declare interface PromptInputProps {
|
|
917
|
+
/** Sends a message: `useThread().send`. */
|
|
918
|
+
onSend: (message: SendMessageInput) => void;
|
|
919
|
+
/** Current chat status. */
|
|
920
|
+
status: ChatStatus;
|
|
921
|
+
/** Whether to show the error message. */
|
|
922
|
+
isErrorVisible: boolean;
|
|
923
|
+
/** The thread's id, or `null` for a new thread. */
|
|
924
|
+
threadId?: string | null;
|
|
925
|
+
/** Whether this is the centered new-chat composer (enables the animated placeholder). */
|
|
926
|
+
newChat?: boolean;
|
|
927
|
+
/** Custom CSS class names. */
|
|
928
|
+
className?: string;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
/** One allowance: what is left of it, a bar, and when it starts over. */
|
|
932
|
+
export declare function QuotaBar({ label, detail, meter, remaining, amount, resetsAt, action, }: QuotaBarProps): JSX.Element;
|
|
933
|
+
|
|
934
|
+
declare interface QuotaBarProps {
|
|
935
|
+
label: ReactNode;
|
|
936
|
+
/** Shown next to the label, e.g. "per day". */
|
|
937
|
+
detail?: ReactNode;
|
|
938
|
+
meter: string;
|
|
939
|
+
remaining: number;
|
|
940
|
+
amount: number;
|
|
941
|
+
resetsAt?: string | null;
|
|
942
|
+
/** Rendered after the figures, e.g. an admin's reset button. */
|
|
943
|
+
action?: ReactNode;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
/** One bar per usage window of a plan: how much is left, and when it starts over. */
|
|
947
|
+
export declare function QuotaWindows({ windows, className, renderAction }: QuotaWindowsProps): JSX.Element;
|
|
948
|
+
|
|
949
|
+
declare interface QuotaWindowsProps {
|
|
950
|
+
windows: EntitlementWindow[];
|
|
951
|
+
className?: string;
|
|
952
|
+
/** Rendered at the end of each row, e.g. an admin's reset button. */
|
|
953
|
+
renderAction?: (window: EntitlementWindow) => ReactNode;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* The built-in renderer of `reasoning` parts: a collapsible block, open while it's written. Shows
|
|
958
|
+
* nothing for a part with no text, as a model that reasons without a summary leaves.
|
|
959
|
+
*/
|
|
960
|
+
export declare function ReasoningPart({ part }: ReasoningPartProps): JSX.Element | null;
|
|
961
|
+
|
|
962
|
+
/** Props for `ReasoningPart`, the built-in renderer of `reasoning` parts. */
|
|
963
|
+
export declare type ReasoningPartProps = PartProps<ReasoningUIPart>;
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* A quotable card, inside `Chat`: `References.Source` with the built-in quote button in its
|
|
967
|
+
* corner, shown on hover and keyboard focus.
|
|
968
|
+
*/
|
|
969
|
+
export declare function Referenceable({ showAction, className, children, ...props }: ReferenceableProps): JSX.Element;
|
|
970
|
+
|
|
971
|
+
/** Props for `Referenceable`: `References.Source`'s, and whether to show the quote button. */
|
|
972
|
+
export declare interface ReferenceableProps extends ReferencesSourceProps {
|
|
973
|
+
/** Whether to show the quote button on hover and focus. Selected text can be quoted either way. */
|
|
974
|
+
showAction?: boolean;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
/** The built-in renderer of `data-reference` parts: a quote the user sent, which finds its source. */
|
|
978
|
+
export declare function ReferencePart({ part }: ReferencePartProps): JSX.Element;
|
|
979
|
+
|
|
980
|
+
/** Props for `ReferencePart`, the built-in renderer of `data-reference` parts. */
|
|
981
|
+
export declare type ReferencePartProps = PartProps<Extract<GentiqMessagePart, {
|
|
982
|
+
type: 'data-reference';
|
|
983
|
+
}>>;
|
|
984
|
+
|
|
985
|
+
/** Shows `children` to a signed-in user, and `fallback` to anyone else. */
|
|
986
|
+
export declare function RequireAuth({ children, fallback, loginCode, onLoginCodeUsed }: RequireAuthProps): JSX.Element;
|
|
987
|
+
|
|
988
|
+
export declare interface RequireAuthProps {
|
|
989
|
+
children: ReactNode;
|
|
990
|
+
/**
|
|
991
|
+
* What to show instead of `children` when there is no usable session: a redirect to your
|
|
992
|
+
* sign-in page, or, for users who only ever arrive from another platform, a screen that asks
|
|
993
|
+
* the embedding page for a fresh login code.
|
|
994
|
+
*/
|
|
995
|
+
fallback: ReactNode | ((reason: UnauthenticatedReason) => ReactNode);
|
|
996
|
+
/**
|
|
997
|
+
* A single-use login code from the integration API, such as the URL's `?code=`, to exchange
|
|
998
|
+
* for a session before checking it. `useRouterLoginCode()` from `gentiq/react-router` reads it
|
|
999
|
+
* from the URL.
|
|
1000
|
+
*/
|
|
1001
|
+
loginCode?: string | null;
|
|
1002
|
+
/** Called once the login code is exchanged, to take it out of the URL. */
|
|
1003
|
+
onLoginCodeUsed?: () => void;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
export declare type ResolvedSmoothStreaming = Required<UseSmoothTextOptions>;
|
|
1007
|
+
|
|
1008
|
+
declare function ScrollArea({ className, children, ...props }: React_2.ComponentProps<typeof ScrollAreaPrimitive.Root>): JSX.Element;
|
|
1009
|
+
|
|
1010
|
+
/**
|
|
1011
|
+
* Configuration for the settings dialog sections, popover menu, and custom sections.
|
|
1012
|
+
*/
|
|
1013
|
+
export declare interface SettingsConfig {
|
|
1014
|
+
/** Section-specific configurations. */
|
|
1015
|
+
sections?: {
|
|
1016
|
+
/** General settings section (Theme, Language) */
|
|
1017
|
+
general?: SettingsSectionConfig<GeneralSettingsFields>;
|
|
1018
|
+
/** Profile settings section (Name, Phone, etc.) */
|
|
1019
|
+
profile?: SettingsSectionConfig<ProfileSettingsFields>;
|
|
1020
|
+
/** Account settings section (Balance, Logout, etc.) */
|
|
1021
|
+
account?: SettingsSectionConfig<AccountSettingsFields>;
|
|
1022
|
+
/** Feedback settings section (Bug reports, Feature requests, etc.) */
|
|
1023
|
+
feedback?: SettingsSectionConfig<FeedbackSettingsFields>;
|
|
1024
|
+
};
|
|
1025
|
+
/** Which shortcuts and quick actions appear in the floating settings popover menu. */
|
|
1026
|
+
menu?: SettingsMenuConfig;
|
|
1027
|
+
/** Additional settings sections registered by the application. */
|
|
1028
|
+
customSections?: CustomSettingsSection[];
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
export declare function SettingsDialog({ trigger }: {
|
|
1032
|
+
trigger?: ReactNode;
|
|
1033
|
+
}): JSX.Element;
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* Controls which shortcuts and quick actions appear in the floating settings popover menu.
|
|
1037
|
+
*/
|
|
1038
|
+
export declare interface SettingsMenuConfig {
|
|
1039
|
+
/** Whether to show the signed-in user's header at the top of the popover menu. Defaults to `true`. */
|
|
1040
|
+
showUserHeader?: boolean;
|
|
1041
|
+
/** Whether to show a separate Profile item in the popover menu. Defaults to `false` (clicking the user header opens Profile). */
|
|
1042
|
+
showProfile?: boolean;
|
|
1043
|
+
/** Whether to show the Account & Usage item in the popover menu. Defaults to `true`. */
|
|
1044
|
+
showAccount?: boolean;
|
|
1045
|
+
/** Whether to show the Feedback item in the popover menu. Defaults to `true`. */
|
|
1046
|
+
showFeedback?: boolean;
|
|
1047
|
+
/** Whether to show the Settings item in the popover menu. Defaults to `true`. */
|
|
1048
|
+
showSettings?: boolean;
|
|
1049
|
+
/** Whether to show the inline Theme submenu in the popover menu. Defaults to `false`. */
|
|
1050
|
+
showTheme?: boolean;
|
|
1051
|
+
/** Whether to show the inline Language submenu in the popover menu. Defaults to `false`. */
|
|
1052
|
+
showLanguage?: boolean;
|
|
1053
|
+
/** Whether to show the Logout action in the popover menu. Defaults to `true`. */
|
|
1054
|
+
showLogout?: boolean;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* Configuration for a single settings section (tab).
|
|
1059
|
+
*/
|
|
1060
|
+
export declare interface SettingsSectionConfig<T = Record<string, SettingsFieldMode>> {
|
|
1061
|
+
/** Whether the entire section is enabled and visible. */
|
|
1062
|
+
enabled?: boolean;
|
|
1063
|
+
/** Display mode for the entire section. Overrides enabled if provided. */
|
|
1064
|
+
mode?: SettingsFieldMode;
|
|
1065
|
+
/**
|
|
1066
|
+
* Visibility and editability modes for individual fields in this section.
|
|
1067
|
+
*/
|
|
1068
|
+
fields?: T;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
/** A read-only view of a shared thread, for anyone with the link. */
|
|
1072
|
+
export declare function SharedChatView(props: SharedChatViewProps): JSX.Element;
|
|
1073
|
+
|
|
1074
|
+
export declare interface SharedChatViewProps {
|
|
1075
|
+
/** The share to show: the last segment of a share link, `/shared/<shareId>`. */
|
|
1076
|
+
shareId: string;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
export declare function SidebarProvider({ defaultOpen, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }: React_2.ComponentProps<'div'> & {
|
|
1080
|
+
defaultOpen?: boolean;
|
|
1081
|
+
open?: boolean;
|
|
1082
|
+
onOpenChange?: (open: boolean) => void;
|
|
1083
|
+
}): JSX.Element;
|
|
1084
|
+
|
|
1085
|
+
declare type StreamdownProps = ComponentProps<typeof Streamdown>;
|
|
1086
|
+
|
|
1087
|
+
export declare const Suggestion: ({ suggestion, onClick, className, variant, size, children, ...props }: SuggestionProps) => JSX.Element;
|
|
1088
|
+
|
|
1089
|
+
export declare type SuggestionProps = Omit<ComponentProps<typeof Button>, 'onClick'> & {
|
|
1090
|
+
suggestion: string;
|
|
1091
|
+
onClick?: (suggestion: string) => void;
|
|
1092
|
+
};
|
|
1093
|
+
|
|
1094
|
+
export declare const Suggestions: ({ className, children, ...props }: SuggestionsProps) => JSX.Element;
|
|
1095
|
+
|
|
1096
|
+
export declare type SuggestionsProps = ComponentProps<typeof ScrollArea>;
|
|
1097
|
+
|
|
1098
|
+
/**
|
|
1099
|
+
* The built-in renderer of `text` parts: a message bubble, markdown for the assistant and the
|
|
1100
|
+
* user's text as typed, quotable.
|
|
1101
|
+
*/
|
|
1102
|
+
export declare function TextPart({ part, index }: TextPartProps): JSX.Element | null;
|
|
1103
|
+
|
|
1104
|
+
/** Props for `TextPart`, the built-in renderer of `text` parts. */
|
|
1105
|
+
export declare type TextPartProps = PartProps<TextUIPart>;
|
|
1106
|
+
|
|
1107
|
+
/**
|
|
1108
|
+
* Configuration for actions available on individual chat bubbles.
|
|
1109
|
+
*/
|
|
1110
|
+
export declare interface ThreadItemActionsConfig {
|
|
1111
|
+
/** Whether to show the feedback (like/dislike) buttons. */
|
|
1112
|
+
feedback?: boolean;
|
|
1113
|
+
/** Whether to show the retry button on the last message. */
|
|
1114
|
+
retry?: boolean;
|
|
1115
|
+
/**
|
|
1116
|
+
* Whether to offer to edit the last message the user sent, which sends it again and drops the
|
|
1117
|
+
* answer to it. Defaults to `true`.
|
|
1118
|
+
*/
|
|
1119
|
+
edit?: boolean;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
* The built-in renderer of a tool call that has no component of its own (`tool` in
|
|
1124
|
+
* `components.parts`): a card with the call's name, input and output, shown only while
|
|
1125
|
+
* `app.showToolDetails` is on. A call that waits on the user's approval shows either way, open,
|
|
1126
|
+
* with buttons to approve or deny it.
|
|
1127
|
+
*/
|
|
1128
|
+
export declare function ToolPart({ part }: ToolPartProps): JSX.Element | null;
|
|
1129
|
+
|
|
1130
|
+
/** Props for `ToolPart`, the built-in renderer of tool calls without a component of their own. */
|
|
1131
|
+
export declare type ToolPartProps = PartProps<GentiqToolPart>;
|
|
1132
|
+
|
|
1133
|
+
export declare function Tooltip({ ...props }: React_2.ComponentProps<typeof TooltipPrimitive.Root>): JSX.Element;
|
|
1134
|
+
|
|
1135
|
+
export declare function TooltipContent({ className, sideOffset, children, ...props }: React_2.ComponentProps<typeof TooltipPrimitive.Content>): JSX.Element;
|
|
1136
|
+
|
|
1137
|
+
export declare function TooltipTrigger({ ...props }: React_2.ComponentProps<typeof TooltipPrimitive.Trigger>): JSX.Element;
|
|
1138
|
+
|
|
1139
|
+
/**
|
|
1140
|
+
* A pill in the top bar showing how much of their allowance the user has left: of the plan's
|
|
1141
|
+
* window with the smallest share left, or of their credits. Its bar drains from full to empty
|
|
1142
|
+
* beside the percentage left, and bar and outline turn amber, then red, as that runs out; once
|
|
1143
|
+
* nothing is left the whole pill turns red. With `details`, hovering or tapping it opens a card
|
|
1144
|
+
* with the length and share left of every window; without, it is not interactive. What each
|
|
1145
|
+
* counts, exact amounts and reset times are left to the settings dialog. Renders nothing for unlimited users, or until the allowance has loaded.
|
|
1146
|
+
*/
|
|
1147
|
+
export declare function UsageMeter({ className, details }: UsageMeterProps): JSX.Element | null;
|
|
1148
|
+
|
|
1149
|
+
/**
|
|
1150
|
+
* Props for the UsageMeter slot, the allowance pill in the top bar.
|
|
1151
|
+
*/
|
|
1152
|
+
export declare interface UsageMeterProps {
|
|
1153
|
+
className?: string;
|
|
1154
|
+
/**
|
|
1155
|
+
* Whether hovering or tapping the meter opens a card with the length and percentage left of
|
|
1156
|
+
* every limit. When `false`, the meter shows only its own percentage and opens nothing.
|
|
1157
|
+
* Defaults to `true`; the top bar passes `app.showUsageDetails`.
|
|
1158
|
+
*/
|
|
1159
|
+
details?: boolean;
|
|
1160
|
+
/** Whether the viewport is phone-sized. */
|
|
1161
|
+
isMobile?: boolean;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* Read the docked choice question. Outside a provider (a standalone message
|
|
1166
|
+
* list, a shared thread) nothing is docked, so cards render inline as before.
|
|
1167
|
+
*/
|
|
1168
|
+
export declare function useChoiceQuestion(): ChoiceQuestionContextValue;
|
|
1169
|
+
|
|
1170
|
+
/**
|
|
1171
|
+
* Part of the presentational options in force, picked by `select`: the nearest `GentiqUI`'s, with
|
|
1172
|
+
* the admin's settings on top and Gentiq's defaults filled in. Outside a `GentiqUI`, Gentiq's
|
|
1173
|
+
* defaults with the admin's settings. Re-renders only when that part changes:
|
|
1174
|
+
* `useGentiqUIOptions((options) => options.history.showPin)`.
|
|
1175
|
+
*
|
|
1176
|
+
* `select` must return something that stays the same while the options do, such as a field of
|
|
1177
|
+
* them, not an object built from them.
|
|
1178
|
+
*/
|
|
1179
|
+
export declare function useGentiqUIOptions<T>(select: (options: GentiqUIOptions) => T): T;
|
|
1180
|
+
|
|
1181
|
+
/** The built-in sign-in and sign-up page. */
|
|
1182
|
+
export declare function UserLoginPage(props: UserLoginPageProps): JSX.Element;
|
|
1183
|
+
|
|
1184
|
+
export declare interface UserLoginPageProps {
|
|
1185
|
+
/** Called once the user has signed in or signed up: navigate to the chat here. */
|
|
1186
|
+
onSignedIn: () => void;
|
|
1187
|
+
/** Why the user was sent here, from `RequireAuth`'s `fallback`, to explain an ended session. */
|
|
1188
|
+
reason?: UnauthenticatedReason;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
/**
|
|
1192
|
+
* Reads `app.smoothStreaming` off the components context and fills in the
|
|
1193
|
+
* defaults, so the parts don't each have to interpret the shorthand forms.
|
|
1194
|
+
*/
|
|
1195
|
+
export declare function useSmoothStreamingConfig(): ResolvedSmoothStreaming;
|
|
1196
|
+
|
|
1197
|
+
/**
|
|
1198
|
+
* Paces streamed text so it reveals at a steady rate instead of in the bursts
|
|
1199
|
+
* the network hands us.
|
|
1200
|
+
*
|
|
1201
|
+
* The server emits one SSE frame per model delta and the client coalesces those
|
|
1202
|
+
* on a fixed interval, so what lands in any given flush is whatever the provider
|
|
1203
|
+
* happened to clump together — one character or forty. Rendering each flush
|
|
1204
|
+
* directly is what makes the transcript stutter. This hook takes those flushes
|
|
1205
|
+
* as *input* and releases characters on `requestAnimationFrame` at an adaptive
|
|
1206
|
+
* rate, so the cadence the eye sees is decoupled from the cadence the socket
|
|
1207
|
+
* delivers.
|
|
1208
|
+
*
|
|
1209
|
+
* Only the live message pays for it: once nothing is pending the rAF loop stops
|
|
1210
|
+
* and `text` is returned by identity, which leaves the memo boundaries around
|
|
1211
|
+
* settled messages untouched.
|
|
1212
|
+
*
|
|
1213
|
+
* @returns `[displayText, isCatchingUp]` — `isCatchingUp` is true while the
|
|
1214
|
+
* display still lags the received text, so callers can hold back anything
|
|
1215
|
+
* (an action row) that should only settle once the last word has landed.
|
|
1216
|
+
*/
|
|
1217
|
+
export declare function useSmoothText(text: string, isStreaming: boolean, options?: UseSmoothTextOptions): [string, boolean];
|
|
1218
|
+
|
|
1219
|
+
export declare interface UseSmoothTextOptions {
|
|
1220
|
+
/** Slowest release rate, in characters per second. Defaults to 40. */
|
|
1221
|
+
minCharsPerSecond?: number;
|
|
1222
|
+
/** Fastest release rate, in characters per second. Defaults to 900. */
|
|
1223
|
+
maxCharsPerSecond?: number;
|
|
1224
|
+
/** Set to `false` to pass the text straight through. Defaults to `true`. */
|
|
1225
|
+
enabled?: boolean;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
/**
|
|
1229
|
+
* User data available when building a personalized welcome greeting.
|
|
1230
|
+
*/
|
|
1231
|
+
export declare interface WelcomeGreetingContext {
|
|
1232
|
+
user: GentiqUser | null;
|
|
1233
|
+
firstName: string | null;
|
|
1234
|
+
isLoading: boolean;
|
|
1235
|
+
/** Translate the greeting using Gentiq's active language and resources. */
|
|
1236
|
+
t: TFunction;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
/**
|
|
1240
|
+
* The new-chat header: an optional brand icon, the (optionally personalized)
|
|
1241
|
+
* title and an optional static subtitle. Rendered directly above the centered
|
|
1242
|
+
* composer. The rotating typing-effect prompts are in the composer's
|
|
1243
|
+
* placeholder, not here. It shows no suggestions, so it doesn't call `onSuggestionClick`.
|
|
1244
|
+
*/
|
|
1245
|
+
export declare const WelcomeScreen: (_props: WelcomeScreenProps) => JSX.Element;
|
|
1246
|
+
|
|
1247
|
+
/**
|
|
1248
|
+
* Configuration for the welcome/empty-state screen.
|
|
1249
|
+
*/
|
|
1250
|
+
export declare interface WelcomeScreenConfig {
|
|
1251
|
+
/**
|
|
1252
|
+
* Optional override for the welcome message title. A function can be used
|
|
1253
|
+
* to personalize the greeting with the authenticated user's first name.
|
|
1254
|
+
*/
|
|
1255
|
+
greeting?: string | ((context: WelcomeGreetingContext) => string);
|
|
1256
|
+
/** Optional override for the welcome message subtitle. */
|
|
1257
|
+
subtitle?: string;
|
|
1258
|
+
/**
|
|
1259
|
+
* Rotating prompts cycled through the new-chat composer's placeholder with a
|
|
1260
|
+
* typewriter effect.
|
|
1261
|
+
*
|
|
1262
|
+
* Leave unset to use the list Gentiq ships for the active language; pass an
|
|
1263
|
+
* empty array to turn the effect off and keep the static placeholder. Entries
|
|
1264
|
+
* may be translation keys, and a function receives the authenticated user so
|
|
1265
|
+
* the prompts can be conditioned on them.
|
|
1266
|
+
*/
|
|
1267
|
+
typingPrompts?: string[] | ((context: WelcomeGreetingContext) => string[]);
|
|
1268
|
+
/** Optional override for the icon displayed on the welcome screen. Defaults to null. */
|
|
1269
|
+
icon?: LucideIcon | ReactNode;
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
/**
|
|
1273
|
+
* Props for the WelcomeScreen component.
|
|
1274
|
+
*/
|
|
1275
|
+
export declare interface WelcomeScreenProps {
|
|
1276
|
+
/** Sends a suggestion as the thread's first message, for a welcome screen that offers some. */
|
|
1277
|
+
onSuggestionClick: (suggestion: string) => void;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
export { }
|