@factorialco/f0-react 1.433.0 → 1.435.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { defaultTranslations as ke } from "./i18n-provider-defaults.js";
2
2
  import { jsx as q, jsxs as le } from "react/jsx-runtime";
3
3
  import { useInsertionEffect as Xe, createContext as Ye, useContext as $e, useRef as B, useEffect as ie, useState as Ue, useCallback as qe, useMemo as He } from "react";
4
- import { r as Ke, l as je, m as Qe, n as Je, o as Me, p as Ze, q as et, s as tt, t as rt, v as nt, w as Ne, x as ot, V as it, y as st, z as at, A as ct, S as ut, H as lt, B as se, D as ft, E as dt, G as ht, J as mt, K as pt, L as vt, M as fe, N as gt } from "./F0AiChat-C6Swk3kV.js";
4
+ import { r as Ke, l as je, m as Qe, n as Je, o as Me, p as Ze, q as et, s as tt, t as rt, v as nt, w as Ne, x as ot, V as it, y as st, z as at, A as ct, S as ut, H as lt, B as se, D as ft, E as dt, G as ht, J as mt, K as pt, L as vt, M as fe, N as gt } from "./F0AiChat-BsYN-CYp.js";
5
5
  import { useTrackVolume as wt } from "@livekit/components-react";
6
6
  function Tt(t, e, r) {
7
7
  Xe(() => t.on(e, r), [t, e, r]);
package/dist/ai.d.ts CHANGED
@@ -52,6 +52,16 @@ declare type AiChatDisclaimer = {
52
52
  linkText?: string;
53
53
  };
54
54
 
55
+ export declare type AiChatFileAttachmentConfig = {
56
+ onUploadFiles: (files: File[]) => Promise<UploadedFile[]>;
57
+ allowedMimeTypes?: string | string[];
58
+ /**
59
+ * Maximum number of files that can be attached at once.
60
+ * Omit or pass undefined for no limit.
61
+ */
62
+ maxFiles?: number;
63
+ };
64
+
55
65
  /**
56
66
  * Interaction mode for the AI chat
57
67
  */
@@ -114,6 +124,10 @@ export declare type AiChatProviderProps = {
114
124
  * Groups fetchUsage, upgradePlanUrl, and company/plan display info.
115
125
  */
116
126
  credits?: AiChatCredits;
127
+ /**
128
+ * File attachment configuration. When provided, enables file uploads in the chat.
129
+ */
130
+ fileAttachments?: AiChatFileAttachmentConfig;
117
131
  onThumbsUp?: (message: AIMessage, { threadId, feedback }: {
118
132
  threadId: string;
119
133
  feedback: string;
@@ -223,7 +237,7 @@ declare type AiChatProviderReturnValue = {
223
237
  inProgress: boolean;
224
238
  /** Set the in-progress state (synced from CopilotKit's isLoading) */
225
239
  setInProgress: (value: boolean) => void;
226
- } & Pick<AiChatState, "greeting" | "agent" | "disclaimer" | "resizable" | "entityRefs" | "toolHints" | "credits"> & {
240
+ } & Pick<AiChatState, "greeting" | "agent" | "disclaimer" | "resizable" | "entityRefs" | "toolHints" | "credits" | "fileAttachments"> & {
227
241
  /** The current canvas content, or null when canvas is closed */
228
242
  canvasContent: CanvasContent | null;
229
243
  /** Open the canvas panel with the given content */
@@ -255,6 +269,7 @@ declare interface AiChatState {
255
269
  entityRefs?: EntityRefs;
256
270
  toolHints?: AiChatToolHint[];
257
271
  credits?: AiChatCredits;
272
+ fileAttachments?: AiChatFileAttachmentConfig;
258
273
  placeholders?: string[];
259
274
  setPlaceholders?: React.Dispatch<React.SetStateAction<string[]>>;
260
275
  onThumbsUp?: (message: AIMessage, { threadId, feedback }: {
@@ -290,9 +305,6 @@ export declare type AiChatToolHint = {
290
305
  prompt: string;
291
306
  };
292
307
 
293
- /**
294
- * Tracking options for the AI chat
295
- */
296
308
  declare type AiChatTrackingOptions = {
297
309
  onVisibility?: () => void;
298
310
  onClose?: () => void;
@@ -408,6 +420,8 @@ export declare const aiTranslations: {
408
420
  readonly actionLabel: "Get credits";
409
421
  };
410
422
  };
423
+ readonly attachFile: "Attach file";
424
+ readonly removeFile: "Remove";
411
425
  readonly growth: {
412
426
  readonly demoCard: {
413
427
  readonly title: "See {{moduleName}} in action";
@@ -1147,6 +1161,8 @@ export declare const defaultTranslations: {
1147
1161
  readonly actionLabel: "Get credits";
1148
1162
  };
1149
1163
  };
1164
+ readonly attachFile: "Attach file";
1165
+ readonly removeFile: "Remove";
1150
1166
  readonly growth: {
1151
1167
  readonly demoCard: {
1152
1168
  readonly title: "See {{moduleName}} in action";
@@ -1453,7 +1469,7 @@ export declare const F0AiChat: () => JSX_2.Element | null;
1453
1469
  /**
1454
1470
  * @experimental This is an experimental component use it at your own risk
1455
1471
  */
1456
- export declare const F0AiChatProvider: ({ enabled, greeting, initialMessage, welcomeScreenSuggestions, disclaimer, resizable, defaultVisualizationMode, lockVisualizationMode, historyEnabled, footer, VoiceMode, entityRefs, toolHints, credits, onThumbsUp, onThumbsDown, children, agent, tracking, ...copilotKitProps }: AiChatProviderProps) => JSX_2.Element;
1472
+ export declare const F0AiChatProvider: ({ enabled, greeting, initialMessage, welcomeScreenSuggestions, disclaimer, resizable, defaultVisualizationMode, lockVisualizationMode, historyEnabled, footer, VoiceMode, entityRefs, toolHints, credits, fileAttachments, onThumbsUp, onThumbsDown, children, agent, tracking, ...copilotKitProps }: AiChatProviderProps) => JSX_2.Element;
1457
1473
 
1458
1474
  export declare const F0AiChatTextArea: ({ submitLabel, inProgress, onSend, onStop, creditWarning, onDismissCreditWarning, onGetCredits, }: ChatTextareaProps) => JSX_2.Element;
1459
1475
 
@@ -1767,6 +1783,15 @@ declare type TranslationShape_2<T> = {
1767
1783
 
1768
1784
  export declare type TranslationsType = TranslationShape<typeof defaultTranslations>;
1769
1785
 
1786
+ /**
1787
+ * Tracking options for the AI chat
1788
+ */
1789
+ export declare type UploadedFile = {
1790
+ url: string;
1791
+ filename: string;
1792
+ mimetype: string;
1793
+ };
1794
+
1770
1795
  export declare function useAiChat(): AiChatProviderReturnValue;
1771
1796
 
1772
1797
  export declare function useAiChatTranslations(): AiChatTranslations;
package/dist/ai.js CHANGED
@@ -1,6 +1,6 @@
1
- import { i as t, h as i, F as e, a as n, C as o, b as r, j as A, k as c, I as u, g as F, c as h, d as C, u as l, f as I, e as f } from "./F0AiChat-C6Swk3kV.js";
1
+ import { i as t, h as i, F as e, a as n, C as o, b as r, j as A, k as c, I as u, g as F, c as h, d as C, u as l, f as I, e as f } from "./F0AiChat-BsYN-CYp.js";
2
2
  import { defaultTranslations as d } from "./i18n-provider-defaults.js";
3
- import { A as p, F as S, c as g, d as v, b as x, a as k, o as O, u as P } from "./F0HILActionConfirmation-K5ZONLkv.js";
3
+ import { A as p, F as S, c as g, d as v, b as x, a as k, o as O, u as P } from "./F0HILActionConfirmation-zvTnEJgf.js";
4
4
  export {
5
5
  p as AiChatTranslationsProvider,
6
6
  t as ChatSpinner,