@assistant-ui/react 0.5.51 → 0.5.52
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +36 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +228 -208
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -2271,14 +2271,47 @@ var AssistantRuntimeProviderImpl = ({ children, runtime }) => {
|
|
2271
2271
|
};
|
2272
2272
|
var AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);
|
2273
2273
|
|
2274
|
+
// src/context/providers/TextContentPartProvider.tsx
|
2275
|
+
import { useState as useState9 } from "react";
|
2276
|
+
import { create as create12 } from "zustand";
|
2277
|
+
|
2278
|
+
// src/context/react/ContentPartContext.ts
|
2279
|
+
import { createContext as createContext4, useContext as useContext4 } from "react";
|
2280
|
+
var ContentPartContext = createContext4(
|
2281
|
+
null
|
2282
|
+
);
|
2283
|
+
function useContentPartContext(options) {
|
2284
|
+
const context = useContext4(ContentPartContext);
|
2285
|
+
if (!options?.optional && !context)
|
2286
|
+
throw new Error(
|
2287
|
+
"This component can only be used inside a component passed to <MessagePrimitive.Content components={...} >."
|
2288
|
+
);
|
2289
|
+
return context;
|
2290
|
+
}
|
2291
|
+
|
2292
|
+
// src/context/providers/TextContentPartProvider.tsx
|
2293
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
2294
|
+
var TextContentPartProvider = ({ children, text }) => {
|
2295
|
+
const [context] = useState9(() => {
|
2296
|
+
const useContentPart = create12(() => ({
|
2297
|
+
status: { type: "complete" },
|
2298
|
+
part: { type: "text", text }
|
2299
|
+
}));
|
2300
|
+
return {
|
2301
|
+
useContentPart
|
2302
|
+
};
|
2303
|
+
});
|
2304
|
+
return /* @__PURE__ */ jsx9(ContentPartContext.Provider, { value: context, children });
|
2305
|
+
};
|
2306
|
+
|
2274
2307
|
// src/context/react/ComposerContext.ts
|
2275
2308
|
import { useMemo as useMemo3 } from "react";
|
2276
2309
|
|
2277
2310
|
// src/context/react/MessageContext.ts
|
2278
|
-
import { createContext as
|
2279
|
-
var MessageContext =
|
2311
|
+
import { createContext as createContext5, useContext as useContext5 } from "react";
|
2312
|
+
var MessageContext = createContext5(null);
|
2280
2313
|
function useMessageContext(options) {
|
2281
|
-
const context =
|
2314
|
+
const context = useContext5(MessageContext);
|
2282
2315
|
if (!options?.optional && !context)
|
2283
2316
|
throw new Error(
|
2284
2317
|
"This component can only be used inside a component passed to <ThreadPrimitive.Messages components={...} />."
|
@@ -2299,20 +2332,6 @@ var useComposerContext = () => {
|
|
2299
2332
|
);
|
2300
2333
|
};
|
2301
2334
|
|
2302
|
-
// src/context/react/ContentPartContext.ts
|
2303
|
-
import { createContext as createContext5, useContext as useContext5 } from "react";
|
2304
|
-
var ContentPartContext = createContext5(
|
2305
|
-
null
|
2306
|
-
);
|
2307
|
-
function useContentPartContext(options) {
|
2308
|
-
const context = useContext5(ContentPartContext);
|
2309
|
-
if (!options?.optional && !context)
|
2310
|
-
throw new Error(
|
2311
|
-
"This component can only be used inside a component passed to <MessagePrimitive.Content components={...} >."
|
2312
|
-
);
|
2313
|
-
return context;
|
2314
|
-
}
|
2315
|
-
|
2316
2335
|
// src/hooks/useAppendMessage.tsx
|
2317
2336
|
import { useCallback } from "react";
|
2318
2337
|
var toAppendMessage = (useThreadMessages, message) => {
|
@@ -2829,7 +2848,7 @@ var useActionBarFloatStatus = ({
|
|
2829
2848
|
};
|
2830
2849
|
|
2831
2850
|
// src/primitives/actionBar/ActionBarRoot.tsx
|
2832
|
-
import { jsx as
|
2851
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
2833
2852
|
var ActionBarPrimitiveRoot = forwardRef5(({ hideWhenRunning, autohide, autohideFloat, ...rest }, ref) => {
|
2834
2853
|
const hideAndfloatStatus = useActionBarFloatStatus({
|
2835
2854
|
hideWhenRunning,
|
@@ -2837,7 +2856,7 @@ var ActionBarPrimitiveRoot = forwardRef5(({ hideWhenRunning, autohide, autohideF
|
|
2837
2856
|
autohideFloat
|
2838
2857
|
});
|
2839
2858
|
if (hideAndfloatStatus === "hidden" /* Hidden */) return null;
|
2840
|
-
return /* @__PURE__ */
|
2859
|
+
return /* @__PURE__ */ jsx10(
|
2841
2860
|
Primitive2.div,
|
2842
2861
|
{
|
2843
2862
|
...hideAndfloatStatus === "floating" /* Floating */ ? { "data-floating": "true" } : null,
|
@@ -2852,7 +2871,7 @@ ActionBarPrimitiveRoot.displayName = "ActionBarPrimitive.Root";
|
|
2852
2871
|
import { forwardRef as forwardRef6 } from "react";
|
2853
2872
|
import { Primitive as Primitive3 } from "@radix-ui/react-primitive";
|
2854
2873
|
import { composeEventHandlers } from "@radix-ui/primitive";
|
2855
|
-
import { jsx as
|
2874
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
2856
2875
|
var createActionButton = (displayName, useActionButton, forwardProps = []) => {
|
2857
2876
|
const ActionButton = forwardRef6((props, forwardedRef) => {
|
2858
2877
|
const forwardedProps = {};
|
@@ -2865,7 +2884,7 @@ var createActionButton = (displayName, useActionButton, forwardProps = []) => {
|
|
2865
2884
|
}
|
2866
2885
|
});
|
2867
2886
|
const callback = useActionButton(forwardedProps);
|
2868
|
-
return /* @__PURE__ */
|
2887
|
+
return /* @__PURE__ */ jsx11(
|
2869
2888
|
Primitive3.button,
|
2870
2889
|
{
|
2871
2890
|
type: "button",
|
@@ -2912,7 +2931,7 @@ import { forwardRef as forwardRef7 } from "react";
|
|
2912
2931
|
import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
|
2913
2932
|
import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
|
2914
2933
|
import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
|
2915
|
-
import { jsx as
|
2934
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
2916
2935
|
var ActionBarPrimitiveStopSpeaking = forwardRef7((props, ref) => {
|
2917
2936
|
const callback = useActionBarStopSpeaking();
|
2918
2937
|
useEscapeKeydown((e) => {
|
@@ -2921,7 +2940,7 @@ var ActionBarPrimitiveStopSpeaking = forwardRef7((props, ref) => {
|
|
2921
2940
|
callback();
|
2922
2941
|
}
|
2923
2942
|
});
|
2924
|
-
return /* @__PURE__ */
|
2943
|
+
return /* @__PURE__ */ jsx12(
|
2925
2944
|
Primitive4.button,
|
2926
2945
|
{
|
2927
2946
|
type: "button",
|
@@ -2945,7 +2964,7 @@ __export(assistantModal_exports, {
|
|
2945
2964
|
});
|
2946
2965
|
|
2947
2966
|
// src/primitives/assistantModal/AssistantModalRoot.tsx
|
2948
|
-
import { useState as
|
2967
|
+
import { useState as useState10 } from "react";
|
2949
2968
|
import * as PopoverPrimitive2 from "@radix-ui/react-popover";
|
2950
2969
|
import { composeEventHandlers as composeEventHandlers3 } from "@radix-ui/primitive";
|
2951
2970
|
|
@@ -2967,9 +2986,9 @@ import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
2967
2986
|
var usePopoverScope = PopoverPrimitive.createPopoverScope();
|
2968
2987
|
|
2969
2988
|
// src/primitives/assistantModal/AssistantModalRoot.tsx
|
2970
|
-
import { jsx as
|
2989
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
2971
2990
|
var useAssistantModalOpenState = (defaultOpen = false) => {
|
2972
|
-
const state =
|
2991
|
+
const state = useState10(defaultOpen);
|
2973
2992
|
const [, setOpen] = state;
|
2974
2993
|
useOnComposerFocus(() => {
|
2975
2994
|
setOpen(true);
|
@@ -2985,7 +3004,7 @@ var AssistantModalPrimitiveRoot = ({
|
|
2985
3004
|
}) => {
|
2986
3005
|
const scope = usePopoverScope(__scopeAssistantModal);
|
2987
3006
|
const [modalOpen, setOpen] = useAssistantModalOpenState(defaultOpen);
|
2988
|
-
return /* @__PURE__ */
|
3007
|
+
return /* @__PURE__ */ jsx13(
|
2989
3008
|
PopoverPrimitive2.Root,
|
2990
3009
|
{
|
2991
3010
|
...scope,
|
@@ -3000,14 +3019,14 @@ AssistantModalPrimitiveRoot.displayName = "AssistantModalPrimitive.Root";
|
|
3000
3019
|
// src/primitives/assistantModal/AssistantModalTrigger.tsx
|
3001
3020
|
import { forwardRef as forwardRef8 } from "react";
|
3002
3021
|
import * as PopoverPrimitive3 from "@radix-ui/react-popover";
|
3003
|
-
import { jsx as
|
3022
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
3004
3023
|
var AssistantModalPrimitiveTrigger = forwardRef8(
|
3005
3024
|
({
|
3006
3025
|
__scopeAssistantModal,
|
3007
3026
|
...rest
|
3008
3027
|
}, ref) => {
|
3009
3028
|
const scope = usePopoverScope(__scopeAssistantModal);
|
3010
|
-
return /* @__PURE__ */
|
3029
|
+
return /* @__PURE__ */ jsx14(PopoverPrimitive3.Trigger, { ...scope, ...rest, ref });
|
3011
3030
|
}
|
3012
3031
|
);
|
3013
3032
|
AssistantModalPrimitiveTrigger.displayName = "AssistantModalPrimitive.Trigger";
|
@@ -3016,7 +3035,7 @@ AssistantModalPrimitiveTrigger.displayName = "AssistantModalPrimitive.Trigger";
|
|
3016
3035
|
import { forwardRef as forwardRef9 } from "react";
|
3017
3036
|
import * as PopoverPrimitive4 from "@radix-ui/react-popover";
|
3018
3037
|
import { composeEventHandlers as composeEventHandlers4 } from "@radix-ui/primitive";
|
3019
|
-
import { jsx as
|
3038
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
3020
3039
|
var AssistantModalPrimitiveContent = forwardRef9(
|
3021
3040
|
({
|
3022
3041
|
__scopeAssistantModal,
|
@@ -3027,7 +3046,7 @@ var AssistantModalPrimitiveContent = forwardRef9(
|
|
3027
3046
|
...props
|
3028
3047
|
}, forwardedRef) => {
|
3029
3048
|
const scope = usePopoverScope(__scopeAssistantModal);
|
3030
|
-
return /* @__PURE__ */
|
3049
|
+
return /* @__PURE__ */ jsx15(PopoverPrimitive4.Portal, { ...scope, children: /* @__PURE__ */ jsx15(
|
3031
3050
|
PopoverPrimitive4.Content,
|
3032
3051
|
{
|
3033
3052
|
...scope,
|
@@ -3048,14 +3067,14 @@ AssistantModalPrimitiveContent.displayName = "AssistantModalPrimitive.Content";
|
|
3048
3067
|
// src/primitives/assistantModal/AssistantModalAnchor.tsx
|
3049
3068
|
import { forwardRef as forwardRef10 } from "react";
|
3050
3069
|
import * as PopoverPrimitive5 from "@radix-ui/react-popover";
|
3051
|
-
import { jsx as
|
3070
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
3052
3071
|
var AssistantModalPrimitiveAnchor = forwardRef10(
|
3053
3072
|
({
|
3054
3073
|
__scopeAssistantModal,
|
3055
3074
|
...rest
|
3056
3075
|
}, ref) => {
|
3057
3076
|
const scope = usePopoverScope(__scopeAssistantModal);
|
3058
|
-
return /* @__PURE__ */
|
3077
|
+
return /* @__PURE__ */ jsx16(PopoverPrimitive5.Anchor, { ...scope, ...rest, ref });
|
3059
3078
|
}
|
3060
3079
|
);
|
3061
3080
|
AssistantModalPrimitiveAnchor.displayName = "AssistantModalPrimitive.Anchor";
|
@@ -3083,18 +3102,18 @@ var BranchPickerPrevious = createActionButton(
|
|
3083
3102
|
);
|
3084
3103
|
|
3085
3104
|
// src/primitives/branchPicker/BranchPickerCount.tsx
|
3086
|
-
import { Fragment, jsx as
|
3105
|
+
import { Fragment, jsx as jsx17 } from "react/jsx-runtime";
|
3087
3106
|
var BranchPickerPrimitiveCount = () => {
|
3088
3107
|
const branchCount = useBranchPickerCount();
|
3089
|
-
return /* @__PURE__ */
|
3108
|
+
return /* @__PURE__ */ jsx17(Fragment, { children: branchCount });
|
3090
3109
|
};
|
3091
3110
|
BranchPickerPrimitiveCount.displayName = "BranchPickerPrimitive.Count";
|
3092
3111
|
|
3093
3112
|
// src/primitives/branchPicker/BranchPickerNumber.tsx
|
3094
|
-
import { Fragment as Fragment2, jsx as
|
3113
|
+
import { Fragment as Fragment2, jsx as jsx18 } from "react/jsx-runtime";
|
3095
3114
|
var BranchPickerPrimitiveNumber = () => {
|
3096
3115
|
const branchNumber = useBranchPickerNumber();
|
3097
|
-
return /* @__PURE__ */
|
3116
|
+
return /* @__PURE__ */ jsx18(Fragment2, { children: branchNumber });
|
3098
3117
|
};
|
3099
3118
|
BranchPickerPrimitiveNumber.displayName = "BranchPickerPrimitive.Number";
|
3100
3119
|
|
@@ -3139,7 +3158,7 @@ var useManagedRef = (callback) => {
|
|
3139
3158
|
|
3140
3159
|
// src/primitives/message/MessageRoot.tsx
|
3141
3160
|
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
3142
|
-
import { jsx as
|
3161
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
3143
3162
|
var useIsHoveringRef = () => {
|
3144
3163
|
const { useMessageUtils } = useMessageContext();
|
3145
3164
|
const callbackRef = useCallback16(
|
@@ -3166,7 +3185,7 @@ var useIsHoveringRef = () => {
|
|
3166
3185
|
var MessagePrimitiveRoot = forwardRef11(({ onMouseEnter, onMouseLeave, ...rest }, forwardRef30) => {
|
3167
3186
|
const isHoveringRef = useIsHoveringRef();
|
3168
3187
|
const ref = useComposedRefs(forwardRef30, isHoveringRef);
|
3169
|
-
return /* @__PURE__ */
|
3188
|
+
return /* @__PURE__ */ jsx19(Primitive5.div, { ...rest, ref });
|
3170
3189
|
});
|
3171
3190
|
MessagePrimitiveRoot.displayName = "MessagePrimitive.Root";
|
3172
3191
|
|
@@ -3184,9 +3203,9 @@ MessagePrimitiveIf.displayName = "MessagePrimitive.If";
|
|
3184
3203
|
import { memo as memo2 } from "react";
|
3185
3204
|
|
3186
3205
|
// src/context/providers/ContentPartProvider.tsx
|
3187
|
-
import { useEffect as useEffect9, useState as
|
3188
|
-
import { create as
|
3189
|
-
import { jsx as
|
3206
|
+
import { useEffect as useEffect9, useState as useState11 } from "react";
|
3207
|
+
import { create as create13 } from "zustand";
|
3208
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
3190
3209
|
var COMPLETE_STATUS = {
|
3191
3210
|
type: "complete"
|
3192
3211
|
};
|
@@ -3223,8 +3242,8 @@ var getContentPartState = ({ message }, useContentPart, partIndex) => {
|
|
3223
3242
|
};
|
3224
3243
|
var useContentPartContext2 = (partIndex) => {
|
3225
3244
|
const { useMessage } = useMessageContext();
|
3226
|
-
const [context] =
|
3227
|
-
const useContentPart =
|
3245
|
+
const [context] = useState11(() => {
|
3246
|
+
const useContentPart = create13(
|
3228
3247
|
() => getContentPartState(useMessage.getState(), void 0, partIndex)
|
3229
3248
|
);
|
3230
3249
|
return { useContentPart };
|
@@ -3249,32 +3268,32 @@ var ContentPartProvider = ({
|
|
3249
3268
|
children
|
3250
3269
|
}) => {
|
3251
3270
|
const context = useContentPartContext2(partIndex);
|
3252
|
-
return /* @__PURE__ */
|
3271
|
+
return /* @__PURE__ */ jsx20(ContentPartContext.Provider, { value: context, children });
|
3253
3272
|
};
|
3254
3273
|
|
3255
3274
|
// src/primitives/contentPart/ContentPartText.tsx
|
3256
3275
|
import {
|
3257
3276
|
forwardRef as forwardRef12
|
3258
3277
|
} from "react";
|
3259
|
-
import { jsx as
|
3278
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
3260
3279
|
var ContentPartPrimitiveText = forwardRef12(({ smooth = true, component: Component = "span", ...rest }, forwardedRef) => {
|
3261
3280
|
const {
|
3262
3281
|
part: { text },
|
3263
3282
|
status
|
3264
3283
|
} = useSmooth(useContentPartText(), smooth);
|
3265
|
-
return /* @__PURE__ */
|
3284
|
+
return /* @__PURE__ */ jsx21(Component, { "data-status": status.type, ...rest, ref: forwardedRef, children: text });
|
3266
3285
|
});
|
3267
3286
|
ContentPartPrimitiveText.displayName = "ContentPartPrimitive.Text";
|
3268
3287
|
|
3269
3288
|
// src/primitives/contentPart/ContentPartImage.tsx
|
3270
3289
|
import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
|
3271
3290
|
import { forwardRef as forwardRef13 } from "react";
|
3272
|
-
import { jsx as
|
3291
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
3273
3292
|
var ContentPartPrimitiveImage = forwardRef13((props, forwardedRef) => {
|
3274
3293
|
const {
|
3275
3294
|
part: { image }
|
3276
3295
|
} = useContentPartImage();
|
3277
|
-
return /* @__PURE__ */
|
3296
|
+
return /* @__PURE__ */ jsx22(Primitive6.img, { src: image, ...props, ref: forwardedRef });
|
3278
3297
|
});
|
3279
3298
|
ContentPartPrimitiveImage.displayName = "ContentPartPrimitive.Image";
|
3280
3299
|
|
@@ -3296,7 +3315,7 @@ var ContentPartPrimitiveInProgress = ({ children }) => {
|
|
3296
3315
|
ContentPartPrimitiveInProgress.displayName = "ContentPartPrimitive.InProgress";
|
3297
3316
|
|
3298
3317
|
// src/primitives/message/MessageContent.tsx
|
3299
|
-
import { jsx as
|
3318
|
+
import { jsx as jsx23, jsxs as jsxs3 } from "react/jsx-runtime";
|
3300
3319
|
var ToolUIDisplay = ({
|
3301
3320
|
UI,
|
3302
3321
|
...props
|
@@ -3304,15 +3323,15 @@ var ToolUIDisplay = ({
|
|
3304
3323
|
const { useToolUIs } = useAssistantContext();
|
3305
3324
|
const Render = useToolUIs((s) => s.getToolUI(props.part.toolName)) ?? UI;
|
3306
3325
|
if (!Render) return null;
|
3307
|
-
return /* @__PURE__ */
|
3326
|
+
return /* @__PURE__ */ jsx23(Render, { ...props });
|
3308
3327
|
};
|
3309
3328
|
var defaultComponents = {
|
3310
3329
|
Text: () => /* @__PURE__ */ jsxs3("p", { style: { whiteSpace: "pre-line" }, children: [
|
3311
|
-
/* @__PURE__ */
|
3312
|
-
/* @__PURE__ */
|
3330
|
+
/* @__PURE__ */ jsx23(ContentPartPrimitiveText, {}),
|
3331
|
+
/* @__PURE__ */ jsx23(ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ jsx23("span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
|
3313
3332
|
] }),
|
3314
|
-
Image: () => /* @__PURE__ */
|
3315
|
-
UI: () => /* @__PURE__ */
|
3333
|
+
Image: () => /* @__PURE__ */ jsx23(ContentPartPrimitiveImage, {}),
|
3334
|
+
UI: () => /* @__PURE__ */ jsx23(ContentPartPrimitiveDisplay, {})
|
3316
3335
|
};
|
3317
3336
|
var MessageContentPartComponent = ({
|
3318
3337
|
components: {
|
@@ -3333,16 +3352,16 @@ var MessageContentPartComponent = ({
|
|
3333
3352
|
case "text":
|
3334
3353
|
if (status.type === "requires-action")
|
3335
3354
|
throw new Error("Encountered unexpected requires-action status");
|
3336
|
-
if (part === EMPTY_CONTENT) return /* @__PURE__ */
|
3337
|
-
return /* @__PURE__ */
|
3355
|
+
if (part === EMPTY_CONTENT) return /* @__PURE__ */ jsx23(Empty, { part, status });
|
3356
|
+
return /* @__PURE__ */ jsx23(Text2, { part, status });
|
3338
3357
|
case "image":
|
3339
3358
|
if (status.type === "requires-action")
|
3340
3359
|
throw new Error("Encountered unexpected requires-action status");
|
3341
|
-
return /* @__PURE__ */
|
3360
|
+
return /* @__PURE__ */ jsx23(Image2, { part, status });
|
3342
3361
|
case "ui":
|
3343
3362
|
if (status.type === "requires-action")
|
3344
3363
|
throw new Error("Encountered unexpected requires-action status");
|
3345
|
-
return /* @__PURE__ */
|
3364
|
+
return /* @__PURE__ */ jsx23(UI, { part, status });
|
3346
3365
|
case "tool-call": {
|
3347
3366
|
const Tool = by_name[part.toolName] || Fallback2;
|
3348
3367
|
const addResult = (result) => addToolResult({
|
@@ -3351,7 +3370,7 @@ var MessageContentPartComponent = ({
|
|
3351
3370
|
toolCallId: part.toolCallId,
|
3352
3371
|
result
|
3353
3372
|
});
|
3354
|
-
return /* @__PURE__ */
|
3373
|
+
return /* @__PURE__ */ jsx23(
|
3355
3374
|
ToolUIDisplay,
|
3356
3375
|
{
|
3357
3376
|
UI: Tool,
|
@@ -3370,7 +3389,7 @@ var MessageContentPartImpl = ({
|
|
3370
3389
|
partIndex,
|
3371
3390
|
components
|
3372
3391
|
}) => {
|
3373
|
-
return /* @__PURE__ */
|
3392
|
+
return /* @__PURE__ */ jsx23(ContentPartProvider, { partIndex, children: /* @__PURE__ */ jsx23(MessageContentPartComponent, { components }) });
|
3374
3393
|
};
|
3375
3394
|
var MessageContentPart = memo2(
|
3376
3395
|
MessageContentPartImpl,
|
@@ -3381,7 +3400,7 @@ var MessagePrimitiveContent = ({
|
|
3381
3400
|
}) => {
|
3382
3401
|
const { useMessage } = useMessageContext();
|
3383
3402
|
const contentLength = useMessage((s) => s.message.content.length) || 1;
|
3384
|
-
return Array.from({ length: contentLength }, (_, index) => /* @__PURE__ */
|
3403
|
+
return Array.from({ length: contentLength }, (_, index) => /* @__PURE__ */ jsx23(MessageContentPart, { partIndex: index, components }, index));
|
3385
3404
|
};
|
3386
3405
|
MessagePrimitiveContent.displayName = "MessagePrimitive.Content";
|
3387
3406
|
|
@@ -3417,9 +3436,9 @@ function useAttachmentContext(options) {
|
|
3417
3436
|
}
|
3418
3437
|
|
3419
3438
|
// src/context/providers/MessageAttachmentProvider.tsx
|
3420
|
-
import { useEffect as useEffect10, useState as
|
3421
|
-
import { create as
|
3422
|
-
import { jsx as
|
3439
|
+
import { useEffect as useEffect10, useState as useState12 } from "react";
|
3440
|
+
import { create as create14 } from "zustand";
|
3441
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
3423
3442
|
var getAttachment = ({ message }, useAttachment, partIndex) => {
|
3424
3443
|
if (message.role !== "user") return null;
|
3425
3444
|
const attachments = message.attachments;
|
@@ -3431,9 +3450,9 @@ var getAttachment = ({ message }, useAttachment, partIndex) => {
|
|
3431
3450
|
};
|
3432
3451
|
var useMessageAttachmentContext = (partIndex) => {
|
3433
3452
|
const { useMessage } = useMessageContext();
|
3434
|
-
const [context] =
|
3453
|
+
const [context] = useState12(
|
3435
3454
|
() => {
|
3436
|
-
const useAttachment =
|
3455
|
+
const useAttachment = create14(
|
3437
3456
|
() => getAttachment(useMessage.getState(), void 0, partIndex)
|
3438
3457
|
);
|
3439
3458
|
return { type: "message", useAttachment };
|
@@ -3459,11 +3478,11 @@ var MessageAttachmentProvider = ({
|
|
3459
3478
|
children
|
3460
3479
|
}) => {
|
3461
3480
|
const context = useMessageAttachmentContext(partIndex);
|
3462
|
-
return /* @__PURE__ */
|
3481
|
+
return /* @__PURE__ */ jsx24(AttachmentContext.Provider, { value: context, children });
|
3463
3482
|
};
|
3464
3483
|
|
3465
3484
|
// src/primitives/message/MessageAttachments.tsx
|
3466
|
-
import { jsx as
|
3485
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
3467
3486
|
var getComponent = (components, attachment) => {
|
3468
3487
|
const type = attachment.type;
|
3469
3488
|
switch (type) {
|
@@ -3484,10 +3503,10 @@ var AttachmentComponent = ({ components }) => {
|
|
3484
3503
|
(a) => getComponent(components, a.attachment)
|
3485
3504
|
);
|
3486
3505
|
if (!Component) return null;
|
3487
|
-
return /* @__PURE__ */
|
3506
|
+
return /* @__PURE__ */ jsx25(Component, {});
|
3488
3507
|
};
|
3489
3508
|
var MessageAttachmentImpl = ({ components, attachmentIndex }) => {
|
3490
|
-
return /* @__PURE__ */
|
3509
|
+
return /* @__PURE__ */ jsx25(MessageAttachmentProvider, { attachmentIndex, children: /* @__PURE__ */ jsx25(AttachmentComponent, { components }) });
|
3491
3510
|
};
|
3492
3511
|
var MessageAttachment = memo3(
|
3493
3512
|
MessageAttachmentImpl,
|
@@ -3499,7 +3518,7 @@ var MessagePrimitiveAttachments = ({ components }) => {
|
|
3499
3518
|
if (message.role !== "user") return 0;
|
3500
3519
|
return message.attachments.length;
|
3501
3520
|
});
|
3502
|
-
return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */
|
3521
|
+
return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx25(
|
3503
3522
|
MessageAttachment,
|
3504
3523
|
{
|
3505
3524
|
attachmentIndex: index,
|
@@ -3511,9 +3530,9 @@ var MessagePrimitiveAttachments = ({ components }) => {
|
|
3511
3530
|
MessagePrimitiveAttachments.displayName = "MessagePrimitive.Attachments";
|
3512
3531
|
|
3513
3532
|
// src/primitives/branchPicker/BranchPickerRoot.tsx
|
3514
|
-
import { jsx as
|
3533
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
3515
3534
|
var BranchPickerPrimitiveRoot = forwardRef14(({ hideWhenSingleBranch, ...rest }, ref) => {
|
3516
|
-
return /* @__PURE__ */
|
3535
|
+
return /* @__PURE__ */ jsx26(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx26(Primitive7.div, { ...rest, ref }) });
|
3517
3536
|
});
|
3518
3537
|
BranchPickerPrimitiveRoot.displayName = "BranchPickerPrimitive.Root";
|
3519
3538
|
|
@@ -3535,7 +3554,7 @@ import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
|
|
3535
3554
|
import {
|
3536
3555
|
forwardRef as forwardRef15
|
3537
3556
|
} from "react";
|
3538
|
-
import { jsx as
|
3557
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
3539
3558
|
var ComposerPrimitiveRoot = forwardRef15(({ onSubmit, ...rest }, forwardedRef) => {
|
3540
3559
|
const send = useComposerSend();
|
3541
3560
|
const handleSubmit = (e) => {
|
@@ -3543,7 +3562,7 @@ var ComposerPrimitiveRoot = forwardRef15(({ onSubmit, ...rest }, forwardedRef) =
|
|
3543
3562
|
if (!send) return;
|
3544
3563
|
send();
|
3545
3564
|
};
|
3546
|
-
return /* @__PURE__ */
|
3565
|
+
return /* @__PURE__ */ jsx27(
|
3547
3566
|
Primitive8.form,
|
3548
3567
|
{
|
3549
3568
|
...rest,
|
@@ -3566,7 +3585,7 @@ import {
|
|
3566
3585
|
} from "react";
|
3567
3586
|
import TextareaAutosize from "react-textarea-autosize";
|
3568
3587
|
import { useEscapeKeydown as useEscapeKeydown2 } from "@radix-ui/react-use-escape-keydown";
|
3569
|
-
import { jsx as
|
3588
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
3570
3589
|
var ComposerPrimitiveInput = forwardRef16(
|
3571
3590
|
({
|
3572
3591
|
autoFocus = false,
|
@@ -3620,7 +3639,7 @@ var ComposerPrimitiveInput = forwardRef16(
|
|
3620
3639
|
focus();
|
3621
3640
|
}
|
3622
3641
|
});
|
3623
|
-
return /* @__PURE__ */
|
3642
|
+
return /* @__PURE__ */ jsx28(
|
3624
3643
|
Component,
|
3625
3644
|
{
|
3626
3645
|
name: "input",
|
@@ -3662,9 +3681,9 @@ var ComposerPrimitiveAddAttachment = createActionButton(
|
|
3662
3681
|
import { memo as memo4 } from "react";
|
3663
3682
|
|
3664
3683
|
// src/context/providers/ComposerAttachmentProvider.tsx
|
3665
|
-
import { useEffect as useEffect12, useState as
|
3666
|
-
import { create as
|
3667
|
-
import { jsx as
|
3684
|
+
import { useEffect as useEffect12, useState as useState13 } from "react";
|
3685
|
+
import { create as create15 } from "zustand";
|
3686
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
3668
3687
|
var getAttachment2 = ({ attachments }, useAttachment, partIndex) => {
|
3669
3688
|
let attachment = attachments[partIndex];
|
3670
3689
|
if (!attachment) return null;
|
@@ -3674,9 +3693,9 @@ var getAttachment2 = ({ attachments }, useAttachment, partIndex) => {
|
|
3674
3693
|
};
|
3675
3694
|
var useComposerAttachmentContext = (partIndex) => {
|
3676
3695
|
const { useComposer } = useThreadContext();
|
3677
|
-
const [context] =
|
3696
|
+
const [context] = useState13(
|
3678
3697
|
() => {
|
3679
|
-
const useAttachment =
|
3698
|
+
const useAttachment = create15(
|
3680
3699
|
() => getAttachment2(useComposer.getState(), void 0, partIndex)
|
3681
3700
|
);
|
3682
3701
|
return { type: "composer", useAttachment };
|
@@ -3699,11 +3718,11 @@ var useComposerAttachmentContext = (partIndex) => {
|
|
3699
3718
|
};
|
3700
3719
|
var ComposerAttachmentProvider = ({ attachmentIndex: partIndex, children }) => {
|
3701
3720
|
const context = useComposerAttachmentContext(partIndex);
|
3702
|
-
return /* @__PURE__ */
|
3721
|
+
return /* @__PURE__ */ jsx29(AttachmentContext.Provider, { value: context, children });
|
3703
3722
|
};
|
3704
3723
|
|
3705
3724
|
// src/primitives/composer/ComposerAttachments.tsx
|
3706
|
-
import { jsx as
|
3725
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
3707
3726
|
var getComponent2 = (components, attachment) => {
|
3708
3727
|
const type = attachment.type;
|
3709
3728
|
switch (type) {
|
@@ -3724,10 +3743,10 @@ var AttachmentComponent2 = ({ components }) => {
|
|
3724
3743
|
(a) => getComponent2(components, a.attachment)
|
3725
3744
|
);
|
3726
3745
|
if (!Component) return null;
|
3727
|
-
return /* @__PURE__ */
|
3746
|
+
return /* @__PURE__ */ jsx30(Component, {});
|
3728
3747
|
};
|
3729
3748
|
var ComposerAttachmentImpl = ({ components, attachmentIndex }) => {
|
3730
|
-
return /* @__PURE__ */
|
3749
|
+
return /* @__PURE__ */ jsx30(ComposerAttachmentProvider, { attachmentIndex, children: /* @__PURE__ */ jsx30(AttachmentComponent2, { components }) });
|
3731
3750
|
};
|
3732
3751
|
var ComposerAttachment = memo4(
|
3733
3752
|
ComposerAttachmentImpl,
|
@@ -3736,7 +3755,7 @@ var ComposerAttachment = memo4(
|
|
3736
3755
|
var ComposerPrimitiveAttachments = ({ components }) => {
|
3737
3756
|
const { useComposer } = useThreadContext();
|
3738
3757
|
const attachmentsCount = useComposer((s) => s.attachments.length);
|
3739
|
-
return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */
|
3758
|
+
return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx30(
|
3740
3759
|
ComposerAttachment,
|
3741
3760
|
{
|
3742
3761
|
attachmentIndex: index,
|
@@ -3781,9 +3800,9 @@ __export(thread_exports, {
|
|
3781
3800
|
// src/primitives/thread/ThreadRoot.tsx
|
3782
3801
|
import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
|
3783
3802
|
import { forwardRef as forwardRef17 } from "react";
|
3784
|
-
import { jsx as
|
3803
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
3785
3804
|
var ThreadPrimitiveRoot = forwardRef17((props, ref) => {
|
3786
|
-
return /* @__PURE__ */
|
3805
|
+
return /* @__PURE__ */ jsx31(Primitive9.div, { ...props, ref });
|
3787
3806
|
});
|
3788
3807
|
ThreadPrimitiveRoot.displayName = "ThreadPrimitive.Root";
|
3789
3808
|
|
@@ -3918,13 +3937,13 @@ var useThreadViewportAutoScroll = ({
|
|
3918
3937
|
};
|
3919
3938
|
|
3920
3939
|
// src/primitives/thread/ThreadViewport.tsx
|
3921
|
-
import { jsx as
|
3940
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
3922
3941
|
var ThreadPrimitiveViewport = forwardRef18(({ autoScroll, onScroll, children, ...rest }, forwardedRef) => {
|
3923
3942
|
const autoScrollRef = useThreadViewportAutoScroll({
|
3924
3943
|
autoScroll
|
3925
3944
|
});
|
3926
3945
|
const ref = useComposedRefs4(forwardedRef, autoScrollRef);
|
3927
|
-
return /* @__PURE__ */
|
3946
|
+
return /* @__PURE__ */ jsx32(Primitive10.div, { ...rest, ref, children });
|
3928
3947
|
});
|
3929
3948
|
ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
|
3930
3949
|
|
@@ -3932,15 +3951,15 @@ ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
|
|
3932
3951
|
import { memo as memo5 } from "react";
|
3933
3952
|
|
3934
3953
|
// src/context/providers/MessageProvider.tsx
|
3935
|
-
import { useEffect as useEffect14, useState as
|
3936
|
-
import { create as
|
3954
|
+
import { useEffect as useEffect14, useState as useState14 } from "react";
|
3955
|
+
import { create as create18 } from "zustand";
|
3937
3956
|
|
3938
3957
|
// src/context/stores/EditComposer.ts
|
3939
|
-
import { create as
|
3958
|
+
import { create as create16 } from "zustand";
|
3940
3959
|
var makeEditComposerStore = ({
|
3941
3960
|
onEdit,
|
3942
3961
|
onSend
|
3943
|
-
}) =>
|
3962
|
+
}) => create16()((set, get) => ({
|
3944
3963
|
get value() {
|
3945
3964
|
return get().text;
|
3946
3965
|
},
|
@@ -3974,8 +3993,8 @@ var makeEditComposerStore = ({
|
|
3974
3993
|
}));
|
3975
3994
|
|
3976
3995
|
// src/context/stores/MessageUtils.ts
|
3977
|
-
import { create as
|
3978
|
-
var makeMessageUtilsStore = () =>
|
3996
|
+
import { create as create17 } from "zustand";
|
3997
|
+
var makeMessageUtilsStore = () => create17((set) => {
|
3979
3998
|
let utterance = null;
|
3980
3999
|
return {
|
3981
4000
|
isCopied: false,
|
@@ -4001,7 +4020,7 @@ var makeMessageUtilsStore = () => create16((set) => {
|
|
4001
4020
|
});
|
4002
4021
|
|
4003
4022
|
// src/context/providers/MessageProvider.tsx
|
4004
|
-
import { jsx as
|
4023
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
4005
4024
|
var getIsLast = (messages, message) => {
|
4006
4025
|
return messages[messages.length - 1]?.id === message.id;
|
4007
4026
|
};
|
@@ -4023,8 +4042,8 @@ var getMessageState = (messages, getBranches, useMessage, messageIndex) => {
|
|
4023
4042
|
};
|
4024
4043
|
var useMessageContext2 = (messageIndex) => {
|
4025
4044
|
const { useThreadMessages, useThreadActions } = useThreadContext();
|
4026
|
-
const [context] =
|
4027
|
-
const useMessage =
|
4045
|
+
const [context] = useState14(() => {
|
4046
|
+
const useMessage = create18(
|
4028
4047
|
() => getMessageState(
|
4029
4048
|
useThreadMessages.getState(),
|
4030
4049
|
useThreadActions.getState().getBranches,
|
@@ -4085,11 +4104,11 @@ var MessageProvider = ({
|
|
4085
4104
|
children
|
4086
4105
|
}) => {
|
4087
4106
|
const context = useMessageContext2(messageIndex);
|
4088
|
-
return /* @__PURE__ */
|
4107
|
+
return /* @__PURE__ */ jsx33(MessageContext.Provider, { value: context, children });
|
4089
4108
|
};
|
4090
4109
|
|
4091
4110
|
// src/primitives/thread/ThreadMessages.tsx
|
4092
|
-
import { jsx as
|
4111
|
+
import { jsx as jsx34, jsxs as jsxs4 } from "react/jsx-runtime";
|
4093
4112
|
var DEFAULT_SYSTEM_MESSAGE = () => null;
|
4094
4113
|
var getComponents = (components) => {
|
4095
4114
|
return {
|
@@ -4106,11 +4125,11 @@ var ThreadMessageImpl = ({
|
|
4106
4125
|
const { UserMessage: UserMessage2, EditComposer: EditComposer2, AssistantMessage: AssistantMessage2, SystemMessage: SystemMessage2 } = getComponents(components);
|
4107
4126
|
return /* @__PURE__ */ jsxs4(MessageProvider, { messageIndex, children: [
|
4108
4127
|
/* @__PURE__ */ jsxs4(MessagePrimitiveIf, { user: true, children: [
|
4109
|
-
/* @__PURE__ */
|
4110
|
-
/* @__PURE__ */
|
4128
|
+
/* @__PURE__ */ jsx34(ComposerPrimitiveIf, { editing: false, children: /* @__PURE__ */ jsx34(UserMessage2, {}) }),
|
4129
|
+
/* @__PURE__ */ jsx34(ComposerPrimitiveIf, { editing: true, children: /* @__PURE__ */ jsx34(EditComposer2, {}) })
|
4111
4130
|
] }),
|
4112
|
-
/* @__PURE__ */
|
4113
|
-
/* @__PURE__ */
|
4131
|
+
/* @__PURE__ */ jsx34(MessagePrimitiveIf, { assistant: true, children: /* @__PURE__ */ jsx34(AssistantMessage2, {}) }),
|
4132
|
+
/* @__PURE__ */ jsx34(MessagePrimitiveIf, { system: true, children: /* @__PURE__ */ jsx34(SystemMessage2, {}) })
|
4114
4133
|
] });
|
4115
4134
|
};
|
4116
4135
|
var ThreadMessage = memo5(
|
@@ -4123,7 +4142,7 @@ var ThreadPrimitiveMessagesImpl = ({
|
|
4123
4142
|
const { useThreadMessages } = useThreadContext();
|
4124
4143
|
const messagesLength = useThreadMessages((t) => t.length);
|
4125
4144
|
if (messagesLength === 0) return null;
|
4126
|
-
return Array.from({ length: messagesLength }, (_, index) => /* @__PURE__ */
|
4145
|
+
return Array.from({ length: messagesLength }, (_, index) => /* @__PURE__ */ jsx34(ThreadMessage, { messageIndex: index, components }, index));
|
4127
4146
|
};
|
4128
4147
|
ThreadPrimitiveMessagesImpl.displayName = "ThreadPrimitive.Messages";
|
4129
4148
|
var ThreadPrimitiveMessages = memo5(
|
@@ -4149,7 +4168,7 @@ import {
|
|
4149
4168
|
createContext as createContext7,
|
4150
4169
|
useContext as useContext7
|
4151
4170
|
} from "react";
|
4152
|
-
import { Fragment as Fragment3, jsx as
|
4171
|
+
import { Fragment as Fragment3, jsx as jsx35 } from "react/jsx-runtime";
|
4153
4172
|
var ThreadConfigContext = createContext7({});
|
4154
4173
|
var useThreadConfig = () => {
|
4155
4174
|
return useContext7(ThreadConfigContext);
|
@@ -4159,14 +4178,14 @@ var ThreadConfigProvider = ({
|
|
4159
4178
|
config
|
4160
4179
|
}) => {
|
4161
4180
|
const assistant = useAssistantContext({ optional: true });
|
4162
|
-
const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */
|
4181
|
+
const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ jsx35(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ jsx35(Fragment3, { children });
|
4163
4182
|
if (!config?.runtime) return configProvider;
|
4164
4183
|
if (assistant) {
|
4165
4184
|
throw new Error(
|
4166
4185
|
"You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
|
4167
4186
|
);
|
4168
4187
|
}
|
4169
|
-
return /* @__PURE__ */
|
4188
|
+
return /* @__PURE__ */ jsx35(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
|
4170
4189
|
};
|
4171
4190
|
ThreadConfigProvider.displayName = "ThreadConfigProvider";
|
4172
4191
|
|
@@ -4179,7 +4198,7 @@ import {
|
|
4179
4198
|
RefreshCwIcon,
|
4180
4199
|
StopCircleIcon
|
4181
4200
|
} from "lucide-react";
|
4182
|
-
import { Fragment as Fragment4, jsx as
|
4201
|
+
import { Fragment as Fragment4, jsx as jsx36, jsxs as jsxs5 } from "react/jsx-runtime";
|
4183
4202
|
var useAllowCopy = (ensureCapability = false) => {
|
4184
4203
|
const { assistantMessage: { allowCopy = true } = {} } = useThreadConfig();
|
4185
4204
|
const { useThread } = useThreadContext();
|
@@ -4210,9 +4229,9 @@ var AssistantActionBar = () => {
|
|
4210
4229
|
autohide: "not-last",
|
4211
4230
|
autohideFloat: "single-branch",
|
4212
4231
|
children: [
|
4213
|
-
allowSpeak && /* @__PURE__ */
|
4214
|
-
allowCopy && /* @__PURE__ */
|
4215
|
-
allowReload && /* @__PURE__ */
|
4232
|
+
allowSpeak && /* @__PURE__ */ jsx36(AssistantActionBarSpeechControl, {}),
|
4233
|
+
allowCopy && /* @__PURE__ */ jsx36(AssistantActionBarCopy, {}),
|
4234
|
+
allowReload && /* @__PURE__ */ jsx36(AssistantActionBarReload, {})
|
4216
4235
|
]
|
4217
4236
|
}
|
4218
4237
|
);
|
@@ -4228,16 +4247,16 @@ var AssistantActionBarCopy = forwardRef19((props, ref) => {
|
|
4228
4247
|
assistantMessage: { copy: { tooltip = "Copy" } = {} } = {}
|
4229
4248
|
} = {}
|
4230
4249
|
} = useThreadConfig();
|
4231
|
-
return /* @__PURE__ */
|
4232
|
-
/* @__PURE__ */
|
4233
|
-
/* @__PURE__ */
|
4250
|
+
return /* @__PURE__ */ jsx36(actionBar_exports.Copy, { asChild: true, children: /* @__PURE__ */ jsx36(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
4251
|
+
/* @__PURE__ */ jsx36(message_exports.If, { copied: true, children: /* @__PURE__ */ jsx36(CheckIcon, {}) }),
|
4252
|
+
/* @__PURE__ */ jsx36(message_exports.If, { copied: false, children: /* @__PURE__ */ jsx36(CopyIcon, {}) })
|
4234
4253
|
] }) }) });
|
4235
4254
|
});
|
4236
4255
|
AssistantActionBarCopy.displayName = "AssistantActionBarCopy";
|
4237
4256
|
var AssistantActionBarSpeechControl = () => {
|
4238
4257
|
return /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
4239
|
-
/* @__PURE__ */
|
4240
|
-
/* @__PURE__ */
|
4258
|
+
/* @__PURE__ */ jsx36(message_exports.If, { speaking: false, children: /* @__PURE__ */ jsx36(AssistantActionBarSpeak, {}) }),
|
4259
|
+
/* @__PURE__ */ jsx36(message_exports.If, { speaking: true, children: /* @__PURE__ */ jsx36(AssistantActionBarStopSpeaking, {}) })
|
4241
4260
|
] });
|
4242
4261
|
};
|
4243
4262
|
var AssistantActionBarSpeak = forwardRef19((props, ref) => {
|
@@ -4247,7 +4266,7 @@ var AssistantActionBarSpeak = forwardRef19((props, ref) => {
|
|
4247
4266
|
} = {}
|
4248
4267
|
} = useThreadConfig();
|
4249
4268
|
const allowSpeak = useAllowSpeak();
|
4250
|
-
return /* @__PURE__ */
|
4269
|
+
return /* @__PURE__ */ jsx36(actionBar_exports.Speak, { disabled: !allowSpeak, asChild: true, children: /* @__PURE__ */ jsx36(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx36(AudioLinesIcon, {}) }) });
|
4251
4270
|
});
|
4252
4271
|
AssistantActionBarSpeak.displayName = "AssistantActionBarSpeak";
|
4253
4272
|
var AssistantActionBarStopSpeaking = forwardRef19((props, ref) => {
|
@@ -4259,7 +4278,7 @@ var AssistantActionBarStopSpeaking = forwardRef19((props, ref) => {
|
|
4259
4278
|
} = {}
|
4260
4279
|
} = useThreadConfig();
|
4261
4280
|
const allowSpeak = useAllowSpeak();
|
4262
|
-
return /* @__PURE__ */
|
4281
|
+
return /* @__PURE__ */ jsx36(actionBar_exports.StopSpeaking, { disabled: !allowSpeak, asChild: true, children: /* @__PURE__ */ jsx36(TooltipIconButton, { tooltip: stopTooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx36(StopCircleIcon, {}) }) });
|
4263
4282
|
});
|
4264
4283
|
AssistantActionBarStopSpeaking.displayName = "AssistantActionBarStopSpeaking";
|
4265
4284
|
var AssistantActionBarReload = forwardRef19((props, ref) => {
|
@@ -4269,7 +4288,7 @@ var AssistantActionBarReload = forwardRef19((props, ref) => {
|
|
4269
4288
|
} = {}
|
4270
4289
|
} = useThreadConfig();
|
4271
4290
|
const allowReload = useAllowReload();
|
4272
|
-
return /* @__PURE__ */
|
4291
|
+
return /* @__PURE__ */ jsx36(actionBar_exports.Reload, { disabled: !allowReload, asChild: true, children: /* @__PURE__ */ jsx36(TooltipIconButton, { tooltip, ...props, ref, children: /* @__PURE__ */ jsx36(RefreshCwIcon, {}) }) });
|
4273
4292
|
});
|
4274
4293
|
AssistantActionBarReload.displayName = "AssistantActionBarReload";
|
4275
4294
|
var exports = {
|
@@ -4291,7 +4310,7 @@ import { forwardRef as forwardRef21, useMemo as useMemo5 } from "react";
|
|
4291
4310
|
// src/ui/branch-picker.tsx
|
4292
4311
|
import { forwardRef as forwardRef20 } from "react";
|
4293
4312
|
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
4294
|
-
import { jsx as
|
4313
|
+
import { jsx as jsx37, jsxs as jsxs6 } from "react/jsx-runtime";
|
4295
4314
|
var useAllowBranchPicker = (ensureCapability = false) => {
|
4296
4315
|
const { branchPicker: { allowBranchPicker = true } = {} } = useThreadConfig();
|
4297
4316
|
const { useThread } = useThreadContext();
|
@@ -4302,9 +4321,9 @@ var BranchPicker = () => {
|
|
4302
4321
|
const allowBranchPicker = useAllowBranchPicker();
|
4303
4322
|
if (!allowBranchPicker) return null;
|
4304
4323
|
return /* @__PURE__ */ jsxs6(BranchPickerRoot, { hideWhenSingleBranch: true, children: [
|
4305
|
-
/* @__PURE__ */
|
4306
|
-
/* @__PURE__ */
|
4307
|
-
/* @__PURE__ */
|
4324
|
+
/* @__PURE__ */ jsx37(BranchPickerPrevious2, {}),
|
4325
|
+
/* @__PURE__ */ jsx37(BranchPickerState, {}),
|
4326
|
+
/* @__PURE__ */ jsx37(BranchPickerNext, {})
|
4308
4327
|
] });
|
4309
4328
|
};
|
4310
4329
|
BranchPicker.displayName = "BranchPicker";
|
@@ -4319,7 +4338,7 @@ var BranchPickerPrevious2 = forwardRef20((props, ref) => {
|
|
4319
4338
|
} = {}
|
4320
4339
|
} = useThreadConfig();
|
4321
4340
|
const allowBranchPicker = useAllowBranchPicker();
|
4322
|
-
return /* @__PURE__ */
|
4341
|
+
return /* @__PURE__ */ jsx37(branchPicker_exports.Previous, { disabled: !allowBranchPicker, asChild: true, children: /* @__PURE__ */ jsx37(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(ChevronLeftIcon, {}) }) });
|
4323
4342
|
});
|
4324
4343
|
BranchPickerPrevious2.displayName = "BranchPickerPrevious";
|
4325
4344
|
var BranchPickerStateWrapper = withDefaults("span", {
|
@@ -4327,9 +4346,9 @@ var BranchPickerStateWrapper = withDefaults("span", {
|
|
4327
4346
|
});
|
4328
4347
|
var BranchPickerState = forwardRef20((props, ref) => {
|
4329
4348
|
return /* @__PURE__ */ jsxs6(BranchPickerStateWrapper, { ...props, ref, children: [
|
4330
|
-
/* @__PURE__ */
|
4349
|
+
/* @__PURE__ */ jsx37(branchPicker_exports.Number, {}),
|
4331
4350
|
" / ",
|
4332
|
-
/* @__PURE__ */
|
4351
|
+
/* @__PURE__ */ jsx37(branchPicker_exports.Count, {})
|
4333
4352
|
] });
|
4334
4353
|
});
|
4335
4354
|
BranchPickerState.displayName = "BranchPickerState";
|
@@ -4338,7 +4357,7 @@ var BranchPickerNext = forwardRef20((props, ref) => {
|
|
4338
4357
|
strings: { branchPicker: { next: { tooltip = "Next" } = {} } = {} } = {}
|
4339
4358
|
} = useThreadConfig();
|
4340
4359
|
const allowBranchPicker = useAllowBranchPicker();
|
4341
|
-
return /* @__PURE__ */
|
4360
|
+
return /* @__PURE__ */ jsx37(branchPicker_exports.Next, { disabled: !allowBranchPicker, asChild: true, children: /* @__PURE__ */ jsx37(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(ChevronRightIcon, {}) }) });
|
4342
4361
|
});
|
4343
4362
|
BranchPickerNext.displayName = "BranchPickerNext";
|
4344
4363
|
var exports2 = {
|
@@ -4350,12 +4369,12 @@ var branch_picker_default = Object.assign(BranchPicker, exports2);
|
|
4350
4369
|
|
4351
4370
|
// src/ui/base/avatar.tsx
|
4352
4371
|
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
4353
|
-
import { jsx as
|
4372
|
+
import { jsx as jsx38, jsxs as jsxs7 } from "react/jsx-runtime";
|
4354
4373
|
var Avatar = ({ src, alt, fallback }) => {
|
4355
4374
|
if (src == null && fallback == null) return null;
|
4356
4375
|
return /* @__PURE__ */ jsxs7(AvatarRoot, { children: [
|
4357
|
-
src != null && /* @__PURE__ */
|
4358
|
-
fallback != null && /* @__PURE__ */
|
4376
|
+
src != null && /* @__PURE__ */ jsx38(AvatarImage, { src, alt }),
|
4377
|
+
fallback != null && /* @__PURE__ */ jsx38(AvatarFallback, { children: fallback })
|
4359
4378
|
] });
|
4360
4379
|
};
|
4361
4380
|
Avatar.displayName = "Avatar";
|
@@ -4374,10 +4393,10 @@ AvatarFallback.displayName = "AvatarFallback";
|
|
4374
4393
|
|
4375
4394
|
// src/ui/content-part.tsx
|
4376
4395
|
import classNames2 from "classnames";
|
4377
|
-
import { jsx as
|
4396
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
4378
4397
|
var Text = () => {
|
4379
4398
|
const status = useSmoothStatus();
|
4380
|
-
return /* @__PURE__ */
|
4399
|
+
return /* @__PURE__ */ jsx39(
|
4381
4400
|
contentPart_exports.Text,
|
4382
4401
|
{
|
4383
4402
|
className: classNames2(
|
@@ -4392,19 +4411,19 @@ var exports3 = { Text: withSmoothContextProvider(Text) };
|
|
4392
4411
|
var content_part_default = exports3;
|
4393
4412
|
|
4394
4413
|
// src/ui/assistant-message.tsx
|
4395
|
-
import { jsx as
|
4414
|
+
import { jsx as jsx40, jsxs as jsxs8 } from "react/jsx-runtime";
|
4396
4415
|
var AssistantMessage = () => {
|
4397
4416
|
return /* @__PURE__ */ jsxs8(AssistantMessageRoot, { children: [
|
4398
|
-
/* @__PURE__ */
|
4399
|
-
/* @__PURE__ */
|
4400
|
-
/* @__PURE__ */
|
4401
|
-
/* @__PURE__ */
|
4417
|
+
/* @__PURE__ */ jsx40(AssistantMessageAvatar, {}),
|
4418
|
+
/* @__PURE__ */ jsx40(AssistantMessageContent, {}),
|
4419
|
+
/* @__PURE__ */ jsx40(branch_picker_default, {}),
|
4420
|
+
/* @__PURE__ */ jsx40(assistant_action_bar_default, {})
|
4402
4421
|
] });
|
4403
4422
|
};
|
4404
4423
|
AssistantMessage.displayName = "AssistantMessage";
|
4405
4424
|
var AssistantMessageAvatar = () => {
|
4406
4425
|
const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
|
4407
|
-
return /* @__PURE__ */
|
4426
|
+
return /* @__PURE__ */ jsx40(Avatar, { ...avatar });
|
4408
4427
|
};
|
4409
4428
|
var AssistantMessageRoot = withDefaults(message_exports.Root, {
|
4410
4429
|
className: "aui-assistant-message-root"
|
@@ -4428,7 +4447,7 @@ var AssistantMessageContent = forwardRef21(({ components: componentsProp, ...res
|
|
4428
4447
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
4429
4448
|
[...tools ?? [], components.ToolFallback]
|
4430
4449
|
);
|
4431
|
-
return /* @__PURE__ */
|
4450
|
+
return /* @__PURE__ */ jsx40(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ jsx40(
|
4432
4451
|
message_exports.Content,
|
4433
4452
|
{
|
4434
4453
|
components: {
|
@@ -4463,9 +4482,9 @@ import { forwardRef as forwardRef23 } from "react";
|
|
4463
4482
|
import { PaperclipIcon, SendHorizontalIcon } from "lucide-react";
|
4464
4483
|
|
4465
4484
|
// src/ui/base/CircleStopIcon.tsx
|
4466
|
-
import { jsx as
|
4485
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
4467
4486
|
var CircleStopIcon = () => {
|
4468
|
-
return /* @__PURE__ */
|
4487
|
+
return /* @__PURE__ */ jsx41(
|
4469
4488
|
"svg",
|
4470
4489
|
{
|
4471
4490
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -4473,7 +4492,7 @@ var CircleStopIcon = () => {
|
|
4473
4492
|
fill: "currentColor",
|
4474
4493
|
width: "16",
|
4475
4494
|
height: "16",
|
4476
|
-
children: /* @__PURE__ */
|
4495
|
+
children: /* @__PURE__ */ jsx41("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
|
4477
4496
|
}
|
4478
4497
|
);
|
4479
4498
|
};
|
@@ -4482,7 +4501,7 @@ CircleStopIcon.displayName = "CircleStopIcon";
|
|
4482
4501
|
// src/ui/composer-attachment.tsx
|
4483
4502
|
import { forwardRef as forwardRef22 } from "react";
|
4484
4503
|
import { CircleXIcon } from "lucide-react";
|
4485
|
-
import { jsx as
|
4504
|
+
import { jsx as jsx42, jsxs as jsxs9 } from "react/jsx-runtime";
|
4486
4505
|
var ComposerAttachmentRoot = withDefaults("div", {
|
4487
4506
|
className: "aui-composer-attachment-root"
|
4488
4507
|
});
|
@@ -4493,7 +4512,7 @@ var ComposerAttachment2 = () => {
|
|
4493
4512
|
return /* @__PURE__ */ jsxs9(ComposerAttachmentRoot, { children: [
|
4494
4513
|
".",
|
4495
4514
|
attachment.name.split(".").pop(),
|
4496
|
-
/* @__PURE__ */
|
4515
|
+
/* @__PURE__ */ jsx42(ComposerAttachmentRemove, {})
|
4497
4516
|
] });
|
4498
4517
|
};
|
4499
4518
|
ComposerAttachment2.displayName = "ComposerAttachment";
|
@@ -4508,7 +4527,7 @@ var ComposerAttachmentRemove = forwardRef22((props, ref) => {
|
|
4508
4527
|
const handleRemoveAttachment = () => {
|
4509
4528
|
useComposer.getState().removeAttachment(useAttachment.getState().attachment.id);
|
4510
4529
|
};
|
4511
|
-
return /* @__PURE__ */
|
4530
|
+
return /* @__PURE__ */ jsx42(
|
4512
4531
|
TooltipIconButton,
|
4513
4532
|
{
|
4514
4533
|
tooltip,
|
@@ -4517,7 +4536,7 @@ var ComposerAttachmentRemove = forwardRef22((props, ref) => {
|
|
4517
4536
|
...props,
|
4518
4537
|
onClick: handleRemoveAttachment,
|
4519
4538
|
ref,
|
4520
|
-
children: props.children ?? /* @__PURE__ */
|
4539
|
+
children: props.children ?? /* @__PURE__ */ jsx42(CircleXIcon, {})
|
4521
4540
|
}
|
4522
4541
|
);
|
4523
4542
|
});
|
@@ -4532,7 +4551,7 @@ var composer_attachment_default = Object.assign(
|
|
4532
4551
|
);
|
4533
4552
|
|
4534
4553
|
// src/ui/composer.tsx
|
4535
|
-
import { Fragment as Fragment5, jsx as
|
4554
|
+
import { Fragment as Fragment5, jsx as jsx43, jsxs as jsxs10 } from "react/jsx-runtime";
|
4536
4555
|
var useAllowAttachments = (ensureCapability = false) => {
|
4537
4556
|
const { composer: { allowAttachments = true } = {} } = useThreadConfig();
|
4538
4557
|
const { useThread } = useThreadContext();
|
@@ -4542,10 +4561,10 @@ var useAllowAttachments = (ensureCapability = false) => {
|
|
4542
4561
|
var Composer = () => {
|
4543
4562
|
const allowAttachments = useAllowAttachments(true);
|
4544
4563
|
return /* @__PURE__ */ jsxs10(ComposerRoot, { children: [
|
4545
|
-
allowAttachments && /* @__PURE__ */
|
4546
|
-
allowAttachments && /* @__PURE__ */
|
4547
|
-
/* @__PURE__ */
|
4548
|
-
/* @__PURE__ */
|
4564
|
+
allowAttachments && /* @__PURE__ */ jsx43(ComposerAttachments, {}),
|
4565
|
+
allowAttachments && /* @__PURE__ */ jsx43(ComposerAddAttachment, {}),
|
4566
|
+
/* @__PURE__ */ jsx43(ComposerInput, { autoFocus: true }),
|
4567
|
+
/* @__PURE__ */ jsx43(ComposerAction, {})
|
4549
4568
|
] });
|
4550
4569
|
};
|
4551
4570
|
Composer.displayName = "Composer";
|
@@ -4565,7 +4584,7 @@ var ComposerInput = forwardRef23(
|
|
4565
4584
|
composer: { input: { placeholder = "Write a message..." } = {} } = {}
|
4566
4585
|
} = {}
|
4567
4586
|
} = useThreadConfig();
|
4568
|
-
return /* @__PURE__ */
|
4587
|
+
return /* @__PURE__ */ jsx43(ComposerInputStyled, { placeholder, ...props, ref });
|
4569
4588
|
}
|
4570
4589
|
);
|
4571
4590
|
ComposerInput.displayName = "ComposerInput";
|
@@ -4573,7 +4592,7 @@ var ComposerAttachmentsContainer = withDefaults("div", {
|
|
4573
4592
|
className: "aui-composer-attachments"
|
4574
4593
|
});
|
4575
4594
|
var ComposerAttachments = ({ components }) => {
|
4576
|
-
return /* @__PURE__ */
|
4595
|
+
return /* @__PURE__ */ jsx43(ComposerAttachmentsContainer, { children: /* @__PURE__ */ jsx43(
|
4577
4596
|
composer_exports.Attachments,
|
4578
4597
|
{
|
4579
4598
|
components: {
|
@@ -4594,14 +4613,14 @@ var ComposerAddAttachment = forwardRef23((props, ref) => {
|
|
4594
4613
|
} = {}
|
4595
4614
|
} = useThreadConfig();
|
4596
4615
|
const allowAttachments = useAllowAttachments();
|
4597
|
-
return /* @__PURE__ */
|
4616
|
+
return /* @__PURE__ */ jsx43(composer_exports.AddAttachment, { disabled: !allowAttachments, asChild: true, children: /* @__PURE__ */ jsx43(
|
4598
4617
|
ComposerAttachButton,
|
4599
4618
|
{
|
4600
4619
|
tooltip,
|
4601
4620
|
variant: "ghost",
|
4602
4621
|
...props,
|
4603
4622
|
ref,
|
4604
|
-
children: props.children ?? /* @__PURE__ */
|
4623
|
+
children: props.children ?? /* @__PURE__ */ jsx43(PaperclipIcon, {})
|
4605
4624
|
}
|
4606
4625
|
) });
|
4607
4626
|
});
|
@@ -4613,10 +4632,10 @@ var useAllowCancel = () => {
|
|
4613
4632
|
};
|
4614
4633
|
var ComposerAction = () => {
|
4615
4634
|
const allowCancel = useAllowCancel();
|
4616
|
-
if (!allowCancel) return /* @__PURE__ */
|
4635
|
+
if (!allowCancel) return /* @__PURE__ */ jsx43(ComposerSend, {});
|
4617
4636
|
return /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
4618
|
-
/* @__PURE__ */
|
4619
|
-
/* @__PURE__ */
|
4637
|
+
/* @__PURE__ */ jsx43(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx43(ComposerSend, {}) }),
|
4638
|
+
/* @__PURE__ */ jsx43(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx43(ComposerCancel, {}) })
|
4620
4639
|
] });
|
4621
4640
|
};
|
4622
4641
|
ComposerAction.displayName = "ComposerAction";
|
@@ -4628,7 +4647,7 @@ var ComposerSend = forwardRef23((props, ref) => {
|
|
4628
4647
|
const {
|
4629
4648
|
strings: { composer: { send: { tooltip = "Send" } = {} } = {} } = {}
|
4630
4649
|
} = useThreadConfig();
|
4631
|
-
return /* @__PURE__ */
|
4650
|
+
return /* @__PURE__ */ jsx43(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx43(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx43(SendHorizontalIcon, {}) }) });
|
4632
4651
|
});
|
4633
4652
|
ComposerSend.displayName = "ComposerSend";
|
4634
4653
|
var ComposerCancelButton = withDefaults(TooltipIconButton, {
|
@@ -4639,7 +4658,7 @@ var ComposerCancel = forwardRef23((props, ref) => {
|
|
4639
4658
|
const {
|
4640
4659
|
strings: { composer: { cancel: { tooltip = "Cancel" } = {} } = {} } = {}
|
4641
4660
|
} = useThreadConfig();
|
4642
|
-
return /* @__PURE__ */
|
4661
|
+
return /* @__PURE__ */ jsx43(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx43(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx43(CircleStopIcon, {}) }) });
|
4643
4662
|
});
|
4644
4663
|
ComposerCancel.displayName = "ComposerCancel";
|
4645
4664
|
var exports6 = {
|
@@ -4655,14 +4674,14 @@ var composer_default = Object.assign(Composer, exports6);
|
|
4655
4674
|
|
4656
4675
|
// src/ui/thread-welcome.tsx
|
4657
4676
|
import { forwardRef as forwardRef24 } from "react";
|
4658
|
-
import { jsx as
|
4677
|
+
import { jsx as jsx44, jsxs as jsxs11 } from "react/jsx-runtime";
|
4659
4678
|
var ThreadWelcome = () => {
|
4660
4679
|
return /* @__PURE__ */ jsxs11(ThreadWelcomeRoot, { children: [
|
4661
4680
|
/* @__PURE__ */ jsxs11(ThreadWelcomeCenter, { children: [
|
4662
|
-
/* @__PURE__ */
|
4663
|
-
/* @__PURE__ */
|
4681
|
+
/* @__PURE__ */ jsx44(ThreadWelcomeAvatar, {}),
|
4682
|
+
/* @__PURE__ */ jsx44(ThreadWelcomeMessage, {})
|
4664
4683
|
] }),
|
4665
|
-
/* @__PURE__ */
|
4684
|
+
/* @__PURE__ */ jsx44(ThreadWelcomeSuggestions, {})
|
4666
4685
|
] });
|
4667
4686
|
};
|
4668
4687
|
ThreadWelcome.displayName = "ThreadWelcome";
|
@@ -4674,20 +4693,20 @@ var ThreadWelcomeCenter = withDefaults("div", {
|
|
4674
4693
|
});
|
4675
4694
|
var ThreadWelcomeRoot = forwardRef24(
|
4676
4695
|
(props, ref) => {
|
4677
|
-
return /* @__PURE__ */
|
4696
|
+
return /* @__PURE__ */ jsx44(thread_exports.Empty, { children: /* @__PURE__ */ jsx44(ThreadWelcomeRootStyled, { ...props, ref }) });
|
4678
4697
|
}
|
4679
4698
|
);
|
4680
4699
|
ThreadWelcomeRoot.displayName = "ThreadWelcomeRoot";
|
4681
4700
|
var ThreadWelcomeAvatar = () => {
|
4682
4701
|
const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
|
4683
|
-
return /* @__PURE__ */
|
4702
|
+
return /* @__PURE__ */ jsx44(Avatar, { ...avatar });
|
4684
4703
|
};
|
4685
4704
|
var ThreadWelcomeMessageStyled = withDefaults("p", {
|
4686
4705
|
className: "aui-thread-welcome-message"
|
4687
4706
|
});
|
4688
4707
|
var ThreadWelcomeMessage = forwardRef24(({ message: messageProp, ...rest }, ref) => {
|
4689
4708
|
const { welcome: { message = "How can I help you today?" } = {} } = useThreadConfig();
|
4690
|
-
return /* @__PURE__ */
|
4709
|
+
return /* @__PURE__ */ jsx44(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
|
4691
4710
|
});
|
4692
4711
|
ThreadWelcomeMessage.displayName = "ThreadWelcomeMessage";
|
4693
4712
|
var ThreadWelcomeSuggestionContainer = withDefaults("div", {
|
@@ -4699,21 +4718,21 @@ var ThreadWelcomeSuggestionStyled = withDefaults(thread_exports.Suggestion, {
|
|
4699
4718
|
var ThreadWelcomeSuggestion = ({
|
4700
4719
|
suggestion: { text, prompt }
|
4701
4720
|
}) => {
|
4702
|
-
return /* @__PURE__ */
|
4721
|
+
return /* @__PURE__ */ jsx44(
|
4703
4722
|
ThreadWelcomeSuggestionStyled,
|
4704
4723
|
{
|
4705
4724
|
prompt,
|
4706
4725
|
method: "replace",
|
4707
4726
|
autoSend: true,
|
4708
|
-
children: /* @__PURE__ */
|
4727
|
+
children: /* @__PURE__ */ jsx44("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt })
|
4709
4728
|
}
|
4710
4729
|
);
|
4711
4730
|
};
|
4712
4731
|
var ThreadWelcomeSuggestions = () => {
|
4713
4732
|
const { welcome: { suggestions } = {} } = useThreadConfig();
|
4714
|
-
return /* @__PURE__ */
|
4733
|
+
return /* @__PURE__ */ jsx44(ThreadWelcomeSuggestionContainer, { children: suggestions?.map((suggestion, idx) => {
|
4715
4734
|
const key = `${suggestion.prompt}-${idx}`;
|
4716
|
-
return /* @__PURE__ */
|
4735
|
+
return /* @__PURE__ */ jsx44(ThreadWelcomeSuggestion, { suggestion }, key);
|
4717
4736
|
}) });
|
4718
4737
|
};
|
4719
4738
|
ThreadWelcomeSuggestions.displayName = "ThreadWelcomeSuggestions";
|
@@ -4733,7 +4752,7 @@ import { forwardRef as forwardRef26 } from "react";
|
|
4733
4752
|
// src/ui/user-action-bar.tsx
|
4734
4753
|
import { forwardRef as forwardRef25 } from "react";
|
4735
4754
|
import { PencilIcon } from "lucide-react";
|
4736
|
-
import { jsx as
|
4755
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
4737
4756
|
var useAllowEdit = (ensureCapability = false) => {
|
4738
4757
|
const { userMessage: { allowEdit = true } = {} } = useThreadConfig();
|
4739
4758
|
const { useThread } = useThreadContext();
|
@@ -4743,7 +4762,7 @@ var useAllowEdit = (ensureCapability = false) => {
|
|
4743
4762
|
var UserActionBar = () => {
|
4744
4763
|
const allowEdit = useAllowEdit(true);
|
4745
4764
|
if (!allowEdit) return null;
|
4746
|
-
return /* @__PURE__ */
|
4765
|
+
return /* @__PURE__ */ jsx45(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx45(UserActionBarEdit, {}) });
|
4747
4766
|
};
|
4748
4767
|
UserActionBar.displayName = "UserActionBar";
|
4749
4768
|
var UserActionBarRoot = withDefaults(actionBar_exports.Root, {
|
@@ -4755,7 +4774,7 @@ var UserActionBarEdit = forwardRef25((props, ref) => {
|
|
4755
4774
|
strings: { userMessage: { edit: { tooltip = "Edit" } = {} } = {} } = {}
|
4756
4775
|
} = useThreadConfig();
|
4757
4776
|
const allowEdit = useAllowEdit();
|
4758
|
-
return /* @__PURE__ */
|
4777
|
+
return /* @__PURE__ */ jsx45(actionBar_exports.Edit, { disabled: !allowEdit, asChild: true, children: /* @__PURE__ */ jsx45(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx45(PencilIcon, {}) }) });
|
4759
4778
|
});
|
4760
4779
|
UserActionBarEdit.displayName = "UserActionBarEdit";
|
4761
4780
|
var exports8 = {
|
@@ -4788,13 +4807,13 @@ var user_message_attachment_default = Object.assign(
|
|
4788
4807
|
);
|
4789
4808
|
|
4790
4809
|
// src/ui/user-message.tsx
|
4791
|
-
import { jsx as
|
4810
|
+
import { jsx as jsx46, jsxs as jsxs13 } from "react/jsx-runtime";
|
4792
4811
|
var UserMessage = () => {
|
4793
4812
|
return /* @__PURE__ */ jsxs13(UserMessageRoot, { children: [
|
4794
|
-
/* @__PURE__ */
|
4795
|
-
/* @__PURE__ */
|
4796
|
-
/* @__PURE__ */
|
4797
|
-
/* @__PURE__ */
|
4813
|
+
/* @__PURE__ */ jsx46(UserMessageAttachments, {}),
|
4814
|
+
/* @__PURE__ */ jsx46(user_action_bar_default, {}),
|
4815
|
+
/* @__PURE__ */ jsx46(UserMessageContent, {}),
|
4816
|
+
/* @__PURE__ */ jsx46(branch_picker_default, {})
|
4798
4817
|
] });
|
4799
4818
|
};
|
4800
4819
|
UserMessage.displayName = "UserMessage";
|
@@ -4807,7 +4826,7 @@ var UserMessageContentWrapper = withDefaults("div", {
|
|
4807
4826
|
});
|
4808
4827
|
var UserMessageContent = forwardRef26(
|
4809
4828
|
({ components, ...props }, ref) => {
|
4810
|
-
return /* @__PURE__ */
|
4829
|
+
return /* @__PURE__ */ jsx46(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx46(
|
4811
4830
|
message_exports.Content,
|
4812
4831
|
{
|
4813
4832
|
components: {
|
@@ -4825,7 +4844,7 @@ var UserMessageAttachmentsContainer = withDefaults("div", {
|
|
4825
4844
|
var UserMessageAttachments = ({
|
4826
4845
|
components
|
4827
4846
|
}) => {
|
4828
|
-
return /* @__PURE__ */
|
4847
|
+
return /* @__PURE__ */ jsx46(message_exports.If, { hasAttachments: true, children: /* @__PURE__ */ jsx46(UserMessageAttachmentsContainer, { children: /* @__PURE__ */ jsx46(
|
4829
4848
|
message_exports.Attachments,
|
4830
4849
|
{
|
4831
4850
|
components: {
|
@@ -4844,13 +4863,13 @@ var user_message_default = Object.assign(UserMessage, exports10);
|
|
4844
4863
|
|
4845
4864
|
// src/ui/edit-composer.tsx
|
4846
4865
|
import { forwardRef as forwardRef27 } from "react";
|
4847
|
-
import { jsx as
|
4866
|
+
import { jsx as jsx47, jsxs as jsxs14 } from "react/jsx-runtime";
|
4848
4867
|
var EditComposer = () => {
|
4849
4868
|
return /* @__PURE__ */ jsxs14(EditComposerRoot, { children: [
|
4850
|
-
/* @__PURE__ */
|
4869
|
+
/* @__PURE__ */ jsx47(EditComposerInput, {}),
|
4851
4870
|
/* @__PURE__ */ jsxs14(EditComposerFooter, { children: [
|
4852
|
-
/* @__PURE__ */
|
4853
|
-
/* @__PURE__ */
|
4871
|
+
/* @__PURE__ */ jsx47(EditComposerCancel, {}),
|
4872
|
+
/* @__PURE__ */ jsx47(EditComposerSend, {})
|
4854
4873
|
] })
|
4855
4874
|
] });
|
4856
4875
|
};
|
@@ -4874,7 +4893,7 @@ var EditComposerCancel = forwardRef27(
|
|
4874
4893
|
editComposer: { cancel: { label = "Cancel" } = {} } = {}
|
4875
4894
|
} = {}
|
4876
4895
|
} = useThreadConfig();
|
4877
|
-
return /* @__PURE__ */
|
4896
|
+
return /* @__PURE__ */ jsx47(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx47(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
|
4878
4897
|
}
|
4879
4898
|
);
|
4880
4899
|
EditComposerCancel.displayName = "EditComposerCancel";
|
@@ -4883,7 +4902,7 @@ var EditComposerSend = forwardRef27(
|
|
4883
4902
|
const {
|
4884
4903
|
strings: { editComposer: { send: { label = "Send" } = {} } = {} } = {}
|
4885
4904
|
} = useThreadConfig();
|
4886
|
-
return /* @__PURE__ */
|
4905
|
+
return /* @__PURE__ */ jsx47(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx47(Button, { ...props, ref, children: props.children ?? label }) });
|
4887
4906
|
}
|
4888
4907
|
);
|
4889
4908
|
EditComposerSend.displayName = "EditComposerSend";
|
@@ -4897,14 +4916,14 @@ var exports11 = {
|
|
4897
4916
|
var edit_composer_default = Object.assign(EditComposer, exports11);
|
4898
4917
|
|
4899
4918
|
// src/ui/thread.tsx
|
4900
|
-
import { jsx as
|
4919
|
+
import { jsx as jsx48, jsxs as jsxs15 } from "react/jsx-runtime";
|
4901
4920
|
var Thread = (config) => {
|
4902
|
-
return /* @__PURE__ */
|
4903
|
-
/* @__PURE__ */
|
4904
|
-
/* @__PURE__ */
|
4921
|
+
return /* @__PURE__ */ jsx48(ThreadRoot, { config, children: /* @__PURE__ */ jsxs15(ThreadViewport, { children: [
|
4922
|
+
/* @__PURE__ */ jsx48(thread_welcome_default, {}),
|
4923
|
+
/* @__PURE__ */ jsx48(ThreadMessages, {}),
|
4905
4924
|
/* @__PURE__ */ jsxs15(ThreadViewportFooter, { children: [
|
4906
|
-
/* @__PURE__ */
|
4907
|
-
/* @__PURE__ */
|
4925
|
+
/* @__PURE__ */ jsx48(ThreadScrollToBottom, {}),
|
4926
|
+
/* @__PURE__ */ jsx48(composer_default, {})
|
4908
4927
|
] })
|
4909
4928
|
] }) });
|
4910
4929
|
};
|
@@ -4913,7 +4932,7 @@ var ThreadRootStyled = withDefaults(thread_exports.Root, {
|
|
4913
4932
|
});
|
4914
4933
|
var ThreadRoot = forwardRef28(
|
4915
4934
|
({ config, ...props }, ref) => {
|
4916
|
-
return /* @__PURE__ */
|
4935
|
+
return /* @__PURE__ */ jsx48(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx48(ThreadRootStyled, { ...props, ref }) });
|
4917
4936
|
}
|
4918
4937
|
);
|
4919
4938
|
ThreadRoot.displayName = "ThreadRoot";
|
@@ -4927,7 +4946,7 @@ var ThreadViewportFooter = withDefaults("div", {
|
|
4927
4946
|
ThreadViewportFooter.displayName = "ThreadViewportFooter";
|
4928
4947
|
var SystemMessage = () => null;
|
4929
4948
|
var ThreadMessages = ({ components, ...rest }) => {
|
4930
|
-
return /* @__PURE__ */
|
4949
|
+
return /* @__PURE__ */ jsx48(
|
4931
4950
|
thread_exports.Messages,
|
4932
4951
|
{
|
4933
4952
|
components: {
|
@@ -4951,7 +4970,7 @@ var ThreadScrollToBottom = forwardRef28((props, ref) => {
|
|
4951
4970
|
thread: { scrollToBottom: { tooltip = "Scroll to bottom" } = {} } = {}
|
4952
4971
|
} = {}
|
4953
4972
|
} = useThreadConfig();
|
4954
|
-
return /* @__PURE__ */
|
4973
|
+
return /* @__PURE__ */ jsx48(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx48(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx48(ArrowDownIcon, {}) }) });
|
4955
4974
|
});
|
4956
4975
|
ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
|
4957
4976
|
var exports12 = {
|
@@ -4964,20 +4983,20 @@ var exports12 = {
|
|
4964
4983
|
var thread_default = Object.assign(Thread, exports12);
|
4965
4984
|
|
4966
4985
|
// src/ui/assistant-modal.tsx
|
4967
|
-
import { Fragment as Fragment6, jsx as
|
4986
|
+
import { Fragment as Fragment6, jsx as jsx49, jsxs as jsxs16 } from "react/jsx-runtime";
|
4968
4987
|
var AssistantModal = (config) => {
|
4969
4988
|
return /* @__PURE__ */ jsxs16(AssistantModalRoot, { config, children: [
|
4970
|
-
/* @__PURE__ */
|
4971
|
-
/* @__PURE__ */
|
4989
|
+
/* @__PURE__ */ jsx49(AssistantModalTrigger, {}),
|
4990
|
+
/* @__PURE__ */ jsx49(AssistantModalContent, { children: /* @__PURE__ */ jsx49(thread_default, {}) })
|
4972
4991
|
] });
|
4973
4992
|
};
|
4974
4993
|
AssistantModal.displayName = "AssistantModal";
|
4975
4994
|
var AssistantModalRoot = ({ config, ...props }) => {
|
4976
|
-
return /* @__PURE__ */
|
4995
|
+
return /* @__PURE__ */ jsx49(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx49(assistantModal_exports.Root, { ...props }) });
|
4977
4996
|
};
|
4978
4997
|
AssistantModalRoot.displayName = "AssistantModalRoot";
|
4979
4998
|
var AssistantModalTrigger = forwardRef29((props, ref) => {
|
4980
|
-
return /* @__PURE__ */
|
4999
|
+
return /* @__PURE__ */ jsx49(AssistantModalAnchor, { children: /* @__PURE__ */ jsx49(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx49(AssistantModalButton, { ...props, ref }) }) });
|
4981
5000
|
});
|
4982
5001
|
AssistantModalTrigger.displayName = "AssistantModalTrigger";
|
4983
5002
|
var AssistantModalAnchor = withDefaults(assistantModal_exports.Anchor, {
|
@@ -5002,7 +5021,7 @@ var AssistantModalButton = forwardRef29(({ "data-state": state, ...rest }, ref)
|
|
5002
5021
|
} = {}
|
5003
5022
|
} = useThreadConfig();
|
5004
5023
|
const tooltip = state === "open" ? openTooltip : closedTooltip;
|
5005
|
-
return /* @__PURE__ */
|
5024
|
+
return /* @__PURE__ */ jsx49(
|
5006
5025
|
ModalButtonStyled,
|
5007
5026
|
{
|
5008
5027
|
side: "left",
|
@@ -5011,14 +5030,14 @@ var AssistantModalButton = forwardRef29(({ "data-state": state, ...rest }, ref)
|
|
5011
5030
|
...rest,
|
5012
5031
|
ref,
|
5013
5032
|
children: rest.children ?? /* @__PURE__ */ jsxs16(Fragment6, { children: [
|
5014
|
-
/* @__PURE__ */
|
5033
|
+
/* @__PURE__ */ jsx49(
|
5015
5034
|
BotIcon,
|
5016
5035
|
{
|
5017
5036
|
"data-state": state,
|
5018
5037
|
className: "aui-modal-button-closed-icon"
|
5019
5038
|
}
|
5020
5039
|
),
|
5021
|
-
/* @__PURE__ */
|
5040
|
+
/* @__PURE__ */ jsx49(
|
5022
5041
|
ChevronDownIcon,
|
5023
5042
|
{
|
5024
5043
|
"data-state": state,
|
@@ -5065,6 +5084,7 @@ export {
|
|
5065
5084
|
message_exports as MessagePrimitive,
|
5066
5085
|
SimpleImageAttachmentAdapter,
|
5067
5086
|
SimpleTextAttachmentAdapter,
|
5087
|
+
TextContentPartProvider,
|
5068
5088
|
thread_default as Thread,
|
5069
5089
|
ThreadConfigProvider,
|
5070
5090
|
thread_exports as ThreadPrimitive,
|