@gendive/chatllm 0.21.7 → 0.21.8
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/dist/react/index.d.mts +72 -52
- package/dist/react/index.d.ts +72 -52
- package/dist/react/index.js +320 -281
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +83 -46
- package/dist/react/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react/index.mjs
CHANGED
|
@@ -2244,6 +2244,7 @@ var useChatUI = (options) => {
|
|
|
2244
2244
|
onAnalyzePatterns,
|
|
2245
2245
|
// Image upload
|
|
2246
2246
|
onUploadImage,
|
|
2247
|
+
onImageError,
|
|
2247
2248
|
// External storage options
|
|
2248
2249
|
useExternalStorage = false,
|
|
2249
2250
|
startWithNewSession = false,
|
|
@@ -2350,6 +2351,7 @@ var useChatUI = (options) => {
|
|
|
2350
2351
|
const onSessionContextChangeRef = useRef5(onSessionContextChange);
|
|
2351
2352
|
const onLoadModelsRef = useRef5(onLoadModels);
|
|
2352
2353
|
const onUploadImageRef = useRef5(onUploadImage);
|
|
2354
|
+
const onImageErrorRef = useRef5(onImageError);
|
|
2353
2355
|
const globalMemoryRef = useRef5(null);
|
|
2354
2356
|
useEffect4(() => {
|
|
2355
2357
|
onSendMessageRef.current = onSendMessage;
|
|
@@ -2370,6 +2372,7 @@ var useChatUI = (options) => {
|
|
|
2370
2372
|
onSkillCompleteRef.current = onSkillComplete;
|
|
2371
2373
|
onSessionContextChangeRef.current = onSessionContextChange;
|
|
2372
2374
|
onUploadImageRef.current = onUploadImage;
|
|
2375
|
+
onImageErrorRef.current = onImageError;
|
|
2373
2376
|
onLoadModelsRef.current = onLoadModels;
|
|
2374
2377
|
});
|
|
2375
2378
|
const abortControllersRef = useRef5(/* @__PURE__ */ new Map());
|
|
@@ -3459,7 +3462,7 @@ ${finalContent}`;
|
|
|
3459
3462
|
if (att.type === "image" && att.file) {
|
|
3460
3463
|
const dataUri = await fileToDataUri(att.file);
|
|
3461
3464
|
const imageUrl = onUploadImageRef.current ? await onUploadImageRef.current(dataUri, att.name) : dataUri;
|
|
3462
|
-
userContentParts.push({ type: "image", url: imageUrl, alt: att.name });
|
|
3465
|
+
userContentParts.push({ type: "image", url: imageUrl, alt: att.name, fileName: att.name });
|
|
3463
3466
|
} else {
|
|
3464
3467
|
userContentParts.push({ type: "file", name: att.name, url: att.previewUrl || "", mimeType: att.mimeType, size: att.size });
|
|
3465
3468
|
}
|
|
@@ -5655,6 +5658,11 @@ ${result.content}
|
|
|
5655
5658
|
};
|
|
5656
5659
|
};
|
|
5657
5660
|
|
|
5661
|
+
// src/react/contexts/ImageErrorContext.ts
|
|
5662
|
+
import { createContext, useContext } from "react";
|
|
5663
|
+
var ImageErrorContext = createContext(null);
|
|
5664
|
+
var useImageError = () => useContext(ImageErrorContext);
|
|
5665
|
+
|
|
5658
5666
|
// src/react/components/ChatSidebar.tsx
|
|
5659
5667
|
import { useState as useState9, useRef as useRef7, useEffect as useEffect6 } from "react";
|
|
5660
5668
|
|
|
@@ -6455,6 +6463,17 @@ var CodeBlock = ({ language, code }) => {
|
|
|
6455
6463
|
};
|
|
6456
6464
|
var ImageWithCopyButton = ({ src, alt, imageKey }) => {
|
|
6457
6465
|
const [isHovered, setIsHovered] = React2.useState(false);
|
|
6466
|
+
const [imgSrc, setImgSrc] = React2.useState(src);
|
|
6467
|
+
const onImageError = useImageError();
|
|
6468
|
+
const handleImageError = React2.useCallback(async () => {
|
|
6469
|
+
if (onImageError) {
|
|
6470
|
+
const newUrl = await onImageError(imgSrc);
|
|
6471
|
+
if (newUrl) {
|
|
6472
|
+
setImgSrc(newUrl);
|
|
6473
|
+
return;
|
|
6474
|
+
}
|
|
6475
|
+
}
|
|
6476
|
+
}, [onImageError, imgSrc]);
|
|
6458
6477
|
const [copyState, setCopyState] = React2.useState("idle");
|
|
6459
6478
|
const imgRef = React2.useRef(null);
|
|
6460
6479
|
const getImageBlob = async () => {
|
|
@@ -6569,10 +6588,11 @@ var ImageWithCopyButton = ({ src, alt, imageKey }) => {
|
|
|
6569
6588
|
"img",
|
|
6570
6589
|
{
|
|
6571
6590
|
ref: imgRef,
|
|
6572
|
-
src,
|
|
6591
|
+
src: imgSrc,
|
|
6573
6592
|
alt,
|
|
6574
6593
|
className: "chatllm-image",
|
|
6575
|
-
crossOrigin:
|
|
6594
|
+
crossOrigin: imgSrc.startsWith("data:") ? void 0 : "anonymous",
|
|
6595
|
+
onError: handleImageError,
|
|
6576
6596
|
style: {
|
|
6577
6597
|
maxWidth: "100%",
|
|
6578
6598
|
borderRadius: "8px",
|
|
@@ -8855,7 +8875,7 @@ var iconButtonStyle = {
|
|
|
8855
8875
|
};
|
|
8856
8876
|
|
|
8857
8877
|
// src/react/components/MessageList.tsx
|
|
8858
|
-
import React14, { useRef as useRef10, useEffect as useEffect10, useCallback as
|
|
8878
|
+
import React14, { useRef as useRef10, useEffect as useEffect10, useCallback as useCallback11, useState as useState18 } from "react";
|
|
8859
8879
|
|
|
8860
8880
|
// src/react/components/MessageBubble.tsx
|
|
8861
8881
|
import { useState as useState17 } from "react";
|
|
@@ -9697,12 +9717,25 @@ var SkillProgressUI = ({
|
|
|
9697
9717
|
};
|
|
9698
9718
|
|
|
9699
9719
|
// src/react/components/ImageContentCard.tsx
|
|
9700
|
-
import { useState as useState13 } from "react";
|
|
9720
|
+
import { useState as useState13, useCallback as useCallback8 } from "react";
|
|
9701
9721
|
import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
9702
9722
|
var ImageContentCard = ({ part }) => {
|
|
9703
9723
|
const [isExpanded, setIsExpanded] = useState13(false);
|
|
9704
9724
|
const [isLoaded, setIsLoaded] = useState13(false);
|
|
9705
9725
|
const [hasError, setHasError] = useState13(false);
|
|
9726
|
+
const [imgSrc, setImgSrc] = useState13(part.url);
|
|
9727
|
+
const onImageError = useImageError();
|
|
9728
|
+
const handleImageError = useCallback8(async () => {
|
|
9729
|
+
if (onImageError) {
|
|
9730
|
+
const newUrl = await onImageError(imgSrc, part.fileName);
|
|
9731
|
+
if (newUrl) {
|
|
9732
|
+
setImgSrc(newUrl);
|
|
9733
|
+
setIsLoaded(false);
|
|
9734
|
+
return;
|
|
9735
|
+
}
|
|
9736
|
+
}
|
|
9737
|
+
setHasError(true);
|
|
9738
|
+
}, [onImageError, imgSrc, part.fileName]);
|
|
9706
9739
|
if (hasError) {
|
|
9707
9740
|
return /* @__PURE__ */ jsxs10(
|
|
9708
9741
|
"div",
|
|
@@ -9755,10 +9788,10 @@ var ImageContentCard = ({ part }) => {
|
|
|
9755
9788
|
/* @__PURE__ */ jsx11(
|
|
9756
9789
|
"img",
|
|
9757
9790
|
{
|
|
9758
|
-
src:
|
|
9791
|
+
src: imgSrc,
|
|
9759
9792
|
alt: part.alt || "",
|
|
9760
9793
|
onLoad: () => setIsLoaded(true),
|
|
9761
|
-
onError:
|
|
9794
|
+
onError: handleImageError,
|
|
9762
9795
|
style: {
|
|
9763
9796
|
display: isLoaded ? "block" : "none",
|
|
9764
9797
|
width: "100%",
|
|
@@ -9801,7 +9834,7 @@ var ImageContentCard = ({ part }) => {
|
|
|
9801
9834
|
children: /* @__PURE__ */ jsx11(
|
|
9802
9835
|
"img",
|
|
9803
9836
|
{
|
|
9804
|
-
src:
|
|
9837
|
+
src: imgSrc,
|
|
9805
9838
|
alt: part.alt || "",
|
|
9806
9839
|
style: {
|
|
9807
9840
|
maxWidth: "90vw",
|
|
@@ -10069,7 +10102,7 @@ var ToolStatusCard = ({
|
|
|
10069
10102
|
};
|
|
10070
10103
|
|
|
10071
10104
|
// src/react/components/ArtifactCard.tsx
|
|
10072
|
-
import { useRef as useRef9, useEffect as useEffect9, useState as useState15, useCallback as
|
|
10105
|
+
import { useRef as useRef9, useEffect as useEffect9, useState as useState15, useCallback as useCallback9 } from "react";
|
|
10073
10106
|
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
10074
10107
|
var getThemeStyles = () => {
|
|
10075
10108
|
const root = document.documentElement;
|
|
@@ -10162,7 +10195,7 @@ var MermaidArtifact = ({ code }) => {
|
|
|
10162
10195
|
const containerRef = useRef9(null);
|
|
10163
10196
|
const [svgHtml, setSvgHtml] = useState15(null);
|
|
10164
10197
|
const [error, setError] = useState15(null);
|
|
10165
|
-
const renderMermaid =
|
|
10198
|
+
const renderMermaid = useCallback9(async () => {
|
|
10166
10199
|
try {
|
|
10167
10200
|
let mermaid;
|
|
10168
10201
|
try {
|
|
@@ -10546,7 +10579,7 @@ var ContentPartRenderer = ({
|
|
|
10546
10579
|
effectiveType === "image" && /* @__PURE__ */ jsx15(
|
|
10547
10580
|
ImageContentCard,
|
|
10548
10581
|
{
|
|
10549
|
-
part: { type: "image", url: result.content, alt: result.metadata?.alt }
|
|
10582
|
+
part: { type: "image", url: result.content, alt: result.metadata?.alt, fileName: result.metadata?.fileName }
|
|
10550
10583
|
}
|
|
10551
10584
|
),
|
|
10552
10585
|
effectiveType === "file" && /* @__PURE__ */ jsx15(
|
|
@@ -11898,7 +11931,7 @@ var MessageList = ({
|
|
|
11898
11931
|
container.removeEventListener("touchmove", handleTouchMove);
|
|
11899
11932
|
};
|
|
11900
11933
|
}, []);
|
|
11901
|
-
const handleScroll =
|
|
11934
|
+
const handleScroll = useCallback11(() => {
|
|
11902
11935
|
if (!containerRef.current) return;
|
|
11903
11936
|
const { scrollTop, scrollHeight, clientHeight } = containerRef.current;
|
|
11904
11937
|
const distanceFromBottom = scrollHeight - scrollTop - clientHeight;
|
|
@@ -11914,7 +11947,7 @@ var MessageList = ({
|
|
|
11914
11947
|
behavior: "smooth"
|
|
11915
11948
|
});
|
|
11916
11949
|
}, [messages]);
|
|
11917
|
-
const scrollToBottom =
|
|
11950
|
+
const scrollToBottom = useCallback11(() => {
|
|
11918
11951
|
userScrollLockRef.current = false;
|
|
11919
11952
|
setShowScrollButton(false);
|
|
11920
11953
|
containerRef.current?.scrollTo({
|
|
@@ -11922,7 +11955,7 @@ var MessageList = ({
|
|
|
11922
11955
|
behavior: "smooth"
|
|
11923
11956
|
});
|
|
11924
11957
|
}, []);
|
|
11925
|
-
const handleMouseUp =
|
|
11958
|
+
const handleMouseUp = useCallback11(() => {
|
|
11926
11959
|
const selection = typeof window !== "undefined" ? window.getSelection() : null;
|
|
11927
11960
|
const text = selection?.toString().trim();
|
|
11928
11961
|
if (text && text.length > 0) {
|
|
@@ -15043,7 +15076,8 @@ var ChatUIWithHook = ({
|
|
|
15043
15076
|
onWorkflowSuggested,
|
|
15044
15077
|
onAnalyzePatterns,
|
|
15045
15078
|
// Image upload
|
|
15046
|
-
onUploadImage
|
|
15079
|
+
onUploadImage,
|
|
15080
|
+
onImageError
|
|
15047
15081
|
}) => {
|
|
15048
15082
|
const hookOptions = {
|
|
15049
15083
|
models,
|
|
@@ -15093,10 +15127,11 @@ var ChatUIWithHook = ({
|
|
|
15093
15127
|
onWorkflowSuggested,
|
|
15094
15128
|
onAnalyzePatterns,
|
|
15095
15129
|
// Image upload
|
|
15096
|
-
onUploadImage
|
|
15130
|
+
onUploadImage,
|
|
15131
|
+
onImageError
|
|
15097
15132
|
};
|
|
15098
15133
|
const state = useChatUI(hookOptions);
|
|
15099
|
-
return /* @__PURE__ */ jsx23(
|
|
15134
|
+
return /* @__PURE__ */ jsx23(ImageErrorContext.Provider, { value: onImageError || null, children: /* @__PURE__ */ jsx23(
|
|
15100
15135
|
ChatUIView,
|
|
15101
15136
|
{
|
|
15102
15137
|
state,
|
|
@@ -15123,7 +15158,7 @@ var ChatUIWithHook = ({
|
|
|
15123
15158
|
onImportMemory,
|
|
15124
15159
|
importMemoryPrompt
|
|
15125
15160
|
}
|
|
15126
|
-
);
|
|
15161
|
+
) });
|
|
15127
15162
|
};
|
|
15128
15163
|
var ChatUI = (props) => {
|
|
15129
15164
|
injectStyles();
|
|
@@ -15153,7 +15188,7 @@ var ChatUI = (props) => {
|
|
|
15153
15188
|
onImportMemory,
|
|
15154
15189
|
importMemoryPrompt
|
|
15155
15190
|
} = props;
|
|
15156
|
-
return /* @__PURE__ */ jsx23(
|
|
15191
|
+
return /* @__PURE__ */ jsx23(ImageErrorContext.Provider, { value: props.onImageError || null, children: /* @__PURE__ */ jsx23(
|
|
15157
15192
|
ChatUIView,
|
|
15158
15193
|
{
|
|
15159
15194
|
state: props.chatState,
|
|
@@ -15181,19 +15216,19 @@ var ChatUI = (props) => {
|
|
|
15181
15216
|
onImportMemory,
|
|
15182
15217
|
importMemoryPrompt
|
|
15183
15218
|
}
|
|
15184
|
-
);
|
|
15219
|
+
) });
|
|
15185
15220
|
}
|
|
15186
15221
|
return /* @__PURE__ */ jsx23(ChatUIWithHook, { ...props });
|
|
15187
15222
|
};
|
|
15188
15223
|
|
|
15189
15224
|
// src/react/ChatFloatingWidget.tsx
|
|
15190
|
-
import { useState as useState28, useRef as useRef17, useEffect as useEffect19, useMemo as useMemo7, useCallback as
|
|
15225
|
+
import { useState as useState28, useRef as useRef17, useEffect as useEffect19, useMemo as useMemo7, useCallback as useCallback16 } from "react";
|
|
15191
15226
|
|
|
15192
15227
|
// src/react/hooks/useFloatingWidget.ts
|
|
15193
|
-
import { useState as useState22, useCallback as
|
|
15228
|
+
import { useState as useState22, useCallback as useCallback13, useEffect as useEffect14, useRef as useRef12 } from "react";
|
|
15194
15229
|
|
|
15195
15230
|
// src/react/hooks/useDragResize.ts
|
|
15196
|
-
import { useState as useState21, useRef as useRef11, useCallback as
|
|
15231
|
+
import { useState as useState21, useRef as useRef11, useCallback as useCallback12, useEffect as useEffect13, useMemo as useMemo6 } from "react";
|
|
15197
15232
|
var DRAG_THRESHOLD = 5;
|
|
15198
15233
|
var FAB_SIZE = 56;
|
|
15199
15234
|
var EDGE_MARGIN = 24;
|
|
@@ -15343,7 +15378,7 @@ var useDragResize = (options) => {
|
|
|
15343
15378
|
if (dragRafRef.current) cancelAnimationFrame(dragRafRef.current);
|
|
15344
15379
|
};
|
|
15345
15380
|
}, []);
|
|
15346
|
-
const handleFabPointerDown =
|
|
15381
|
+
const handleFabPointerDown = useCallback12((e) => {
|
|
15347
15382
|
if (disabled || isMobile) return;
|
|
15348
15383
|
dragCleanupRef.current?.();
|
|
15349
15384
|
const el = e.currentTarget;
|
|
@@ -15557,7 +15592,7 @@ var useDragResize = (options) => {
|
|
|
15557
15592
|
borderRadius: "var(--floating-panel-radius, 16px)"
|
|
15558
15593
|
};
|
|
15559
15594
|
}, [isMobile, disabled, fabPos.x, fabPos.y, panelSize.width, panelSize.height, vw, vh, panelDirection, minHeight]);
|
|
15560
|
-
const handleResizePointerDown =
|
|
15595
|
+
const handleResizePointerDown = useCallback12((edge, e) => {
|
|
15561
15596
|
if (disabled || isMobile) return;
|
|
15562
15597
|
e.preventDefault();
|
|
15563
15598
|
e.stopPropagation();
|
|
@@ -15573,7 +15608,7 @@ var useDragResize = (options) => {
|
|
|
15573
15608
|
};
|
|
15574
15609
|
setIsResizing(true);
|
|
15575
15610
|
}, [disabled, isMobile]);
|
|
15576
|
-
const handleResizePointerMove =
|
|
15611
|
+
const handleResizePointerMove = useCallback12((e) => {
|
|
15577
15612
|
if (!resizeStartRef.current) return;
|
|
15578
15613
|
const { startX, startY, width, height, edge, fabY } = resizeStartRef.current;
|
|
15579
15614
|
const dx = e.clientX - startX;
|
|
@@ -15597,7 +15632,7 @@ var useDragResize = (options) => {
|
|
|
15597
15632
|
newHeight = Math.max(minHeight, Math.min(maxH, newHeight));
|
|
15598
15633
|
setPanelSize({ width: newWidth, height: newHeight });
|
|
15599
15634
|
}, [minWidth, maxWidth, minHeight]);
|
|
15600
|
-
const handleResizePointerUp =
|
|
15635
|
+
const handleResizePointerUp = useCallback12((e) => {
|
|
15601
15636
|
if (!resizeStartRef.current) return;
|
|
15602
15637
|
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
15603
15638
|
resizeStartRef.current = null;
|
|
@@ -15694,15 +15729,15 @@ var useFloatingWidget = (options) => {
|
|
|
15694
15729
|
useEffect14(() => {
|
|
15695
15730
|
onTabChangeRef.current = onTabChange;
|
|
15696
15731
|
}, [onTabChange]);
|
|
15697
|
-
const open =
|
|
15732
|
+
const open = useCallback13(() => {
|
|
15698
15733
|
setIsOpen(true);
|
|
15699
15734
|
onOpenRef.current?.();
|
|
15700
15735
|
}, []);
|
|
15701
|
-
const close =
|
|
15736
|
+
const close = useCallback13(() => {
|
|
15702
15737
|
setIsOpen(false);
|
|
15703
15738
|
onCloseRef.current?.();
|
|
15704
15739
|
}, []);
|
|
15705
|
-
const toggle =
|
|
15740
|
+
const toggle = useCallback13(() => {
|
|
15706
15741
|
setIsOpen((prev) => {
|
|
15707
15742
|
const next = !prev;
|
|
15708
15743
|
if (next) onOpenRef.current?.();
|
|
@@ -15710,11 +15745,11 @@ var useFloatingWidget = (options) => {
|
|
|
15710
15745
|
return next;
|
|
15711
15746
|
});
|
|
15712
15747
|
}, []);
|
|
15713
|
-
const setTab =
|
|
15748
|
+
const setTab = useCallback13((tabKey) => {
|
|
15714
15749
|
setActiveTab(tabKey);
|
|
15715
15750
|
onTabChangeRef.current?.(tabKey);
|
|
15716
15751
|
}, []);
|
|
15717
|
-
const handleFabInteraction =
|
|
15752
|
+
const handleFabInteraction = useCallback13(() => {
|
|
15718
15753
|
if (dragResize.isDragging) return;
|
|
15719
15754
|
toggle();
|
|
15720
15755
|
}, [dragResize.isDragging, toggle]);
|
|
@@ -15747,7 +15782,7 @@ var useFloatingWidget = (options) => {
|
|
|
15747
15782
|
import { useRef as useRef14, useState as useState24, useEffect as useEffect16 } from "react";
|
|
15748
15783
|
|
|
15749
15784
|
// src/react/components/floating/DevDiveCharacter.tsx
|
|
15750
|
-
import { useState as useState23, useEffect as useEffect15, useRef as useRef13, useCallback as
|
|
15785
|
+
import { useState as useState23, useEffect as useEffect15, useRef as useRef13, useCallback as useCallback14 } from "react";
|
|
15751
15786
|
import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
15752
15787
|
var THEMES = {
|
|
15753
15788
|
dark: { body: "#2ecc71", stroke: "#27ae60", highlight: "#3ddc84", face: "#1a1a2e", eyeLight: "#fff" },
|
|
@@ -15782,7 +15817,7 @@ var DevDiveFabCharacter = ({
|
|
|
15782
15817
|
const cleanupRef = useRef13(null);
|
|
15783
15818
|
const lastActivityRef = useRef13(Date.now());
|
|
15784
15819
|
const isSleepyRef = useRef13(false);
|
|
15785
|
-
const markActivity =
|
|
15820
|
+
const markActivity = useCallback14(() => {
|
|
15786
15821
|
lastActivityRef.current = Date.now();
|
|
15787
15822
|
if (isSleepyRef.current) {
|
|
15788
15823
|
isSleepyRef.current = false;
|
|
@@ -16509,7 +16544,7 @@ var FloatingTabBar = ({
|
|
|
16509
16544
|
};
|
|
16510
16545
|
|
|
16511
16546
|
// src/react/components/floating/CompactChatView.tsx
|
|
16512
|
-
import { useState as useState27, useCallback as
|
|
16547
|
+
import { useState as useState27, useCallback as useCallback15 } from "react";
|
|
16513
16548
|
|
|
16514
16549
|
// src/react/components/floating/CompactSessionMenu.tsx
|
|
16515
16550
|
import { useState as useState26, useRef as useRef16, useEffect as useEffect18 } from "react";
|
|
@@ -16855,15 +16890,15 @@ var CompactChatView = ({
|
|
|
16855
16890
|
setInput(choice.text);
|
|
16856
16891
|
};
|
|
16857
16892
|
const [showSessionMenu, setShowSessionMenu] = useState27(false);
|
|
16858
|
-
const handleSessionSelect =
|
|
16893
|
+
const handleSessionSelect = useCallback15((id) => {
|
|
16859
16894
|
selectSession(id);
|
|
16860
16895
|
setShowSessionMenu(false);
|
|
16861
16896
|
}, [selectSession]);
|
|
16862
|
-
const handleNewSession =
|
|
16897
|
+
const handleNewSession = useCallback15(() => {
|
|
16863
16898
|
newSession();
|
|
16864
16899
|
setShowSessionMenu(false);
|
|
16865
16900
|
}, [newSession]);
|
|
16866
|
-
const handleCloseMenu =
|
|
16901
|
+
const handleCloseMenu = useCallback15(() => {
|
|
16867
16902
|
setShowSessionMenu(false);
|
|
16868
16903
|
}, []);
|
|
16869
16904
|
const greeting = personalization?.userProfile?.nickname ? `${personalization.userProfile.nickname}\uB2D8, \uBB34\uC5C7\uC774\uB4E0 \uBB3C\uC5B4\uBCF4\uC138\uC694` : "\uBB34\uC5C7\uC774\uB4E0 \uBB3C\uC5B4\uBCF4\uC138\uC694";
|
|
@@ -17187,7 +17222,7 @@ var ChatFloatingWidget = ({
|
|
|
17187
17222
|
if (!notification) return null;
|
|
17188
17223
|
return typeof notification === "string" ? { text: notification } : notification;
|
|
17189
17224
|
}, [notification]);
|
|
17190
|
-
const handleFabClick =
|
|
17225
|
+
const handleFabClick = useCallback16(() => {
|
|
17191
17226
|
if (notifObj?.onClick) {
|
|
17192
17227
|
notifObj.onClick();
|
|
17193
17228
|
if (!isOpen) handleFabInteraction();
|
|
@@ -17371,7 +17406,7 @@ var ChatFloatingWidget = ({
|
|
|
17371
17406
|
};
|
|
17372
17407
|
|
|
17373
17408
|
// src/react/hooks/useDeepResearch.ts
|
|
17374
|
-
import { useState as useState29, useCallback as
|
|
17409
|
+
import { useState as useState29, useCallback as useCallback17, useRef as useRef18 } from "react";
|
|
17375
17410
|
var REPORT_GENERATION_PROMPT2 = `\uB2F9\uC2E0\uC740 \uB9AC\uC11C\uCE58 \uBCF4\uACE0\uC11C \uC791\uC131 \uC804\uBB38\uAC00\uC785\uB2C8\uB2E4.
|
|
17376
17411
|
|
|
17377
17412
|
<collected_sources>
|
|
@@ -17425,7 +17460,7 @@ var useDeepResearch = (options) => {
|
|
|
17425
17460
|
const [isResearching, setIsResearching] = useState29(false);
|
|
17426
17461
|
const [progress, setProgress] = useState29(null);
|
|
17427
17462
|
const abortControllerRef = useRef18(null);
|
|
17428
|
-
const callLLM2 =
|
|
17463
|
+
const callLLM2 = useCallback17(
|
|
17429
17464
|
async (prompt, stream = false) => {
|
|
17430
17465
|
const response = await fetch(apiEndpoint, {
|
|
17431
17466
|
method: "POST",
|
|
@@ -17452,7 +17487,7 @@ var useDeepResearch = (options) => {
|
|
|
17452
17487
|
},
|
|
17453
17488
|
[apiEndpoint, apiKey, model, provider]
|
|
17454
17489
|
);
|
|
17455
|
-
const analyzeQuery2 =
|
|
17490
|
+
const analyzeQuery2 = useCallback17(
|
|
17456
17491
|
async (query) => {
|
|
17457
17492
|
const prompt = QUERY_ANALYSIS_PROMPT2.replace("{question}", query);
|
|
17458
17493
|
const response = await callLLM2(prompt);
|
|
@@ -17471,7 +17506,7 @@ var useDeepResearch = (options) => {
|
|
|
17471
17506
|
},
|
|
17472
17507
|
[callLLM2]
|
|
17473
17508
|
);
|
|
17474
|
-
const runSubAgent2 =
|
|
17509
|
+
const runSubAgent2 = useCallback17(
|
|
17475
17510
|
async (topic, queries, agentId, updateProgress) => {
|
|
17476
17511
|
updateProgress({ status: "searching", searchCount: 0, resultsCount: 0 });
|
|
17477
17512
|
const allResults = [];
|
|
@@ -17510,7 +17545,7 @@ var useDeepResearch = (options) => {
|
|
|
17510
17545
|
},
|
|
17511
17546
|
[onWebSearch, onExtractContent]
|
|
17512
17547
|
);
|
|
17513
|
-
const generateReport2 =
|
|
17548
|
+
const generateReport2 = useCallback17(
|
|
17514
17549
|
async (query, results, onStreamContent) => {
|
|
17515
17550
|
const allSources = [];
|
|
17516
17551
|
const sourcesForPrompt = [];
|
|
@@ -17568,7 +17603,7 @@ var useDeepResearch = (options) => {
|
|
|
17568
17603
|
},
|
|
17569
17604
|
[callLLM2]
|
|
17570
17605
|
);
|
|
17571
|
-
const runDeepResearch =
|
|
17606
|
+
const runDeepResearch = useCallback17(
|
|
17572
17607
|
async (query, onStreamContent) => {
|
|
17573
17608
|
abortControllerRef.current = new AbortController();
|
|
17574
17609
|
setIsResearching(true);
|
|
@@ -17671,7 +17706,7 @@ var useDeepResearch = (options) => {
|
|
|
17671
17706
|
},
|
|
17672
17707
|
[analyzeQuery2, runSubAgent2, generateReport2]
|
|
17673
17708
|
);
|
|
17674
|
-
const stopResearch =
|
|
17709
|
+
const stopResearch = useCallback17(() => {
|
|
17675
17710
|
abortControllerRef.current?.abort();
|
|
17676
17711
|
setIsResearching(false);
|
|
17677
17712
|
setProgress(null);
|
|
@@ -18236,6 +18271,7 @@ export {
|
|
|
18236
18271
|
Icon,
|
|
18237
18272
|
IconSvg,
|
|
18238
18273
|
ImageContentCard,
|
|
18274
|
+
ImageErrorContext,
|
|
18239
18275
|
LinkChip,
|
|
18240
18276
|
MarkdownRenderer,
|
|
18241
18277
|
MemoryPanel,
|
|
@@ -18257,6 +18293,7 @@ export {
|
|
|
18257
18293
|
useDeepResearch,
|
|
18258
18294
|
useDragResize,
|
|
18259
18295
|
useFloatingWidget,
|
|
18296
|
+
useImageError,
|
|
18260
18297
|
useObserver,
|
|
18261
18298
|
useProject,
|
|
18262
18299
|
useSkills
|