@malette/agent-sdk 0.1.0 → 0.1.1-alpha.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.
- package/README.md +1 -0
- package/dist/index.js +567 -814
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +136 -383
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +3818 -240
- package/package.json +8 -3
package/dist/index.js
CHANGED
|
@@ -4,9 +4,9 @@ var Cookies2 = require('js-cookie');
|
|
|
4
4
|
var OSS = require('ali-oss');
|
|
5
5
|
var zustand = require('zustand');
|
|
6
6
|
var middleware = require('zustand/middleware');
|
|
7
|
-
var
|
|
8
|
-
var ReactMarkdown = require('react-markdown');
|
|
7
|
+
var React20 = require('react');
|
|
9
8
|
var lucideReact = require('lucide-react');
|
|
9
|
+
var ReactMarkdown = require('react-markdown');
|
|
10
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
11
|
var shallow = require('zustand/react/shallow');
|
|
12
12
|
var DialogPrimitive = require('@radix-ui/react-dialog');
|
|
@@ -36,7 +36,7 @@ function _interopNamespace(e) {
|
|
|
36
36
|
|
|
37
37
|
var Cookies2__default = /*#__PURE__*/_interopDefault(Cookies2);
|
|
38
38
|
var OSS__default = /*#__PURE__*/_interopDefault(OSS);
|
|
39
|
-
var
|
|
39
|
+
var React20__namespace = /*#__PURE__*/_interopNamespace(React20);
|
|
40
40
|
var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
|
|
41
41
|
var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
|
|
42
42
|
var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPrimitive);
|
|
@@ -1369,15 +1369,15 @@ async function fetchBackendExtraData(localMessageId, backendMessageId, updateMes
|
|
|
1369
1369
|
}
|
|
1370
1370
|
}
|
|
1371
1371
|
function useSSE(options) {
|
|
1372
|
-
const abortControllerRef =
|
|
1373
|
-
const currentMessageIdRef =
|
|
1374
|
-
const [isConnected, setIsConnected] =
|
|
1375
|
-
const heartbeatTimeoutRef =
|
|
1376
|
-
const reconnectAttemptsRef =
|
|
1377
|
-
const lastActivityTimeRef =
|
|
1378
|
-
const isReconnectingRef =
|
|
1379
|
-
const currentSessionIdRef =
|
|
1380
|
-
const currentLocalMessageIdRef =
|
|
1372
|
+
const abortControllerRef = React20.useRef(null);
|
|
1373
|
+
const currentMessageIdRef = React20.useRef(null);
|
|
1374
|
+
const [isConnected, setIsConnected] = React20.useState(false);
|
|
1375
|
+
const heartbeatTimeoutRef = React20.useRef(null);
|
|
1376
|
+
const reconnectAttemptsRef = React20.useRef(0);
|
|
1377
|
+
const lastActivityTimeRef = React20.useRef(Date.now());
|
|
1378
|
+
const isReconnectingRef = React20.useRef(false);
|
|
1379
|
+
const currentSessionIdRef = React20.useRef(null);
|
|
1380
|
+
const currentLocalMessageIdRef = React20.useRef(null);
|
|
1381
1381
|
const {
|
|
1382
1382
|
addMessage,
|
|
1383
1383
|
updateMessage,
|
|
@@ -1407,13 +1407,13 @@ function useSSE(options) {
|
|
|
1407
1407
|
setWaitingStepId,
|
|
1408
1408
|
clearPlanState
|
|
1409
1409
|
} = useAgentStore();
|
|
1410
|
-
const clearHeartbeatTimeout =
|
|
1410
|
+
const clearHeartbeatTimeout = React20.useCallback(() => {
|
|
1411
1411
|
if (heartbeatTimeoutRef.current) {
|
|
1412
1412
|
clearTimeout(heartbeatTimeoutRef.current);
|
|
1413
1413
|
heartbeatTimeoutRef.current = null;
|
|
1414
1414
|
}
|
|
1415
1415
|
}, []);
|
|
1416
|
-
const resetHeartbeatTimeout =
|
|
1416
|
+
const resetHeartbeatTimeout = React20.useCallback((onTimeout) => {
|
|
1417
1417
|
lastActivityTimeRef.current = Date.now();
|
|
1418
1418
|
clearHeartbeatTimeout();
|
|
1419
1419
|
heartbeatTimeoutRef.current = setTimeout(() => {
|
|
@@ -1421,17 +1421,17 @@ function useSSE(options) {
|
|
|
1421
1421
|
onTimeout();
|
|
1422
1422
|
}, SSE_HEARTBEAT_TIMEOUT);
|
|
1423
1423
|
}, [clearHeartbeatTimeout]);
|
|
1424
|
-
const getReconnectDelay =
|
|
1424
|
+
const getReconnectDelay = React20.useCallback(() => {
|
|
1425
1425
|
const attempt = reconnectAttemptsRef.current;
|
|
1426
1426
|
const delay = RECONNECT_BASE_DELAY * Math.pow(2, attempt);
|
|
1427
1427
|
return Math.min(delay, 8e3);
|
|
1428
1428
|
}, []);
|
|
1429
|
-
|
|
1429
|
+
React20.useEffect(() => {
|
|
1430
1430
|
return () => {
|
|
1431
1431
|
clearHeartbeatTimeout();
|
|
1432
1432
|
};
|
|
1433
1433
|
}, [clearHeartbeatTimeout]);
|
|
1434
|
-
const handleFinalEvent =
|
|
1434
|
+
const handleFinalEvent = React20.useCallback(async (data, localMessageId) => {
|
|
1435
1435
|
setIsStreaming(false);
|
|
1436
1436
|
setIsThinking(false);
|
|
1437
1437
|
clearStreamingContent();
|
|
@@ -1490,7 +1490,7 @@ function useSSE(options) {
|
|
|
1490
1490
|
}
|
|
1491
1491
|
options?.onComplete?.(data.content);
|
|
1492
1492
|
}, [setIsStreaming, setIsThinking, clearStreamingContent, updateMessage, clearThoughts, options]);
|
|
1493
|
-
const normalizeToolCalls2 =
|
|
1493
|
+
const normalizeToolCalls2 = React20.useCallback((toolCalls) => {
|
|
1494
1494
|
if (!Array.isArray(toolCalls)) return [];
|
|
1495
1495
|
return toolCalls.map((tc) => ({
|
|
1496
1496
|
id: tc.id || tc.toolCallId || generateId(),
|
|
@@ -1504,7 +1504,7 @@ function useSSE(options) {
|
|
|
1504
1504
|
endTime: tc.endTime
|
|
1505
1505
|
}));
|
|
1506
1506
|
}, []);
|
|
1507
|
-
const handleThoughtEvent =
|
|
1507
|
+
const handleThoughtEvent = React20.useCallback((eventType, data, localMessageId) => {
|
|
1508
1508
|
if (eventType === "reasoning_error") {
|
|
1509
1509
|
const errorContent = data.content || data.error || data.message || "\u53D1\u751F\u9519\u8BEF";
|
|
1510
1510
|
setIsStreaming(false);
|
|
@@ -2188,7 +2188,7 @@ function useSSE(options) {
|
|
|
2188
2188
|
clearPlanState,
|
|
2189
2189
|
options
|
|
2190
2190
|
]);
|
|
2191
|
-
const processSSEStream =
|
|
2191
|
+
const processSSEStream = React20.useCallback(async (response, localMessageId, onMessageStart) => {
|
|
2192
2192
|
const reader = response.body?.getReader();
|
|
2193
2193
|
const decoder = new TextDecoder();
|
|
2194
2194
|
let buffer = "";
|
|
@@ -2270,7 +2270,7 @@ function useSSE(options) {
|
|
|
2270
2270
|
}
|
|
2271
2271
|
}
|
|
2272
2272
|
}, [handleThoughtEvent, resetHeartbeatTimeout, clearHeartbeatTimeout, getReconnectDelay, setChatError]);
|
|
2273
|
-
const sendMessage =
|
|
2273
|
+
const sendMessage = React20.useCallback(async (sessionId, content, sendOptions) => {
|
|
2274
2274
|
abortControllerRef.current?.abort();
|
|
2275
2275
|
abortControllerRef.current = new AbortController();
|
|
2276
2276
|
clearThoughts();
|
|
@@ -2397,7 +2397,7 @@ function useSSE(options) {
|
|
|
2397
2397
|
processSSEStream,
|
|
2398
2398
|
options
|
|
2399
2399
|
]);
|
|
2400
|
-
const reconnect =
|
|
2400
|
+
const reconnect = React20.useCallback(async (messageId) => {
|
|
2401
2401
|
abortControllerRef.current?.abort();
|
|
2402
2402
|
abortControllerRef.current = new AbortController();
|
|
2403
2403
|
clearThoughts();
|
|
@@ -2421,7 +2421,7 @@ function useSSE(options) {
|
|
|
2421
2421
|
currentMessageIdRef.current = null;
|
|
2422
2422
|
}
|
|
2423
2423
|
}, [clearThoughts, clearStreamingContent, clearPendingToolCalls, setIsThinking, setIsStreaming, processSSEStream, options]);
|
|
2424
|
-
const abort =
|
|
2424
|
+
const abort = React20.useCallback(async () => {
|
|
2425
2425
|
clearHeartbeatTimeout();
|
|
2426
2426
|
reconnectAttemptsRef.current = 0;
|
|
2427
2427
|
isReconnectingRef.current = false;
|
|
@@ -6527,75 +6527,6 @@ function remarkGfm(options) {
|
|
|
6527
6527
|
fromMarkdownExtensions.push(gfmFromMarkdown());
|
|
6528
6528
|
toMarkdownExtensions.push(gfmToMarkdown(settings));
|
|
6529
6529
|
}
|
|
6530
|
-
|
|
6531
|
-
// src/utils/asset.ts
|
|
6532
|
-
var isHttpUrl = (value) => {
|
|
6533
|
-
if (!value) return false;
|
|
6534
|
-
try {
|
|
6535
|
-
const url = new URL(value);
|
|
6536
|
-
return url.protocol === "http:" || url.protocol === "https:";
|
|
6537
|
-
} catch {
|
|
6538
|
-
return false;
|
|
6539
|
-
}
|
|
6540
|
-
};
|
|
6541
|
-
var isVideoUrl = (url) => {
|
|
6542
|
-
if (!url) return false;
|
|
6543
|
-
try {
|
|
6544
|
-
const urlObj = new URL(url, "http://dummy");
|
|
6545
|
-
const pathname = urlObj.pathname.toLowerCase();
|
|
6546
|
-
return /\.(mp4|mov|webm|avi|mkv|m4v)$/i.test(pathname);
|
|
6547
|
-
} catch {
|
|
6548
|
-
const lower = url.toLowerCase();
|
|
6549
|
-
return /\.(mp4|mov|webm|avi|mkv|m4v)(\?|#|$)/i.test(lower);
|
|
6550
|
-
}
|
|
6551
|
-
};
|
|
6552
|
-
var inferAssetTypeFromFile = (file) => {
|
|
6553
|
-
if (!file) return "file";
|
|
6554
|
-
if (file.type?.startsWith("video/")) return "video";
|
|
6555
|
-
if (file.type?.startsWith("image/")) return "image";
|
|
6556
|
-
return "file";
|
|
6557
|
-
};
|
|
6558
|
-
var inferAssetTypeFromUrl = (url) => {
|
|
6559
|
-
if (!url) return "file";
|
|
6560
|
-
return isVideoUrl(url) ? "video" : "image";
|
|
6561
|
-
};
|
|
6562
|
-
var createAssetFromSource = (options) => {
|
|
6563
|
-
const { fileId, fileUrl, type } = options;
|
|
6564
|
-
if (!fileId && !fileUrl) return null;
|
|
6565
|
-
const url = fileUrl && isHttpUrl(fileUrl) ? fileUrl : void 0;
|
|
6566
|
-
const inferredFileId = fileId || (!url && fileUrl ? fileUrl : void 0);
|
|
6567
|
-
const assetType = type || (url ? inferAssetTypeFromUrl(url) : "image");
|
|
6568
|
-
return {
|
|
6569
|
-
type: assetType,
|
|
6570
|
-
fileId: inferredFileId,
|
|
6571
|
-
url
|
|
6572
|
-
};
|
|
6573
|
-
};
|
|
6574
|
-
var resolveAssetForDisplay = async (asset, config) => {
|
|
6575
|
-
let working = asset;
|
|
6576
|
-
const strategy = config?.asset;
|
|
6577
|
-
if (strategy?.resolve && !working.url) {
|
|
6578
|
-
working = await strategy.resolve(working);
|
|
6579
|
-
}
|
|
6580
|
-
if (strategy?.transform) {
|
|
6581
|
-
working = strategy.transform(working);
|
|
6582
|
-
}
|
|
6583
|
-
if (strategy?.render) {
|
|
6584
|
-
return strategy.render(working);
|
|
6585
|
-
}
|
|
6586
|
-
if (working.url) {
|
|
6587
|
-
return {
|
|
6588
|
-
url: working.url,
|
|
6589
|
-
hdUrl: working.url,
|
|
6590
|
-
isVideo: working.type === "video" || inferAssetTypeFromUrl(working.url) === "video"
|
|
6591
|
-
};
|
|
6592
|
-
}
|
|
6593
|
-
if (working.fileId) {
|
|
6594
|
-
const resolved = resolveMediaUrl({ fileId: working.fileId });
|
|
6595
|
-
if (resolved) return resolved;
|
|
6596
|
-
}
|
|
6597
|
-
return null;
|
|
6598
|
-
};
|
|
6599
6530
|
function formatTime(timestamp) {
|
|
6600
6531
|
const date = new Date(timestamp);
|
|
6601
6532
|
return date.toLocaleTimeString("zh-CN", {
|
|
@@ -6653,8 +6584,8 @@ function getStepTypeInfo(type) {
|
|
|
6653
6584
|
};
|
|
6654
6585
|
}
|
|
6655
6586
|
}
|
|
6656
|
-
var ToolCallCard =
|
|
6657
|
-
const [expanded, setExpanded] =
|
|
6587
|
+
var ToolCallCard = React20.memo(function ToolCallCard2({ toolCall }) {
|
|
6588
|
+
const [expanded, setExpanded] = React20.useState(false);
|
|
6658
6589
|
const status = toolCall.status?.toUpperCase?.() || "PENDING";
|
|
6659
6590
|
const isPending = status === "PENDING";
|
|
6660
6591
|
const isSuccess = status === "SUCCESS" || status === "COMPLETED";
|
|
@@ -6753,7 +6684,7 @@ var ToolCallCard = React21.memo(function ToolCallCard2({ toolCall }) {
|
|
|
6753
6684
|
] })
|
|
6754
6685
|
] });
|
|
6755
6686
|
});
|
|
6756
|
-
var ThoughtStepCard =
|
|
6687
|
+
var ThoughtStepCard = React20.memo(function ThoughtStepCard2({
|
|
6757
6688
|
step,
|
|
6758
6689
|
isSubAgent,
|
|
6759
6690
|
isStreaming
|
|
@@ -6825,7 +6756,7 @@ var ThoughtStepCard = React21.memo(function ThoughtStepCard2({
|
|
|
6825
6756
|
] })
|
|
6826
6757
|
] });
|
|
6827
6758
|
});
|
|
6828
|
-
var SubAgentsSummary =
|
|
6759
|
+
var SubAgentsSummary = React20.memo(function SubAgentsSummary2({
|
|
6829
6760
|
subAgents
|
|
6830
6761
|
}) {
|
|
6831
6762
|
if (subAgents.length === 0) return null;
|
|
@@ -6906,11 +6837,11 @@ function mergeConsecutiveSteps(steps) {
|
|
|
6906
6837
|
}
|
|
6907
6838
|
return merged;
|
|
6908
6839
|
}
|
|
6909
|
-
var MultiAgentThoughts =
|
|
6840
|
+
var MultiAgentThoughts = React20.memo(function MultiAgentThoughts2({
|
|
6910
6841
|
thoughts,
|
|
6911
6842
|
isStreaming
|
|
6912
6843
|
}) {
|
|
6913
|
-
const { sortedSteps, subAgents, isMultiAgent } =
|
|
6844
|
+
const { sortedSteps, subAgents, isMultiAgent } = React20.useMemo(() => {
|
|
6914
6845
|
const rawSteps = thoughts.map((t) => ({
|
|
6915
6846
|
id: t.id,
|
|
6916
6847
|
type: t.type,
|
|
@@ -6961,6 +6892,76 @@ var MultiAgentThoughts = React21.memo(function MultiAgentThoughts2({
|
|
|
6961
6892
|
});
|
|
6962
6893
|
var MultiAgentThoughts_default = MultiAgentThoughts;
|
|
6963
6894
|
|
|
6895
|
+
// src/utils/asset.ts
|
|
6896
|
+
var isHttpUrl = (value) => {
|
|
6897
|
+
if (!value) return false;
|
|
6898
|
+
try {
|
|
6899
|
+
const url = new URL(value);
|
|
6900
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
6901
|
+
} catch {
|
|
6902
|
+
return false;
|
|
6903
|
+
}
|
|
6904
|
+
};
|
|
6905
|
+
var isVideoUrl = (url) => {
|
|
6906
|
+
if (!url) return false;
|
|
6907
|
+
try {
|
|
6908
|
+
const urlObj = new URL(url, "http://dummy");
|
|
6909
|
+
const pathname = urlObj.pathname.toLowerCase();
|
|
6910
|
+
return /\.(mp4|mov|webm|avi|mkv|m4v)$/i.test(pathname);
|
|
6911
|
+
} catch {
|
|
6912
|
+
const lower = url.toLowerCase();
|
|
6913
|
+
return /\.(mp4|mov|webm|avi|mkv|m4v)(\?|#|$)/i.test(lower);
|
|
6914
|
+
}
|
|
6915
|
+
};
|
|
6916
|
+
var inferAssetTypeFromFile = (file) => {
|
|
6917
|
+
if (!file) return "file";
|
|
6918
|
+
if (file.type?.startsWith("video/")) return "video";
|
|
6919
|
+
if (file.type?.startsWith("image/")) return "image";
|
|
6920
|
+
return "file";
|
|
6921
|
+
};
|
|
6922
|
+
var inferAssetTypeFromUrl = (url) => {
|
|
6923
|
+
if (!url) return "file";
|
|
6924
|
+
return isVideoUrl(url) ? "video" : "image";
|
|
6925
|
+
};
|
|
6926
|
+
var createAssetFromSource = (options) => {
|
|
6927
|
+
const { fileId, fileUrl, type } = options;
|
|
6928
|
+
if (!fileId && !fileUrl) return null;
|
|
6929
|
+
const url = fileUrl && isHttpUrl(fileUrl) ? fileUrl : void 0;
|
|
6930
|
+
const inferredFileId = fileId || (!url && fileUrl ? fileUrl : void 0);
|
|
6931
|
+
const assetType = type || (url ? inferAssetTypeFromUrl(url) : "image");
|
|
6932
|
+
return {
|
|
6933
|
+
type: assetType,
|
|
6934
|
+
fileId: inferredFileId,
|
|
6935
|
+
url
|
|
6936
|
+
};
|
|
6937
|
+
};
|
|
6938
|
+
var resolveAssetForDisplay = async (asset, config) => {
|
|
6939
|
+
let working = asset;
|
|
6940
|
+
const strategy = config?.asset;
|
|
6941
|
+
console.log("Resolving asset for display:", asset, "with strategy:", strategy);
|
|
6942
|
+
if (strategy?.resolve && !working.url) {
|
|
6943
|
+
working = await strategy.resolve(working);
|
|
6944
|
+
}
|
|
6945
|
+
if (strategy?.transform) {
|
|
6946
|
+
working = strategy.transform(working);
|
|
6947
|
+
}
|
|
6948
|
+
if (strategy?.render) {
|
|
6949
|
+
return strategy.render(working);
|
|
6950
|
+
}
|
|
6951
|
+
if (working.fileId) {
|
|
6952
|
+
const resolved = resolveMediaUrl({ fileId: working.fileId });
|
|
6953
|
+
if (resolved) return resolved;
|
|
6954
|
+
}
|
|
6955
|
+
if (working.url) {
|
|
6956
|
+
return {
|
|
6957
|
+
url: working.url,
|
|
6958
|
+
hdUrl: working.url,
|
|
6959
|
+
isVideo: working.type === "video" || inferAssetTypeFromUrl(working.url) === "video"
|
|
6960
|
+
};
|
|
6961
|
+
}
|
|
6962
|
+
return null;
|
|
6963
|
+
};
|
|
6964
|
+
|
|
6964
6965
|
// ../../node_modules/clsx/dist/clsx.mjs
|
|
6965
6966
|
function r(e) {
|
|
6966
6967
|
var t, f, n = "";
|
|
@@ -7330,7 +7331,7 @@ var fractionRegex = /^\d+\/\d+$/;
|
|
|
7330
7331
|
var stringLengths = /* @__PURE__ */ new Set(["px", "full", "screen"]);
|
|
7331
7332
|
var tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
|
|
7332
7333
|
var lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
|
|
7333
|
-
var colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/;
|
|
7334
|
+
var colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/;
|
|
7334
7335
|
var shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
|
|
7335
7336
|
var imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
|
|
7336
7337
|
var isLength = (value) => isNumber(value) || stringLengths.has(value) || fractionRegex.test(value);
|
|
@@ -9627,12 +9628,12 @@ function highlightJson(content) {
|
|
|
9627
9628
|
}
|
|
9628
9629
|
return tokens;
|
|
9629
9630
|
}
|
|
9630
|
-
var StreamingJsonDisplay =
|
|
9631
|
+
var StreamingJsonDisplay = React20.memo(function StreamingJsonDisplay2({
|
|
9631
9632
|
content,
|
|
9632
9633
|
className
|
|
9633
9634
|
}) {
|
|
9634
|
-
const jsonContent =
|
|
9635
|
-
const formattedContent =
|
|
9635
|
+
const jsonContent = React20.useMemo(() => extractJsonContent(content), [content]);
|
|
9636
|
+
const formattedContent = React20.useMemo(() => {
|
|
9636
9637
|
try {
|
|
9637
9638
|
const parsed = JSON.parse(jsonContent);
|
|
9638
9639
|
return JSON.stringify(parsed, null, 2);
|
|
@@ -9640,7 +9641,7 @@ var StreamingJsonDisplay = React21.memo(function StreamingJsonDisplay2({
|
|
|
9640
9641
|
return formatPartialJson(jsonContent);
|
|
9641
9642
|
}
|
|
9642
9643
|
}, [jsonContent]);
|
|
9643
|
-
const highlightedTokens =
|
|
9644
|
+
const highlightedTokens = React20.useMemo(() => {
|
|
9644
9645
|
return highlightJson(formattedContent);
|
|
9645
9646
|
}, [formattedContent]);
|
|
9646
9647
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(
|
|
@@ -9756,7 +9757,7 @@ var collectMediaAssetsFromResult = (result) => {
|
|
|
9756
9757
|
}
|
|
9757
9758
|
return assets;
|
|
9758
9759
|
};
|
|
9759
|
-
var PlanMarkdownContent =
|
|
9760
|
+
var PlanMarkdownContent = React20.memo(function PlanMarkdownContent2({
|
|
9760
9761
|
content,
|
|
9761
9762
|
className = ""
|
|
9762
9763
|
}) {
|
|
@@ -9813,12 +9814,12 @@ var PlanMarkdownContent = React21.memo(function PlanMarkdownContent2({
|
|
|
9813
9814
|
}
|
|
9814
9815
|
) });
|
|
9815
9816
|
});
|
|
9816
|
-
var ImagePreviewModal =
|
|
9817
|
+
var ImagePreviewModal = React20.memo(function ImagePreviewModal2({
|
|
9817
9818
|
src,
|
|
9818
9819
|
onClose,
|
|
9819
9820
|
config
|
|
9820
9821
|
}) {
|
|
9821
|
-
|
|
9822
|
+
React20.useEffect(() => {
|
|
9822
9823
|
const handleKeyDown = (e) => {
|
|
9823
9824
|
if (e.key === "Escape") onClose();
|
|
9824
9825
|
};
|
|
@@ -9877,22 +9878,22 @@ var ImagePreviewModal = React21.memo(function ImagePreviewModal2({
|
|
|
9877
9878
|
}
|
|
9878
9879
|
);
|
|
9879
9880
|
});
|
|
9880
|
-
var StepResultRenderer =
|
|
9881
|
+
var StepResultRenderer = React20.memo(function StepResultRenderer2({
|
|
9881
9882
|
result,
|
|
9882
9883
|
stepType,
|
|
9883
9884
|
toolInput,
|
|
9884
9885
|
stepStatus,
|
|
9885
9886
|
config
|
|
9886
9887
|
}) {
|
|
9887
|
-
const [showDetails, setShowDetails] =
|
|
9888
|
-
const [showPlannedParams, setShowPlannedParams] =
|
|
9889
|
-
const [copied, setCopied] =
|
|
9890
|
-
const [previewImage, setPreviewImage] =
|
|
9891
|
-
const [imgLoaded, setImgLoaded] =
|
|
9892
|
-
const [imgError, setImgError] =
|
|
9893
|
-
const [media, setMedia] =
|
|
9894
|
-
const text3 =
|
|
9895
|
-
|
|
9888
|
+
const [showDetails, setShowDetails] = React20.useState(false);
|
|
9889
|
+
const [showPlannedParams, setShowPlannedParams] = React20.useState(false);
|
|
9890
|
+
const [copied, setCopied] = React20.useState(false);
|
|
9891
|
+
const [previewImage, setPreviewImage] = React20.useState(null);
|
|
9892
|
+
const [imgLoaded, setImgLoaded] = React20.useState({});
|
|
9893
|
+
const [imgError, setImgError] = React20.useState({});
|
|
9894
|
+
const [media, setMedia] = React20.useState([]);
|
|
9895
|
+
const text3 = React20.useMemo(() => extractTextContent(result), [result]);
|
|
9896
|
+
React20.useEffect(() => {
|
|
9896
9897
|
let active = true;
|
|
9897
9898
|
const loadMedia = async () => {
|
|
9898
9899
|
const assets = collectMediaAssetsFromResult(result);
|
|
@@ -9922,11 +9923,11 @@ var StepResultRenderer = React21.memo(function StepResultRenderer2({
|
|
|
9922
9923
|
}, [result, config]);
|
|
9923
9924
|
const isToolCall = stepType === "TOOL_CALL";
|
|
9924
9925
|
const isCompleted = stepStatus === "COMPLETED";
|
|
9925
|
-
const actualParams =
|
|
9926
|
+
const actualParams = React20.useMemo(() => {
|
|
9926
9927
|
if (!result || typeof result !== "object") return null;
|
|
9927
9928
|
return result.actualArguments || result.executedArguments || result.input || null;
|
|
9928
9929
|
}, [result]);
|
|
9929
|
-
const paramsChanged =
|
|
9930
|
+
const paramsChanged = React20.useMemo(() => {
|
|
9930
9931
|
if (!toolInput || !actualParams) return false;
|
|
9931
9932
|
return JSON.stringify(toolInput) !== JSON.stringify(actualParams);
|
|
9932
9933
|
}, [toolInput, actualParams]);
|
|
@@ -9997,7 +9998,7 @@ var StepResultRenderer = React21.memo(function StepResultRenderer2({
|
|
|
9997
9998
|
className: "relative group/plan-img cursor-zoom-in",
|
|
9998
9999
|
onClick: () => setPreviewImage(item.hdUrl),
|
|
9999
10000
|
children: [
|
|
10000
|
-
!imgLoaded[i] && !imgError[i] && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-20 h-20 rounded-lg bg-zinc-800 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10001
|
+
!imgLoaded[i] && !imgError[i] && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-20 h-20 rounded-lg bg-zinc-800 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "animate-spin rounded-full h-4 w-4 border-b-2 border-[#d8ff00]" }) }),
|
|
10001
10002
|
imgError[i] && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-20 h-20 rounded-lg bg-zinc-800 flex items-center justify-center border border-zinc-700", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Image, { className: "w-5 h-5 text-zinc-600" }) }),
|
|
10002
10003
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10003
10004
|
"img",
|
|
@@ -10060,7 +10061,7 @@ var StepResultRenderer = React21.memo(function StepResultRenderer2({
|
|
|
10060
10061
|
] })
|
|
10061
10062
|
] });
|
|
10062
10063
|
});
|
|
10063
|
-
var StepItem =
|
|
10064
|
+
var StepItem = React20.memo(function StepItem2({
|
|
10064
10065
|
step,
|
|
10065
10066
|
index,
|
|
10066
10067
|
isWaitingInput,
|
|
@@ -10068,8 +10069,8 @@ var StepItem = React21.memo(function StepItem2({
|
|
|
10068
10069
|
streamingContent,
|
|
10069
10070
|
onHumanInput
|
|
10070
10071
|
}) {
|
|
10071
|
-
const [inputValue, setInputValue] =
|
|
10072
|
-
const [submitting, setSubmitting] =
|
|
10072
|
+
const [inputValue, setInputValue] = React20.useState("");
|
|
10073
|
+
const [submitting, setSubmitting] = React20.useState(false);
|
|
10073
10074
|
const style = getStepStatusStyle(step.status);
|
|
10074
10075
|
const isRunning = step.status === "RUNNING" || isCurrentStep && step.status !== "COMPLETED" && step.status !== "FAILED";
|
|
10075
10076
|
const handleSubmit = async () => {
|
|
@@ -10079,7 +10080,7 @@ var StepItem = React21.memo(function StepItem2({
|
|
|
10079
10080
|
setSubmitting(false);
|
|
10080
10081
|
setInputValue("");
|
|
10081
10082
|
};
|
|
10082
|
-
const executionTime =
|
|
10083
|
+
const executionTime = React20.useMemo(() => {
|
|
10083
10084
|
const s = step;
|
|
10084
10085
|
if (s.startTime && s.endTime) {
|
|
10085
10086
|
const duration = s.endTime - s.startTime;
|
|
@@ -10177,7 +10178,7 @@ var StepItem = React21.memo(function StepItem2({
|
|
|
10177
10178
|
] }) })
|
|
10178
10179
|
] });
|
|
10179
10180
|
});
|
|
10180
|
-
var PlanCard =
|
|
10181
|
+
var PlanCard = React20.memo(function PlanCard2({
|
|
10181
10182
|
plan = {},
|
|
10182
10183
|
isProcessing = false,
|
|
10183
10184
|
waitingStepId,
|
|
@@ -10192,10 +10193,10 @@ var PlanCard = React21.memo(function PlanCard2({
|
|
|
10192
10193
|
onSkip,
|
|
10193
10194
|
onCancel
|
|
10194
10195
|
}) {
|
|
10195
|
-
const [expanded, setExpanded] =
|
|
10196
|
+
const [expanded, setExpanded] = React20.useState(true);
|
|
10196
10197
|
const rawSteps = Array.isArray(plan?.steps) ? plan?.steps : plan?.steps?.steps || [];
|
|
10197
10198
|
const validSteps = rawSteps.filter((step) => step && step.type && !("$ref" in step)) || [];
|
|
10198
|
-
|
|
10199
|
+
React20.useEffect(() => {
|
|
10199
10200
|
console.log("[PlanCard] ===== \u6570\u636E\u8BCA\u65AD =====");
|
|
10200
10201
|
console.log("[PlanCard] plan.status:", plan.status);
|
|
10201
10202
|
console.log("[PlanCard] \u540E\u7AEF completedSteps:", plan.completedSteps, "(\u6CE8\u610F: \u540E\u7AEF\u6709bug\uFF0C\u53EF\u80FD\u591A1)");
|
|
@@ -10211,7 +10212,7 @@ var PlanCard = React21.memo(function PlanCard2({
|
|
|
10211
10212
|
const isPaused = plan.status === "PAUSED";
|
|
10212
10213
|
const isCancelled = plan.status === "CANCELLED";
|
|
10213
10214
|
const hasError = isPaused && !!plan.errorMessage;
|
|
10214
|
-
|
|
10215
|
+
React20.useMemo(() => {
|
|
10215
10216
|
if (hasError) {
|
|
10216
10217
|
const failedIndex = plan.failedStepIndex;
|
|
10217
10218
|
if (failedIndex !== void 0 && failedIndex >= 0) {
|
|
@@ -10221,21 +10222,21 @@ var PlanCard = React21.memo(function PlanCard2({
|
|
|
10221
10222
|
}
|
|
10222
10223
|
return null;
|
|
10223
10224
|
}, [hasError, plan, validSteps]);
|
|
10224
|
-
const completedCount =
|
|
10225
|
+
const completedCount = React20.useMemo(() => {
|
|
10225
10226
|
const count = validSteps.filter((s) => {
|
|
10226
10227
|
const status = (s.status || "").toUpperCase();
|
|
10227
10228
|
return status === "COMPLETED" || status === "SUCCESS" || status === "DONE";
|
|
10228
10229
|
}).length;
|
|
10229
10230
|
return Math.min(count, validSteps.length);
|
|
10230
10231
|
}, [validSteps]);
|
|
10231
|
-
const allStepsCompleted =
|
|
10232
|
+
const allStepsCompleted = React20.useMemo(() => {
|
|
10232
10233
|
if (validSteps.length === 0) return false;
|
|
10233
10234
|
return validSteps.every((s) => {
|
|
10234
10235
|
const status = (s.status || "").toUpperCase();
|
|
10235
10236
|
return status === "COMPLETED" || status === "SKIPPED" || status === "SUCCESS" || status === "DONE";
|
|
10236
10237
|
});
|
|
10237
10238
|
}, [validSteps]);
|
|
10238
|
-
const waitingStep =
|
|
10239
|
+
const waitingStep = React20.useMemo(() => {
|
|
10239
10240
|
if (waitingStepId) {
|
|
10240
10241
|
return validSteps.find((s) => {
|
|
10241
10242
|
const stepId = s.publicId || s.id;
|
|
@@ -10247,7 +10248,7 @@ var PlanCard = React21.memo(function PlanCard2({
|
|
|
10247
10248
|
}
|
|
10248
10249
|
return null;
|
|
10249
10250
|
}, [waitingStepId, validSteps, isExecuting]);
|
|
10250
|
-
const isIntelligentSummary =
|
|
10251
|
+
const isIntelligentSummary = React20.useMemo(() => {
|
|
10251
10252
|
if (!plan.summary) return false;
|
|
10252
10253
|
return !isMechanicalSummary(plan.summary);
|
|
10253
10254
|
}, [plan.summary]);
|
|
@@ -10457,7 +10458,7 @@ var PlanCard = React21.memo(function PlanCard2({
|
|
|
10457
10458
|
] });
|
|
10458
10459
|
});
|
|
10459
10460
|
var PlanCard_default = PlanCard;
|
|
10460
|
-
var ComponentContext =
|
|
10461
|
+
var ComponentContext = React20.createContext(void 0);
|
|
10461
10462
|
var ComponentProvider = ({
|
|
10462
10463
|
components = {},
|
|
10463
10464
|
children
|
|
@@ -10465,7 +10466,7 @@ var ComponentProvider = ({
|
|
|
10465
10466
|
return /* @__PURE__ */ jsxRuntime.jsx(ComponentContext.Provider, { value: components, children });
|
|
10466
10467
|
};
|
|
10467
10468
|
var useComponents = () => {
|
|
10468
|
-
const context =
|
|
10469
|
+
const context = React20.useContext(ComponentContext);
|
|
10469
10470
|
if (!context) {
|
|
10470
10471
|
return {};
|
|
10471
10472
|
}
|
|
@@ -10513,7 +10514,7 @@ function MessageTimeline({
|
|
|
10513
10514
|
renderMessage
|
|
10514
10515
|
}) {
|
|
10515
10516
|
if (!items || items.length === 0) return null;
|
|
10516
|
-
const thoughtItems =
|
|
10517
|
+
const thoughtItems = React20.useMemo(() => items.filter((item) => item.kind === "thought"), [items]);
|
|
10517
10518
|
let thoughtIndex = 0;
|
|
10518
10519
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className || "mt-3 space-y-3 w-full", children: items.map((item) => {
|
|
10519
10520
|
if (item.kind === "thought") {
|
|
@@ -10527,14 +10528,14 @@ function MessageTimeline({
|
|
|
10527
10528
|
}) });
|
|
10528
10529
|
}
|
|
10529
10530
|
var imageLoadedCache = /* @__PURE__ */ new Map();
|
|
10530
|
-
var MessageImageInternal =
|
|
10531
|
+
var MessageImageInternal = React20.memo(function MessageImageInternal2({ src, alt, className }) {
|
|
10531
10532
|
const cachedStatus = imageLoadedCache.get(src);
|
|
10532
|
-
const [loaded, setLoaded] =
|
|
10533
|
-
const [error, setError] =
|
|
10534
|
-
const imgRef =
|
|
10535
|
-
const [previewUrl, setPreviewUrl] =
|
|
10533
|
+
const [loaded, setLoaded] = React20.useState(cachedStatus === "loaded");
|
|
10534
|
+
const [error, setError] = React20.useState(cachedStatus === "error");
|
|
10535
|
+
const imgRef = React20__namespace.default.useRef(null);
|
|
10536
|
+
const [previewUrl, setPreviewUrl] = React20.useState(null);
|
|
10536
10537
|
const ImagePreviewComp = useComponent("ImagePreview") || ImagePreviewInternal;
|
|
10537
|
-
|
|
10538
|
+
React20.useEffect(() => {
|
|
10538
10539
|
const status = imageLoadedCache.get(src);
|
|
10539
10540
|
if (status === "loaded") {
|
|
10540
10541
|
setLoaded(true);
|
|
@@ -10548,7 +10549,7 @@ var MessageImageInternal = React21.memo(function MessageImageInternal2({ src, al
|
|
|
10548
10549
|
setError(false);
|
|
10549
10550
|
}
|
|
10550
10551
|
}, [src]);
|
|
10551
|
-
|
|
10552
|
+
React20.useEffect(() => {
|
|
10552
10553
|
const img = imgRef.current;
|
|
10553
10554
|
if (!img) return;
|
|
10554
10555
|
if (img.complete && img.naturalWidth > 0) {
|
|
@@ -10594,7 +10595,7 @@ var MessageImageInternal = React21.memo(function MessageImageInternal2({ src, al
|
|
|
10594
10595
|
)
|
|
10595
10596
|
] });
|
|
10596
10597
|
});
|
|
10597
|
-
var MessageVideoInternal =
|
|
10598
|
+
var MessageVideoInternal = React20.memo(function MessageVideoInternal2({ src, className }) {
|
|
10598
10599
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-2 relative rounded-lg overflow-hidden bg-zinc-900 border border-zinc-800", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10599
10600
|
"video",
|
|
10600
10601
|
{
|
|
@@ -10606,12 +10607,12 @@ var MessageVideoInternal = React21.memo(function MessageVideoInternal2({ src, cl
|
|
|
10606
10607
|
}
|
|
10607
10608
|
) });
|
|
10608
10609
|
});
|
|
10609
|
-
var ImagePreviewInternal =
|
|
10610
|
+
var ImagePreviewInternal = React20.memo(function ImagePreviewInternal2({
|
|
10610
10611
|
src,
|
|
10611
10612
|
alt,
|
|
10612
10613
|
onClose
|
|
10613
10614
|
}) {
|
|
10614
|
-
|
|
10615
|
+
React20.useEffect(() => {
|
|
10615
10616
|
const handleKeyDown = (e) => {
|
|
10616
10617
|
if (e.key === "Escape") {
|
|
10617
10618
|
onClose();
|
|
@@ -10664,11 +10665,11 @@ var ImagePreviewInternal = React21.memo(function ImagePreviewInternal2({
|
|
|
10664
10665
|
}
|
|
10665
10666
|
);
|
|
10666
10667
|
});
|
|
10667
|
-
var VideoPreviewInternal =
|
|
10668
|
+
var VideoPreviewInternal = React20.memo(function VideoPreviewInternal2({
|
|
10668
10669
|
src,
|
|
10669
10670
|
onClose
|
|
10670
10671
|
}) {
|
|
10671
|
-
|
|
10672
|
+
React20.useEffect(() => {
|
|
10672
10673
|
const handleKeyDown = (e) => {
|
|
10673
10674
|
if (e.key === "Escape") {
|
|
10674
10675
|
onClose();
|
|
@@ -10705,7 +10706,7 @@ var VideoPreviewInternal = React21.memo(function VideoPreviewInternal2({
|
|
|
10705
10706
|
);
|
|
10706
10707
|
});
|
|
10707
10708
|
var mediaResolveCache = /* @__PURE__ */ new Map();
|
|
10708
|
-
var ResolvedMarkdownMedia =
|
|
10709
|
+
var ResolvedMarkdownMedia = React20.memo(function ResolvedMarkdownMedia2({
|
|
10709
10710
|
src,
|
|
10710
10711
|
alt,
|
|
10711
10712
|
skipImages,
|
|
@@ -10713,8 +10714,8 @@ var ResolvedMarkdownMedia = React21.memo(function ResolvedMarkdownMedia2({
|
|
|
10713
10714
|
}) {
|
|
10714
10715
|
const cacheKey = src || "";
|
|
10715
10716
|
const cachedMedia = mediaResolveCache.get(cacheKey);
|
|
10716
|
-
const [media, setMedia] =
|
|
10717
|
-
|
|
10717
|
+
const [media, setMedia] = React20.useState(cachedMedia ?? null);
|
|
10718
|
+
React20.useEffect(() => {
|
|
10718
10719
|
let active = true;
|
|
10719
10720
|
const load = async () => {
|
|
10720
10721
|
if (!src) {
|
|
@@ -10948,8 +10949,8 @@ function getToolCallStatus(tc) {
|
|
|
10948
10949
|
if (tc.error) return "failed";
|
|
10949
10950
|
return "success";
|
|
10950
10951
|
}
|
|
10951
|
-
var CodeBlock =
|
|
10952
|
-
const [copied, setCopied] =
|
|
10952
|
+
var CodeBlock = React20.memo(function CodeBlock2({ children, className }) {
|
|
10953
|
+
const [copied, setCopied] = React20.useState(false);
|
|
10953
10954
|
const language = className?.replace("language-", "") || "text";
|
|
10954
10955
|
const handleCopy = async () => {
|
|
10955
10956
|
await navigator.clipboard.writeText(children);
|
|
@@ -10974,7 +10975,7 @@ var CodeBlock = React21.memo(function CodeBlock2({ children, className }) {
|
|
|
10974
10975
|
/* @__PURE__ */ jsxRuntime.jsx("pre", { className: "p-4 overflow-x-auto text-sm whitespace-pre-wrap break-all", children: /* @__PURE__ */ jsxRuntime.jsx("code", { className: `${className} text-zinc-300`, children }) })
|
|
10975
10976
|
] });
|
|
10976
10977
|
});
|
|
10977
|
-
var MarkdownContent =
|
|
10978
|
+
var MarkdownContent = React20.memo(function MarkdownContent2({ content, skipImages = false, config, variant = "default" }) {
|
|
10978
10979
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10979
10980
|
ReactMarkdown__default.default,
|
|
10980
10981
|
{
|
|
@@ -11158,7 +11159,7 @@ function getDisplayName(key) {
|
|
|
11158
11159
|
if (PARAM_NAMES[key]) return PARAM_NAMES[key];
|
|
11159
11160
|
return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/_/g, " ");
|
|
11160
11161
|
}
|
|
11161
|
-
var ParamRow =
|
|
11162
|
+
var ParamRow = React20.memo(function ParamRow2({
|
|
11162
11163
|
name,
|
|
11163
11164
|
value,
|
|
11164
11165
|
isExpanded,
|
|
@@ -11190,8 +11191,8 @@ var ParamRow = React21.memo(function ParamRow2({
|
|
|
11190
11191
|
] }) : value })
|
|
11191
11192
|
] });
|
|
11192
11193
|
});
|
|
11193
|
-
var JsonView =
|
|
11194
|
-
const [copied, setCopied] =
|
|
11194
|
+
var JsonView = React20.memo(function JsonView2({ data }) {
|
|
11195
|
+
const [copied, setCopied] = React20.useState(false);
|
|
11195
11196
|
const json = JSON.stringify(data, null, 2);
|
|
11196
11197
|
const handleCopy = async () => {
|
|
11197
11198
|
await navigator.clipboard.writeText(json);
|
|
@@ -11218,10 +11219,10 @@ function ParameterDisplay({
|
|
|
11218
11219
|
compact = false,
|
|
11219
11220
|
maxCompactItems = 3
|
|
11220
11221
|
}) {
|
|
11221
|
-
const [showJson, setShowJson] =
|
|
11222
|
-
const [expandedTech, setExpandedTech] =
|
|
11223
|
-
const [expandedValues, setExpandedValues] =
|
|
11224
|
-
const { mainParams, techParams } =
|
|
11222
|
+
const [showJson, setShowJson] = React20.useState(false);
|
|
11223
|
+
const [expandedTech, setExpandedTech] = React20.useState(defaultExpanded);
|
|
11224
|
+
const [expandedValues, setExpandedValues] = React20.useState(/* @__PURE__ */ new Set());
|
|
11225
|
+
const { mainParams, techParams } = React20.useMemo(() => {
|
|
11225
11226
|
if (!parameters || typeof parameters !== "object") {
|
|
11226
11227
|
return { mainParams: [], techParams: [] };
|
|
11227
11228
|
}
|
|
@@ -11338,19 +11339,19 @@ function ParameterDisplay({
|
|
|
11338
11339
|
}
|
|
11339
11340
|
function ToolConfirmCard({ toolCall, compact = false }) {
|
|
11340
11341
|
const { removePendingToolCall, updatePendingToolCall } = useAgentStore();
|
|
11341
|
-
const [expanded, setExpanded] =
|
|
11342
|
-
const [isEditing, setIsEditing] =
|
|
11343
|
-
const [editedArguments, setEditedArguments] =
|
|
11344
|
-
const [loading, setLoading] =
|
|
11345
|
-
const [error, setError] =
|
|
11346
|
-
const toolDisplayName =
|
|
11342
|
+
const [expanded, setExpanded] = React20.useState(false);
|
|
11343
|
+
const [isEditing, setIsEditing] = React20.useState(false);
|
|
11344
|
+
const [editedArguments, setEditedArguments] = React20.useState("");
|
|
11345
|
+
const [loading, setLoading] = React20.useState(null);
|
|
11346
|
+
const [error, setError] = React20.useState("");
|
|
11347
|
+
const toolDisplayName = React20.useMemo(() => {
|
|
11347
11348
|
if (toolCall.displayName) return toolCall.displayName;
|
|
11348
11349
|
return toolCall.name.replace(/^comfy_/, "").replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
|
|
11349
11350
|
}, [toolCall]);
|
|
11350
|
-
const toolDescription =
|
|
11351
|
+
const toolDescription = React20.useMemo(() => {
|
|
11351
11352
|
return generateToolCallDescription(toolCall.name, toolCall.arguments || {});
|
|
11352
11353
|
}, [toolCall.name, toolCall.arguments]);
|
|
11353
|
-
|
|
11354
|
+
React20.useMemo(() => {
|
|
11354
11355
|
return getParamsSummary(toolCall.arguments || {}, 2);
|
|
11355
11356
|
}, [toolCall.arguments]);
|
|
11356
11357
|
const hasParams = Object.keys(toolCall.arguments || {}).length > 0;
|
|
@@ -11702,17 +11703,17 @@ var contentTypeConfig = {
|
|
|
11702
11703
|
bgColor: "bg-zinc-500/10"
|
|
11703
11704
|
}
|
|
11704
11705
|
};
|
|
11705
|
-
var ContentPreviewCard =
|
|
11706
|
+
var ContentPreviewCard = React20.memo(function ContentPreviewCard2({
|
|
11706
11707
|
parsed,
|
|
11707
11708
|
index = 0,
|
|
11708
11709
|
config,
|
|
11709
11710
|
onOpenArtifact
|
|
11710
11711
|
}) {
|
|
11711
|
-
const [isModalOpen, setIsModalOpen] =
|
|
11712
|
-
const [copied, setCopied] =
|
|
11712
|
+
const [isModalOpen, setIsModalOpen] = React20.useState(false);
|
|
11713
|
+
const [copied, setCopied] = React20.useState(false);
|
|
11713
11714
|
const typeConfig = contentTypeConfig[parsed.type];
|
|
11714
11715
|
const Icon = typeConfig.icon;
|
|
11715
|
-
const handleCopy =
|
|
11716
|
+
const handleCopy = React20.useCallback(async (e) => {
|
|
11716
11717
|
e.stopPropagation();
|
|
11717
11718
|
try {
|
|
11718
11719
|
await navigator.clipboard.writeText(parsed.content);
|
|
@@ -11721,7 +11722,7 @@ var ContentPreviewCard = React21.memo(function ContentPreviewCard2({
|
|
|
11721
11722
|
} catch {
|
|
11722
11723
|
}
|
|
11723
11724
|
}, [parsed.content]);
|
|
11724
|
-
const handleOpenPreview =
|
|
11725
|
+
const handleOpenPreview = React20.useCallback(() => {
|
|
11725
11726
|
console.log("[ContentPreviewCard] Open preview:", onOpenArtifact);
|
|
11726
11727
|
if (onOpenArtifact) {
|
|
11727
11728
|
onOpenArtifact({
|
|
@@ -11734,10 +11735,10 @@ var ContentPreviewCard = React21.memo(function ContentPreviewCard2({
|
|
|
11734
11735
|
setIsModalOpen(true);
|
|
11735
11736
|
}
|
|
11736
11737
|
}, [onOpenArtifact, parsed]);
|
|
11737
|
-
const handleCloseModal =
|
|
11738
|
+
const handleCloseModal = React20.useCallback(() => {
|
|
11738
11739
|
setIsModalOpen(false);
|
|
11739
11740
|
}, []);
|
|
11740
|
-
const preview =
|
|
11741
|
+
const preview = React20.useMemo(() => {
|
|
11741
11742
|
const content = parsed.content;
|
|
11742
11743
|
if (parsed.type === "html") {
|
|
11743
11744
|
const title = parsed.title || "HTML Document";
|
|
@@ -11845,15 +11846,15 @@ var ContentPreviewCard = React21.memo(function ContentPreviewCard2({
|
|
|
11845
11846
|
)
|
|
11846
11847
|
] });
|
|
11847
11848
|
});
|
|
11848
|
-
var ContentPreviewModal =
|
|
11849
|
+
var ContentPreviewModal = React20.memo(function ContentPreviewModal2({
|
|
11849
11850
|
parsed,
|
|
11850
11851
|
onClose,
|
|
11851
11852
|
config
|
|
11852
11853
|
}) {
|
|
11853
|
-
const [viewMode, setViewMode] =
|
|
11854
|
-
const [copied, setCopied] =
|
|
11854
|
+
const [viewMode, setViewMode] = React20.useState("preview");
|
|
11855
|
+
const [copied, setCopied] = React20.useState(false);
|
|
11855
11856
|
const typeConfig = contentTypeConfig[parsed.type];
|
|
11856
|
-
const handleCopy =
|
|
11857
|
+
const handleCopy = React20.useCallback(async () => {
|
|
11857
11858
|
try {
|
|
11858
11859
|
await navigator.clipboard.writeText(parsed.content);
|
|
11859
11860
|
setCopied(true);
|
|
@@ -11861,13 +11862,13 @@ var ContentPreviewModal = React21.memo(function ContentPreviewModal2({
|
|
|
11861
11862
|
} catch {
|
|
11862
11863
|
}
|
|
11863
11864
|
}, [parsed.content]);
|
|
11864
|
-
|
|
11865
|
+
React20__namespace.default.useEffect(() => {
|
|
11865
11866
|
document.body.style.overflow = "hidden";
|
|
11866
11867
|
return () => {
|
|
11867
11868
|
document.body.style.overflow = "";
|
|
11868
11869
|
};
|
|
11869
11870
|
}, []);
|
|
11870
|
-
|
|
11871
|
+
React20__namespace.default.useEffect(() => {
|
|
11871
11872
|
const handleKeyDown = (e) => {
|
|
11872
11873
|
if (e.key === "Escape") {
|
|
11873
11874
|
onClose();
|
|
@@ -11953,7 +11954,7 @@ var ContentPreviewModal = React21.memo(function ContentPreviewModal2({
|
|
|
11953
11954
|
}
|
|
11954
11955
|
);
|
|
11955
11956
|
});
|
|
11956
|
-
var ContentPreviewRenderer =
|
|
11957
|
+
var ContentPreviewRenderer = React20.memo(function ContentPreviewRenderer2({
|
|
11957
11958
|
parsed,
|
|
11958
11959
|
config
|
|
11959
11960
|
}) {
|
|
@@ -11965,14 +11966,14 @@ var ContentPreviewRenderer = React21.memo(function ContentPreviewRenderer2({
|
|
|
11965
11966
|
}
|
|
11966
11967
|
return /* @__PURE__ */ jsxRuntime.jsx(SourceCodeViewer, { content: parsed.content, language: parsed.language || parsed.type });
|
|
11967
11968
|
});
|
|
11968
|
-
var HtmlPreview =
|
|
11969
|
-
const iframeRef =
|
|
11970
|
-
const [scale, setScale] =
|
|
11971
|
-
const blobUrl =
|
|
11969
|
+
var HtmlPreview = React20.memo(function HtmlPreview2({ content }) {
|
|
11970
|
+
const iframeRef = React20__namespace.default.useRef(null);
|
|
11971
|
+
const [scale, setScale] = React20.useState(0.5);
|
|
11972
|
+
const blobUrl = React20.useMemo(() => {
|
|
11972
11973
|
const blob = new Blob([content], { type: "text/html" });
|
|
11973
11974
|
return URL.createObjectURL(blob);
|
|
11974
11975
|
}, [content]);
|
|
11975
|
-
|
|
11976
|
+
React20__namespace.default.useEffect(() => {
|
|
11976
11977
|
return () => {
|
|
11977
11978
|
URL.revokeObjectURL(blobUrl);
|
|
11978
11979
|
};
|
|
@@ -12034,7 +12035,7 @@ var HtmlPreview = React21.memo(function HtmlPreview2({ content }) {
|
|
|
12034
12035
|
) })
|
|
12035
12036
|
] });
|
|
12036
12037
|
});
|
|
12037
|
-
var SourceCodeViewer =
|
|
12038
|
+
var SourceCodeViewer = React20.memo(function SourceCodeViewer2({
|
|
12038
12039
|
content,
|
|
12039
12040
|
language
|
|
12040
12041
|
}) {
|
|
@@ -12044,12 +12045,12 @@ var SourceCodeViewer = React21.memo(function SourceCodeViewer2({
|
|
|
12044
12045
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-zinc-300 whitespace-pre-wrap break-all", children: line || " " })
|
|
12045
12046
|
] }, i)) }) }) });
|
|
12046
12047
|
});
|
|
12047
|
-
|
|
12048
|
+
React20.memo(function CustomResponseRenderer2({
|
|
12048
12049
|
result,
|
|
12049
12050
|
config,
|
|
12050
12051
|
onOpenArtifact
|
|
12051
12052
|
}) {
|
|
12052
|
-
const parsedContents =
|
|
12053
|
+
const parsedContents = React20.useMemo(() => extractCustomResponses(result), [result]);
|
|
12053
12054
|
if (parsedContents.length === 0) {
|
|
12054
12055
|
return null;
|
|
12055
12056
|
}
|
|
@@ -12064,8 +12065,8 @@ React21.memo(function CustomResponseRenderer2({
|
|
|
12064
12065
|
index
|
|
12065
12066
|
)) });
|
|
12066
12067
|
});
|
|
12067
|
-
var JsonValue =
|
|
12068
|
-
const [collapsed, setCollapsed] =
|
|
12068
|
+
var JsonValue = React20.memo(function JsonValue2({ value, depth = 0, isLast = true }) {
|
|
12069
|
+
const [collapsed, setCollapsed] = React20.useState(depth > 1);
|
|
12069
12070
|
const indent2 = depth * 16;
|
|
12070
12071
|
if (value === null) {
|
|
12071
12072
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-zinc-500", children: "null" });
|
|
@@ -12193,13 +12194,13 @@ var JsonValue = React21.memo(function JsonValue2({ value, depth = 0, isLast = tr
|
|
|
12193
12194
|
}
|
|
12194
12195
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-zinc-400", children: String(value) });
|
|
12195
12196
|
});
|
|
12196
|
-
var ElegantJsonRenderer =
|
|
12197
|
+
var ElegantJsonRenderer = React20.memo(function ElegantJsonRenderer2({
|
|
12197
12198
|
data,
|
|
12198
12199
|
title,
|
|
12199
12200
|
defaultExpanded = false
|
|
12200
12201
|
}) {
|
|
12201
|
-
const [expanded, setExpanded] =
|
|
12202
|
-
const [copied, setCopied] =
|
|
12202
|
+
const [expanded, setExpanded] = React20.useState(defaultExpanded);
|
|
12203
|
+
const [copied, setCopied] = React20.useState(false);
|
|
12203
12204
|
const handleCopy = async (e) => {
|
|
12204
12205
|
e.stopPropagation();
|
|
12205
12206
|
try {
|
|
@@ -12246,14 +12247,14 @@ var ElegantJsonRenderer = React21.memo(function ElegantJsonRenderer2({
|
|
|
12246
12247
|
expanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-3 bg-zinc-900/30 text-xs font-mono overflow-x-auto max-h-80 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(JsonValue, { value: data, depth: 0 }) })
|
|
12247
12248
|
] });
|
|
12248
12249
|
});
|
|
12249
|
-
var ToolResultRenderer =
|
|
12250
|
+
var ToolResultRenderer = React20.memo(function ToolResultRenderer2({
|
|
12250
12251
|
result,
|
|
12251
12252
|
mediaUrls,
|
|
12252
12253
|
config,
|
|
12253
12254
|
onOpenArtifact
|
|
12254
12255
|
}) {
|
|
12255
|
-
const [imgLoaded, setImgLoaded] =
|
|
12256
|
-
const [previewUrl, setPreviewUrl] =
|
|
12256
|
+
const [imgLoaded, setImgLoaded] = React20.useState({});
|
|
12257
|
+
const [previewUrl, setPreviewUrl] = React20.useState(null);
|
|
12257
12258
|
const extracted = extractCustomResponses(result);
|
|
12258
12259
|
const customResult = extracted?.map?.((data, index) => {
|
|
12259
12260
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -12271,9 +12272,9 @@ var ToolResultRenderer = React21.memo(function ToolResultRenderer2({
|
|
|
12271
12272
|
const imageUrls = mediaUrls.filter((m) => !m.isVideo);
|
|
12272
12273
|
const videoUrls = mediaUrls.filter((m) => m.isVideo);
|
|
12273
12274
|
const hasMedia = imageUrls.length > 0 || videoUrls.length > 0;
|
|
12274
|
-
const customResponses =
|
|
12275
|
+
const customResponses = React20.useMemo(() => extractCustomResponses(result), [result]);
|
|
12275
12276
|
const hasCustomResponses = customResponses.length > 0;
|
|
12276
|
-
const filteredResult =
|
|
12277
|
+
const filteredResult = React20.useMemo(() => {
|
|
12277
12278
|
if (!result || typeof result !== "object") return result;
|
|
12278
12279
|
const mediaUrlSet = new Set(mediaUrls.map((m) => m.url));
|
|
12279
12280
|
mediaUrls.forEach((m) => {
|
|
@@ -12328,7 +12329,7 @@ var ToolResultRenderer = React21.memo(function ToolResultRenderer2({
|
|
|
12328
12329
|
}
|
|
12329
12330
|
) }, `video-${i}`)) }),
|
|
12330
12331
|
imageUrls.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { children: imageUrls.map((img, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `relative group/img overflow-hidden ${imageUrls.length > 1 ? "aspect-square bg-black" : ""}`, children: [
|
|
12331
|
-
!imgLoaded[i] && /* @__PURE__ */ jsxRuntime.jsx("div", { className: `bg-zinc-800 animate-pulse flex items-center justify-center`, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12332
|
+
!imgLoaded[i] && /* @__PURE__ */ jsxRuntime.jsx("div", { className: `bg-zinc-800 animate-pulse flex items-center justify-center`, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "animate-spin rounded-full h-5 w-5 border-b-2 border-[#d8ff00]" }) }),
|
|
12332
12333
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12333
12334
|
"img",
|
|
12334
12335
|
{
|
|
@@ -12387,26 +12388,26 @@ var collectMediaAssetsFromResult2 = (result) => {
|
|
|
12387
12388
|
return assets;
|
|
12388
12389
|
};
|
|
12389
12390
|
var INTERNAL_SYSTEM_TOOLS = ["load_skill", "switch_skill", "unload_skill"];
|
|
12390
|
-
var SkillLoadCard =
|
|
12391
|
+
var SkillLoadCard = React20.memo(function SkillLoadCard2({ toolCall }) {
|
|
12391
12392
|
const status = getToolCallStatus(toolCall);
|
|
12392
12393
|
const isPending = status === "pending" || status === "confirmed";
|
|
12393
12394
|
const isSuccess = status === "success";
|
|
12394
12395
|
const skillName = toolCall.arguments?.skill_name || "\u6280\u80FD";
|
|
12395
12396
|
const actionText = toolCall.name === "load_skill" ? "\u542F\u7528" : toolCall.name === "unload_skill" ? "\u505C\u7528" : toolCall.name === "switch_skill" ? "\u5207\u6362" : "\u52A0\u8F7D";
|
|
12396
12397
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-flex items-center gap-2 px-3 py-1.5 bg-gradient-to-r from-violet-500/10 to-purple-500/10 border border-violet-500/20 rounded-full text-sm", children: [
|
|
12397
|
-
isPending ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
12398
|
+
isPending ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "animate-spin rounded-full h-3.5 w-3.5 border-b-2 border-violet-400" }) : isSuccess ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Zap, { size: 14, className: "text-violet-400" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Zap, { size: 14, className: "text-red-400" }),
|
|
12398
12399
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-zinc-300", children: isPending ? `\u6B63\u5728${actionText}` : isSuccess ? `\u5DF2${actionText}` : `${actionText}\u5931\u8D25` }),
|
|
12399
12400
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-violet-300", children: skillName }),
|
|
12400
12401
|
isSuccess && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-zinc-500", children: "\u6280\u80FD" })
|
|
12401
12402
|
] });
|
|
12402
12403
|
});
|
|
12403
|
-
var ToolCallCard3 =
|
|
12404
|
+
var ToolCallCard3 = React20.memo(function ToolCallCard4({
|
|
12404
12405
|
toolCall,
|
|
12405
12406
|
config,
|
|
12406
12407
|
onOpenArtifact
|
|
12407
12408
|
}) {
|
|
12408
|
-
const [headerExpanded, setHeaderExpanded] =
|
|
12409
|
-
const [mediaUrls, setMediaUrls] =
|
|
12409
|
+
const [headerExpanded, setHeaderExpanded] = React20.useState(false);
|
|
12410
|
+
const [mediaUrls, setMediaUrls] = React20.useState([]);
|
|
12410
12411
|
const status = getToolCallStatus(toolCall);
|
|
12411
12412
|
const isPending = status === "pending" || status === "confirmed";
|
|
12412
12413
|
const isSuccess = status === "success";
|
|
@@ -12416,7 +12417,7 @@ var ToolCallCard3 = React21.memo(function ToolCallCard4({
|
|
|
12416
12417
|
if (INTERNAL_SYSTEM_TOOLS.includes(toolCall.name)) {
|
|
12417
12418
|
return /* @__PURE__ */ jsxRuntime.jsx(SkillLoadCard, { toolCall });
|
|
12418
12419
|
}
|
|
12419
|
-
|
|
12420
|
+
React20.useEffect(() => {
|
|
12420
12421
|
if (status === "waiting_confirmation") {
|
|
12421
12422
|
setMediaUrls([]);
|
|
12422
12423
|
return;
|
|
@@ -12478,7 +12479,7 @@ var ToolCallCard3 = React21.memo(function ToolCallCard4({
|
|
|
12478
12479
|
className: "flex items-center justify-between cursor-pointer",
|
|
12479
12480
|
onClick: () => setHeaderExpanded(!headerExpanded),
|
|
12480
12481
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
12481
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `w-5 h-5 rounded flex items-center justify-center ${isPending ? "bg-amber-500/20" : isSuccess ? "bg-green-500/20" : "bg-red-500/20"}`, children: isPending ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
12482
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `w-5 h-5 rounded flex items-center justify-center ${isPending ? "bg-amber-500/20" : isSuccess ? "bg-green-500/20" : "bg-red-500/20"}`, children: isPending ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "animate-spin rounded-full h-3 w-3 border-b-2 border-amber-400" }) : isSuccess ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { size: 12, className: "text-green-400" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Zap, { size: 12, className: "text-red-400" }) }),
|
|
12482
12483
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "agent-toolcall-title text-xs text-zinc-400", children: toolDisplayName }),
|
|
12483
12484
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `text-[10px] px-1.5 py-0.5 rounded ${isPending ? "bg-amber-500/10 text-amber-400" : isSuccess ? "bg-green-500/10 text-green-400" : "bg-red-500/10 text-red-400"}`, children: isPending ? "\u6267\u884C\u4E2D" : isSuccess ? "\u5DF2\u5B8C\u6210" : "\u5931\u8D25" }),
|
|
12484
12485
|
headerExpanded ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { size: 14, className: "text-zinc-500" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { size: 14, className: "text-zinc-500" })
|
|
@@ -12522,12 +12523,12 @@ function getFinalStatusPriority(status) {
|
|
|
12522
12523
|
return 0;
|
|
12523
12524
|
}
|
|
12524
12525
|
}
|
|
12525
|
-
|
|
12526
|
+
React20.memo(function ToolCallResults2({
|
|
12526
12527
|
toolCalls,
|
|
12527
12528
|
config,
|
|
12528
12529
|
onOpenArtifact
|
|
12529
12530
|
}) {
|
|
12530
|
-
const calls =
|
|
12531
|
+
const calls = React20.useMemo(() => {
|
|
12531
12532
|
if (!toolCalls || toolCalls.length === 0) return [];
|
|
12532
12533
|
const uniqueCalls = toolCalls.reduce((acc, tc) => {
|
|
12533
12534
|
const existing = acc.get(tc.id);
|
|
@@ -12545,7 +12546,7 @@ React21.memo(function ToolCallResults2({
|
|
|
12545
12546
|
if (calls.length === 0) return null;
|
|
12546
12547
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 space-y-2 min-w-0 w-full", children: calls.map((tc) => /* @__PURE__ */ jsxRuntime.jsx(ToolCallCard3, { toolCall: tc, config, onOpenArtifact }, tc.id)) });
|
|
12547
12548
|
});
|
|
12548
|
-
var StreamingToolCard =
|
|
12549
|
+
var StreamingToolCard = React20.memo(function StreamingToolCard2({ toolCall }) {
|
|
12549
12550
|
const status = getToolCallStatus(toolCall);
|
|
12550
12551
|
if (status === "waiting_confirmation") {
|
|
12551
12552
|
const toolCallForCard = {
|
|
@@ -12564,7 +12565,7 @@ var StreamingToolCard = React21.memo(function StreamingToolCard2({ toolCall }) {
|
|
|
12564
12565
|
const errorMessage = toolCall.result?.error || toolCall.error;
|
|
12565
12566
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 px-3 py-2 bg-zinc-900/60 rounded-lg border border-zinc-700/40", children: [
|
|
12566
12567
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
12567
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `w-5 h-5 rounded flex items-center justify-center ${isPending ? "bg-amber-500/20" : isSuccess ? "bg-green-500/20" : "bg-red-500/20"}`, children: isPending ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
12568
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `w-5 h-5 rounded flex items-center justify-center ${isPending ? "bg-amber-500/20" : isSuccess ? "bg-green-500/20" : "bg-red-500/20"}`, children: isPending ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "animate-spin rounded-full h-3 w-3 border-b-2 border-[#d8ff00]" }) : isSuccess ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { size: 12, className: "text-green-400" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Zap, { size: 12, className: "text-red-400" }) }),
|
|
12568
12569
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-zinc-300 truncate flex-1", children: toolName }),
|
|
12569
12570
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `text-[10px] px-1.5 py-0.5 rounded ${isPending ? "bg-amber-500/10 text-amber-400" : isSuccess ? "bg-green-500/10 text-green-400" : "bg-red-500/10 text-red-400"}`, children: isPending ? "\u6267\u884C\u4E2D" : isSuccess ? "\u5B8C\u6210" : "\u5931\u8D25" })
|
|
12570
12571
|
] }),
|
|
@@ -12572,15 +12573,15 @@ var StreamingToolCard = React21.memo(function StreamingToolCard2({ toolCall }) {
|
|
|
12572
12573
|
toolCall.gmtCreate && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-zinc-500 mt-1", children: new Date(toolCall.gmtCreate).toLocaleTimeString("zh-CN", { hour: "2-digit", minute: "2-digit", second: "2-digit" }) })
|
|
12573
12574
|
] });
|
|
12574
12575
|
});
|
|
12575
|
-
var ComponentPendingCard =
|
|
12576
|
+
var ComponentPendingCard = React20.memo(function ComponentPendingCard2({
|
|
12576
12577
|
component,
|
|
12577
12578
|
onResolved
|
|
12578
12579
|
}) {
|
|
12579
12580
|
const { showItemTime } = useAgentStore();
|
|
12580
|
-
const [loading, setLoading] =
|
|
12581
|
-
const [error, setError] =
|
|
12582
|
-
const [collapsed, setCollapsed] =
|
|
12583
|
-
const [jsonValue, setJsonValue] =
|
|
12581
|
+
const [loading, setLoading] = React20.useState(null);
|
|
12582
|
+
const [error, setError] = React20.useState("");
|
|
12583
|
+
const [collapsed, setCollapsed] = React20.useState(false);
|
|
12584
|
+
const [jsonValue, setJsonValue] = React20.useState(() => {
|
|
12584
12585
|
const initialPayload = component.props || component.content || {};
|
|
12585
12586
|
return typeof initialPayload === "string" ? initialPayload : JSON.stringify(initialPayload, null, 2);
|
|
12586
12587
|
});
|
|
@@ -12589,7 +12590,7 @@ var ComponentPendingCard = React21.memo(function ComponentPendingCard2({
|
|
|
12589
12590
|
const components = useComponents();
|
|
12590
12591
|
const registry = components.ComponentRegistry || {};
|
|
12591
12592
|
const normalizeName = (value) => (value || "").toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
12592
|
-
const registryMap =
|
|
12593
|
+
const registryMap = React20.useMemo(() => {
|
|
12593
12594
|
const map3 = /* @__PURE__ */ new Map();
|
|
12594
12595
|
Object.entries(registry).forEach(([key, Comp]) => {
|
|
12595
12596
|
map3.set(key, Comp);
|
|
@@ -12608,7 +12609,7 @@ var ComponentPendingCard = React21.memo(function ComponentPendingCard2({
|
|
|
12608
12609
|
}
|
|
12609
12610
|
return void 0;
|
|
12610
12611
|
})();
|
|
12611
|
-
const resolvedProps =
|
|
12612
|
+
const resolvedProps = React20.useMemo(() => {
|
|
12612
12613
|
const raw = component.props ?? component.content ?? {};
|
|
12613
12614
|
if (typeof raw === "string") {
|
|
12614
12615
|
try {
|
|
@@ -12627,8 +12628,8 @@ var ComponentPendingCard = React21.memo(function ComponentPendingCard2({
|
|
|
12627
12628
|
}, [component]);
|
|
12628
12629
|
console.log("Resolved Props:", resolvedProps);
|
|
12629
12630
|
console.log("Component gmtCreate:", component.gmtCreate, typeof component.gmtCreate);
|
|
12630
|
-
const [localConfirmed, setLocalConfirmed] =
|
|
12631
|
-
const [localCancelled, setLocalCancelled] =
|
|
12631
|
+
const [localConfirmed, setLocalConfirmed] = React20.useState(false);
|
|
12632
|
+
const [localCancelled, setLocalCancelled] = React20.useState(false);
|
|
12632
12633
|
const isActionDisabled = isReadonly || localConfirmed || localCancelled;
|
|
12633
12634
|
const handleConfirm = async () => {
|
|
12634
12635
|
if (isActionDisabled) return;
|
|
@@ -12675,7 +12676,7 @@ var ComponentPendingCard = React21.memo(function ComponentPendingCard2({
|
|
|
12675
12676
|
setLoading(null);
|
|
12676
12677
|
}
|
|
12677
12678
|
};
|
|
12678
|
-
|
|
12679
|
+
React20.useEffect(() => {
|
|
12679
12680
|
const initialPayload = component.props || component.content || {};
|
|
12680
12681
|
setJsonValue(typeof initialPayload === "string" ? initialPayload : JSON.stringify(initialPayload, null, 2));
|
|
12681
12682
|
if (statusUpper === "SUBMITTED" || statusUpper === "CONFIRMED" || statusUpper === "COMPLETED" || statusUpper === "DONE") {
|
|
@@ -12737,8 +12738,8 @@ var ComponentPendingCard = React21.memo(function ComponentPendingCard2({
|
|
|
12737
12738
|
})() })
|
|
12738
12739
|
] });
|
|
12739
12740
|
});
|
|
12740
|
-
var ThoughtTimelineCard =
|
|
12741
|
-
const [expanded, setExpanded] =
|
|
12741
|
+
var ThoughtTimelineCard = React20.memo(function ThoughtTimelineCard2({ thought, config, isLoading = false }) {
|
|
12742
|
+
const [expanded, setExpanded] = React20.useState(true);
|
|
12742
12743
|
const { showItemTime } = useAgentStore();
|
|
12743
12744
|
const thoughtType = thought?.type || "";
|
|
12744
12745
|
const excludedTypes = [
|
|
@@ -12800,7 +12801,7 @@ function useMessageContent({
|
|
|
12800
12801
|
isUser,
|
|
12801
12802
|
hasToolCallImages
|
|
12802
12803
|
}) {
|
|
12803
|
-
const displayContent =
|
|
12804
|
+
const displayContent = React20.useMemo(() => {
|
|
12804
12805
|
const isInvalidContent = (content2) => {
|
|
12805
12806
|
if (!content2) return true;
|
|
12806
12807
|
if (typeof content2 !== "string") return false;
|
|
@@ -12853,7 +12854,7 @@ function useMessageContent({
|
|
|
12853
12854
|
}
|
|
12854
12855
|
return typeof content === "string" ? content : String(content ?? "");
|
|
12855
12856
|
}, [isStreaming, streamingContent, message]);
|
|
12856
|
-
const markdownMedia =
|
|
12857
|
+
const markdownMedia = React20.useMemo(() => {
|
|
12857
12858
|
if (!isUser || !displayContent) {
|
|
12858
12859
|
return { media: [], content: displayContent };
|
|
12859
12860
|
}
|
|
@@ -12868,7 +12869,7 @@ function useMessageContent({
|
|
|
12868
12869
|
const cleaned = displayContent.replace(mediaRegex, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
12869
12870
|
return { media, content: cleaned };
|
|
12870
12871
|
}, [displayContent, isUser]);
|
|
12871
|
-
const effectiveDisplayContent =
|
|
12872
|
+
const effectiveDisplayContent = React20.useMemo(() => {
|
|
12872
12873
|
const baseContent = isUser ? markdownMedia.content || "" : displayContent || "";
|
|
12873
12874
|
if (!baseContent) return "";
|
|
12874
12875
|
if (isUser) return baseContent;
|
|
@@ -12880,7 +12881,7 @@ function useMessageContent({
|
|
|
12880
12881
|
}
|
|
12881
12882
|
return baseContent;
|
|
12882
12883
|
}, [displayContent, hasToolCallImages, isUser, markdownMedia.content]);
|
|
12883
|
-
const sanitizedDisplayContent =
|
|
12884
|
+
const sanitizedDisplayContent = React20.useMemo(
|
|
12884
12885
|
() => sanitizeMarkdownContent(effectiveDisplayContent),
|
|
12885
12886
|
[effectiveDisplayContent]
|
|
12886
12887
|
);
|
|
@@ -12927,7 +12928,7 @@ function useToolCalls({
|
|
|
12927
12928
|
thoughts,
|
|
12928
12929
|
pendingToolCalls = []
|
|
12929
12930
|
}) {
|
|
12930
|
-
const toolCalls =
|
|
12931
|
+
const toolCalls = React20.useMemo(() => {
|
|
12931
12932
|
const toolCallMap = /* @__PURE__ */ new Map();
|
|
12932
12933
|
const normalizeId = (value) => {
|
|
12933
12934
|
if (value === void 0 || value === null) return "";
|
|
@@ -13046,7 +13047,7 @@ function useToolCalls({
|
|
|
13046
13047
|
}
|
|
13047
13048
|
return Array.from(toolCallMap.values());
|
|
13048
13049
|
}, [message, isStreaming, thoughts, pendingToolCalls]);
|
|
13049
|
-
const dedupedToolCalls =
|
|
13050
|
+
const dedupedToolCalls = React20.useMemo(() => {
|
|
13050
13051
|
if (!toolCalls || toolCalls.length === 0) return [];
|
|
13051
13052
|
const uniqueCalls = toolCalls.reduce((acc, tc) => {
|
|
13052
13053
|
const id = String(tc.id);
|
|
@@ -13071,9 +13072,9 @@ function useComponents2({
|
|
|
13071
13072
|
thoughts,
|
|
13072
13073
|
isStreaming
|
|
13073
13074
|
}) {
|
|
13074
|
-
const [componentDetailMap, setComponentDetailMap] =
|
|
13075
|
-
const componentDetailRequestedRef =
|
|
13076
|
-
const componentsToRender =
|
|
13075
|
+
const [componentDetailMap, setComponentDetailMap] = React20.useState({});
|
|
13076
|
+
const componentDetailRequestedRef = React20.useRef(/* @__PURE__ */ new Set());
|
|
13077
|
+
const componentsToRender = React20.useMemo(() => {
|
|
13077
13078
|
const extraComponents = message.extraData?.components || [];
|
|
13078
13079
|
const backendId = message.metadata?.backendId;
|
|
13079
13080
|
const messageStatus = (message.status || "").toUpperCase();
|
|
@@ -13186,7 +13187,7 @@ function useComponents2({
|
|
|
13186
13187
|
}
|
|
13187
13188
|
return enrichedPendingComponents.filter((c) => c.messageId === backendId);
|
|
13188
13189
|
}, [message, pendingComponents, pendingComponentsSessionId, thoughts, isStreaming]);
|
|
13189
|
-
|
|
13190
|
+
React20.useEffect(() => {
|
|
13190
13191
|
if (!componentsToRender || componentsToRender.length === 0) return;
|
|
13191
13192
|
componentsToRender.forEach((component) => {
|
|
13192
13193
|
if (!component?.id) return;
|
|
@@ -13213,7 +13214,7 @@ function useComponents2({
|
|
|
13213
13214
|
});
|
|
13214
13215
|
});
|
|
13215
13216
|
}, [componentsToRender]);
|
|
13216
|
-
const effectiveComponents =
|
|
13217
|
+
const effectiveComponents = React20.useMemo(() => {
|
|
13217
13218
|
if (!componentsToRender || componentsToRender.length === 0) return [];
|
|
13218
13219
|
return componentsToRender.map((component) => {
|
|
13219
13220
|
const detail = componentDetailMap[component.id];
|
|
@@ -13230,7 +13231,7 @@ function useComponents2({
|
|
|
13230
13231
|
return { effectiveComponents };
|
|
13231
13232
|
}
|
|
13232
13233
|
function usePlanState({ message, thoughts }) {
|
|
13233
|
-
const planFromThoughts =
|
|
13234
|
+
const planFromThoughts = React20.useMemo(() => {
|
|
13234
13235
|
const extraPlan = message.extraData?.plan;
|
|
13235
13236
|
if (extraPlan && extraPlan.steps && Array.isArray(extraPlan.steps) && extraPlan.steps.length > 0) {
|
|
13236
13237
|
return null;
|
|
@@ -13307,10 +13308,10 @@ function usePlanState({ message, thoughts }) {
|
|
|
13307
13308
|
return plan;
|
|
13308
13309
|
}, [message, thoughts]);
|
|
13309
13310
|
const effectivePlan = message.extraData?.plan || planFromThoughts;
|
|
13310
|
-
const [fullPlan, setFullPlan] =
|
|
13311
|
-
const [planLoading, setPlanLoading] =
|
|
13312
|
-
const [loadedPlanId, setLoadedPlanId] =
|
|
13313
|
-
|
|
13311
|
+
const [fullPlan, setFullPlan] = React20.useState(null);
|
|
13312
|
+
const [planLoading, setPlanLoading] = React20.useState(false);
|
|
13313
|
+
const [loadedPlanId, setLoadedPlanId] = React20.useState(null);
|
|
13314
|
+
React20.useEffect(() => {
|
|
13314
13315
|
if (!effectivePlan) {
|
|
13315
13316
|
setFullPlan(null);
|
|
13316
13317
|
setLoadedPlanId(null);
|
|
@@ -13364,7 +13365,7 @@ var COMPONENT_TAGS_TO_STRIP2 = [
|
|
|
13364
13365
|
"ComponentPreview"
|
|
13365
13366
|
];
|
|
13366
13367
|
function useThinkingContent({ message, thoughts, isStreaming, messageContent }) {
|
|
13367
|
-
return
|
|
13368
|
+
return React20.useMemo(() => {
|
|
13368
13369
|
const historyThoughts = message.extraData?.thoughts || [];
|
|
13369
13370
|
const allThoughts = thoughts && thoughts.length > 0 ? thoughts : historyThoughts;
|
|
13370
13371
|
const hasSubAgents = allThoughts.some((t) => t.agent_id || t.agentId || t.agent_name || t.agentName);
|
|
@@ -13529,7 +13530,7 @@ function useTimelineItems({
|
|
|
13529
13530
|
messageTs,
|
|
13530
13531
|
thoughtMergeWindowMs = 0
|
|
13531
13532
|
}) {
|
|
13532
|
-
return
|
|
13533
|
+
return React20.useMemo(() => {
|
|
13533
13534
|
if (isUser) return [];
|
|
13534
13535
|
const extra = message.extraData || {};
|
|
13535
13536
|
const extraToolCalls = extra.tool_calls || [];
|
|
@@ -13778,12 +13779,12 @@ ${m.content}`;
|
|
|
13778
13779
|
}).map((item, index) => ({ ...item, id: `${item.kind}-${item.id}-${index}` }));
|
|
13779
13780
|
}, [message, isUser, toolCalls, components, plan, thoughts, includeThoughts, includeMessage, messageContent, messageTs, thoughtMergeWindowMs]);
|
|
13780
13781
|
}
|
|
13781
|
-
var ThoughtBlockItem =
|
|
13782
|
+
var ThoughtBlockItem = React20.memo(function ThoughtBlockItem2({
|
|
13782
13783
|
content,
|
|
13783
13784
|
config
|
|
13784
13785
|
}) {
|
|
13785
|
-
const [expanded, setExpanded] =
|
|
13786
|
-
const lineCount =
|
|
13786
|
+
const [expanded, setExpanded] = React20.useState(false);
|
|
13787
|
+
const lineCount = React20.useMemo(() => content.split("\n").length, [content]);
|
|
13787
13788
|
const shouldToggle = lineCount > 2 || content.length > 120;
|
|
13788
13789
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
13789
13790
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -13807,7 +13808,7 @@ var ThoughtBlockItem = React21.memo(function ThoughtBlockItem2({
|
|
|
13807
13808
|
)
|
|
13808
13809
|
] });
|
|
13809
13810
|
});
|
|
13810
|
-
var MessageBubble =
|
|
13811
|
+
var MessageBubble = React20.memo(function MessageBubble2({
|
|
13811
13812
|
message,
|
|
13812
13813
|
isStreaming = false,
|
|
13813
13814
|
streamingContent,
|
|
@@ -13833,11 +13834,11 @@ var MessageBubble = React21.memo(function MessageBubble2({
|
|
|
13833
13834
|
const MessageImageComp = useComponent("MessageImage") || MessageImageInternal;
|
|
13834
13835
|
const MessageVideoComp = useComponent("MessageVideo") || MessageVideoInternal;
|
|
13835
13836
|
const ImagePreviewComp = useComponent("ImagePreview") || ImagePreviewInternal;
|
|
13836
|
-
const [copied, setCopied] =
|
|
13837
|
-
const [showThoughts, setShowThoughts] =
|
|
13838
|
-
const [showDeleteConfirm, setShowDeleteConfirm] =
|
|
13839
|
-
const [isDeleting, setIsDeleting] =
|
|
13840
|
-
const [previewMedia, setPreviewMedia] =
|
|
13837
|
+
const [copied, setCopied] = React20.useState(false);
|
|
13838
|
+
const [showThoughts, setShowThoughts] = React20.useState(false);
|
|
13839
|
+
const [showDeleteConfirm, setShowDeleteConfirm] = React20.useState(false);
|
|
13840
|
+
const [isDeleting, setIsDeleting] = React20.useState(false);
|
|
13841
|
+
const [previewMedia, setPreviewMedia] = React20.useState(null);
|
|
13841
13842
|
const pendingComponents = useAgentStore((state) => state.chatUI.pendingComponents);
|
|
13842
13843
|
const pendingComponentsSessionId = useAgentStore((state) => state.chatUI.pendingComponentsSessionId);
|
|
13843
13844
|
const isUser = message.role === "user";
|
|
@@ -13849,7 +13850,7 @@ var MessageBubble = React21.memo(function MessageBubble2({
|
|
|
13849
13850
|
thoughts,
|
|
13850
13851
|
pendingToolCalls
|
|
13851
13852
|
});
|
|
13852
|
-
const hasToolCallImages =
|
|
13853
|
+
const hasToolCallImages = React20.useMemo(() => {
|
|
13853
13854
|
return toolCalls.some((tc) => {
|
|
13854
13855
|
if (tc.result?.works?.some((w) => w.fileUrl || w.fileId)) return true;
|
|
13855
13856
|
if (tc.result?.outputs?.images) return true;
|
|
@@ -13863,13 +13864,13 @@ var MessageBubble = React21.memo(function MessageBubble2({
|
|
|
13863
13864
|
isUser,
|
|
13864
13865
|
hasToolCallImages
|
|
13865
13866
|
});
|
|
13866
|
-
const handleCopy =
|
|
13867
|
+
const handleCopy = React20.useCallback(async () => {
|
|
13867
13868
|
if (!displayContent) return;
|
|
13868
13869
|
await navigator.clipboard.writeText(displayContent);
|
|
13869
13870
|
setCopied(true);
|
|
13870
13871
|
setTimeout(() => setCopied(false), 2e3);
|
|
13871
13872
|
}, [displayContent]);
|
|
13872
|
-
const handleDelete2 =
|
|
13873
|
+
const handleDelete2 = React20.useCallback(async () => {
|
|
13873
13874
|
if (!onDelete || !message.messageId) return;
|
|
13874
13875
|
setIsDeleting(true);
|
|
13875
13876
|
try {
|
|
@@ -13881,7 +13882,7 @@ var MessageBubble = React21.memo(function MessageBubble2({
|
|
|
13881
13882
|
setIsDeleting(false);
|
|
13882
13883
|
}
|
|
13883
13884
|
}, [onDelete, message.messageId]);
|
|
13884
|
-
const attachments =
|
|
13885
|
+
const attachments = React20.useMemo(() => {
|
|
13885
13886
|
const rawAttachments = message.attachments || [];
|
|
13886
13887
|
const assetStrategy = config?.asset;
|
|
13887
13888
|
const processedAttachments = rawAttachments.map((att) => {
|
|
@@ -13907,8 +13908,8 @@ var MessageBubble = React21.memo(function MessageBubble2({
|
|
|
13907
13908
|
thoughts,
|
|
13908
13909
|
isStreaming
|
|
13909
13910
|
});
|
|
13910
|
-
const [stickyComponents, setStickyComponents] =
|
|
13911
|
-
const mergedComponents =
|
|
13911
|
+
const [stickyComponents, setStickyComponents] = React20.useState([]);
|
|
13912
|
+
const mergedComponents = React20.useMemo(() => {
|
|
13912
13913
|
const map3 = /* @__PURE__ */ new Map();
|
|
13913
13914
|
effectiveComponents.forEach((c) => {
|
|
13914
13915
|
if (c?.id) map3.set(String(c.id), c);
|
|
@@ -13931,7 +13932,7 @@ var MessageBubble = React21.memo(function MessageBubble2({
|
|
|
13931
13932
|
const hasOtherContent = hasPlan || hasToolCalls || hasComponents;
|
|
13932
13933
|
const hasAttachmentOnly = isUser && attachments.length > 0 && !hasValidContent;
|
|
13933
13934
|
const showThoughtsInTimeline = (config?.chatLayout?.showThoughtsInTimeline ?? true) && !hasPlan;
|
|
13934
|
-
const allCustomResponses =
|
|
13935
|
+
const allCustomResponses = React20.useMemo(() => {
|
|
13935
13936
|
const responses = [];
|
|
13936
13937
|
dedupedToolCalls.forEach((tc) => {
|
|
13937
13938
|
if (tc.result) {
|
|
@@ -14303,281 +14304,14 @@ var MessageBubble = React21.memo(function MessageBubble2({
|
|
|
14303
14304
|
] });
|
|
14304
14305
|
});
|
|
14305
14306
|
var MessageBubble_default = MessageBubble;
|
|
14306
|
-
var EmptyState =
|
|
14307
|
+
var EmptyState = React20.memo(function EmptyState2() {
|
|
14307
14308
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center justify-center h-full", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
|
|
14308
14309
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-12 h-12 rounded-xl bg-zinc-800/50 flex items-center justify-center mx-auto mb-3", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { size: 24, className: "text-zinc-600" }) }),
|
|
14309
14310
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-zinc-600 text-sm", children: "\u5F00\u59CB\u5BF9\u8BDD\u5427" })
|
|
14310
14311
|
] }) });
|
|
14311
14312
|
});
|
|
14312
|
-
var LoadingState =
|
|
14313
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center justify-center h-full", children: /* @__PURE__ */ jsxRuntime.
|
|
14314
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-8 h-8 text-[#d8ff00] animate-spin mx-auto mb-3" }),
|
|
14315
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-zinc-500 text-sm", children: "\u52A0\u8F7D\u6D88\u606F\u4E2D..." })
|
|
14316
|
-
] }) });
|
|
14317
|
-
});
|
|
14318
|
-
var CodeBlock3 = React21.memo(function CodeBlock4({ children, className }) {
|
|
14319
|
-
const [copied, setCopied] = React21.useState(false);
|
|
14320
|
-
const language = className?.replace("language-", "") || "text";
|
|
14321
|
-
const handleCopy = async () => {
|
|
14322
|
-
await navigator.clipboard.writeText(children);
|
|
14323
|
-
setCopied(true);
|
|
14324
|
-
setTimeout(() => setCopied(false), 2e3);
|
|
14325
|
-
};
|
|
14326
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative group my-2 rounded-lg overflow-hidden bg-zinc-900 border border-zinc-800", children: [
|
|
14327
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-3 py-1.5 bg-zinc-800/50 border-b border-zinc-800", children: [
|
|
14328
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-zinc-500 font-mono", children: language }),
|
|
14329
|
-
/* @__PURE__ */ jsxRuntime.jsxs("button", { onClick: handleCopy, className: "flex items-center gap-1 text-xs text-zinc-500 hover:text-zinc-300 transition-colors", children: [
|
|
14330
|
-
copied ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { size: 12, className: "text-green-400" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { size: 12 }),
|
|
14331
|
-
copied ? "\u5DF2\u590D\u5236" : "\u590D\u5236"
|
|
14332
|
-
] })
|
|
14333
|
-
] }),
|
|
14334
|
-
/* @__PURE__ */ jsxRuntime.jsx("pre", { className: "p-3 overflow-x-auto text-xs", children: /* @__PURE__ */ jsxRuntime.jsx("code", { className: `${className} text-zinc-300`, children }) })
|
|
14335
|
-
] });
|
|
14336
|
-
});
|
|
14337
|
-
var ResolvedMarkdownMedia3 = React21.memo(function ResolvedMarkdownMedia4({
|
|
14338
|
-
src,
|
|
14339
|
-
alt,
|
|
14340
|
-
config
|
|
14341
|
-
}) {
|
|
14342
|
-
const [media, setMedia] = React21.useState(null);
|
|
14343
|
-
React21.useEffect(() => {
|
|
14344
|
-
let active = true;
|
|
14345
|
-
const load = async () => {
|
|
14346
|
-
if (!src) {
|
|
14347
|
-
if (active) setMedia(null);
|
|
14348
|
-
return;
|
|
14349
|
-
}
|
|
14350
|
-
const asset = createAssetFromSource({
|
|
14351
|
-
fileUrl: src,
|
|
14352
|
-
fileId: isHttpUrl(src) ? void 0 : src,
|
|
14353
|
-
type: inferAssetTypeFromUrl(src)
|
|
14354
|
-
});
|
|
14355
|
-
if (!asset) {
|
|
14356
|
-
if (active) setMedia(null);
|
|
14357
|
-
return;
|
|
14358
|
-
}
|
|
14359
|
-
const resolved = await resolveAssetForDisplay(asset, config);
|
|
14360
|
-
if (active) setMedia(resolved);
|
|
14361
|
-
};
|
|
14362
|
-
load();
|
|
14363
|
-
return () => {
|
|
14364
|
-
active = false;
|
|
14365
|
-
};
|
|
14366
|
-
}, [src, config]);
|
|
14367
|
-
if (!media) return null;
|
|
14368
|
-
if (media.isVideo) {
|
|
14369
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14370
|
-
"video",
|
|
14371
|
-
{
|
|
14372
|
-
src: media.url,
|
|
14373
|
-
controls: true,
|
|
14374
|
-
className: "max-w-full rounded-lg max-h-[320px] w-full my-2",
|
|
14375
|
-
preload: "metadata"
|
|
14376
|
-
}
|
|
14377
|
-
);
|
|
14378
|
-
}
|
|
14379
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14380
|
-
"img",
|
|
14381
|
-
{
|
|
14382
|
-
src: media.url,
|
|
14383
|
-
alt: alt || "image",
|
|
14384
|
-
className: "max-w-full rounded-lg max-h-[320px] w-full my-2 object-contain"
|
|
14385
|
-
}
|
|
14386
|
-
);
|
|
14387
|
-
});
|
|
14388
|
-
var MarkdownContent3 = React21.memo(function MarkdownContent4({ content, config }) {
|
|
14389
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14390
|
-
ReactMarkdown__default.default,
|
|
14391
|
-
{
|
|
14392
|
-
remarkPlugins: [remarkGfm],
|
|
14393
|
-
components: {
|
|
14394
|
-
code({ className, children, ...props }) {
|
|
14395
|
-
const codeString = String(children).replace(/\n$/, "");
|
|
14396
|
-
const isBlock = className || codeString.includes("\n");
|
|
14397
|
-
if (isBlock) return /* @__PURE__ */ jsxRuntime.jsx(CodeBlock3, { className, children: codeString });
|
|
14398
|
-
return /* @__PURE__ */ jsxRuntime.jsx("code", { className: "px-1 py-0.5 bg-zinc-800 rounded text-[#d8ff00] text-xs font-mono", ...props, children });
|
|
14399
|
-
},
|
|
14400
|
-
p: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-2 last:mb-0 leading-relaxed", children }),
|
|
14401
|
-
h1: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-base font-bold mb-2 mt-3 first:mt-0", children }),
|
|
14402
|
-
h2: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-sm font-bold mb-2 mt-3 first:mt-0", children }),
|
|
14403
|
-
h3: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-semibold mb-1 mt-2 first:mt-0", children }),
|
|
14404
|
-
ul: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "list-disc list-inside mb-2 space-y-0.5", children }),
|
|
14405
|
-
ol: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "list-decimal list-inside mb-2 space-y-0.5", children }),
|
|
14406
|
-
li: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "leading-relaxed", children }),
|
|
14407
|
-
blockquote: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("blockquote", { className: "border-l-2 border-[#d8ff00]/50 pl-2 my-2 text-zinc-400 italic", children }),
|
|
14408
|
-
img: ({ src, alt }) => /* @__PURE__ */ jsxRuntime.jsx(ResolvedMarkdownMedia3, { src, alt, config }),
|
|
14409
|
-
a: ({ href, children }) => {
|
|
14410
|
-
const link2 = href || "";
|
|
14411
|
-
const isMediaLink = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i.test(link2) || isVideoUrl(link2);
|
|
14412
|
-
if (isMediaLink) {
|
|
14413
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ResolvedMarkdownMedia3, { src: link2, alt: typeof children === "string" ? children : void 0, config });
|
|
14414
|
-
}
|
|
14415
|
-
return /* @__PURE__ */ jsxRuntime.jsx("a", { href, target: "_blank", rel: "noopener noreferrer", className: "text-[#d8ff00] hover:underline", children });
|
|
14416
|
-
},
|
|
14417
|
-
strong: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("strong", { className: "font-semibold text-white", children }),
|
|
14418
|
-
em: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("em", { className: "italic", children })
|
|
14419
|
-
},
|
|
14420
|
-
children: content
|
|
14421
|
-
}
|
|
14422
|
-
);
|
|
14423
|
-
});
|
|
14424
|
-
var ToolCallCard5 = React21.memo(function ToolCallCard6({ toolCall }) {
|
|
14425
|
-
const [expanded, setExpanded] = React21.useState(false);
|
|
14426
|
-
console.log("[UI] \u{1F527} ToolCallCard \u6536\u5230 toolCall:", { id: toolCall.id, status: toolCall.status });
|
|
14427
|
-
if (toolCall.status === "waiting_confirmation") {
|
|
14428
|
-
console.log("[UI] \u2705 \u6E32\u67D3 ToolConfirmCard (waiting_confirmation)");
|
|
14429
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ToolConfirmCard, { toolCall, compact: true });
|
|
14430
|
-
}
|
|
14431
|
-
console.log("[UI] \u26A0\uFE0F \u6E32\u67D3\u666E\u901A\u5361\u7247\uFF0Cstatus =", toolCall.status);
|
|
14432
|
-
const getStatusConfig = () => {
|
|
14433
|
-
switch (toolCall.status) {
|
|
14434
|
-
case "completed":
|
|
14435
|
-
return {
|
|
14436
|
-
bgColor: "bg-green-500/20",
|
|
14437
|
-
textColor: "text-green-400",
|
|
14438
|
-
borderColor: "border-green-500/30",
|
|
14439
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { size: 12, className: "text-green-400" }),
|
|
14440
|
-
label: "\u5B8C\u6210"
|
|
14441
|
-
};
|
|
14442
|
-
case "failed":
|
|
14443
|
-
return {
|
|
14444
|
-
bgColor: "bg-red-500/20",
|
|
14445
|
-
textColor: "text-red-400",
|
|
14446
|
-
borderColor: "border-red-500/30",
|
|
14447
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Lightbulb, { size: 12, className: "text-red-400" }),
|
|
14448
|
-
label: "\u5931\u8D25"
|
|
14449
|
-
};
|
|
14450
|
-
case "rejected":
|
|
14451
|
-
return {
|
|
14452
|
-
bgColor: "bg-zinc-500/20",
|
|
14453
|
-
textColor: "text-zinc-400",
|
|
14454
|
-
borderColor: "border-zinc-500/30",
|
|
14455
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Lightbulb, { size: 12, className: "text-zinc-400" }),
|
|
14456
|
-
label: "\u5DF2\u62D2\u7EDD"
|
|
14457
|
-
};
|
|
14458
|
-
case "confirmed":
|
|
14459
|
-
case "executing":
|
|
14460
|
-
return {
|
|
14461
|
-
bgColor: "bg-blue-500/20",
|
|
14462
|
-
textColor: "text-blue-400",
|
|
14463
|
-
borderColor: "border-blue-500/30",
|
|
14464
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { size: 12, className: "text-blue-400 animate-spin" }),
|
|
14465
|
-
label: "\u6267\u884C\u4E2D"
|
|
14466
|
-
};
|
|
14467
|
-
default:
|
|
14468
|
-
return {
|
|
14469
|
-
bgColor: "bg-amber-500/20",
|
|
14470
|
-
textColor: "text-amber-400",
|
|
14471
|
-
borderColor: "border-amber-500/30",
|
|
14472
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { size: 12, className: "text-amber-400 animate-spin" }),
|
|
14473
|
-
label: "\u6267\u884C\u4E2D"
|
|
14474
|
-
};
|
|
14475
|
-
}
|
|
14476
|
-
};
|
|
14477
|
-
const statusConfig = getStatusConfig();
|
|
14478
|
-
const hasArguments = toolCall.arguments && Object.keys(toolCall.arguments).length > 0;
|
|
14479
|
-
const hasResult = toolCall.result || toolCall.error;
|
|
14480
|
-
const canExpand = hasArguments || hasResult;
|
|
14481
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `rounded-lg border ${statusConfig.borderColor} overflow-hidden bg-zinc-900/60`, children: [
|
|
14482
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
14483
|
-
"button",
|
|
14484
|
-
{
|
|
14485
|
-
onClick: () => canExpand && setExpanded(!expanded),
|
|
14486
|
-
disabled: !canExpand,
|
|
14487
|
-
className: `w-full flex items-center gap-2 px-3 py-2 ${canExpand ? "hover:bg-zinc-800/50 cursor-pointer" : "cursor-default"} transition-colors`,
|
|
14488
|
-
children: [
|
|
14489
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `w-5 h-5 rounded flex items-center justify-center ${statusConfig.bgColor}`, children: statusConfig.icon }),
|
|
14490
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-zinc-300 truncate flex-1 text-left", children: toolCall.displayName || toolCall.name?.replace("comfy_", "") || "Tool" }),
|
|
14491
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `text-[10px] px-1.5 py-0.5 rounded ${statusConfig.bgColor} ${statusConfig.textColor}`, children: statusConfig.label }),
|
|
14492
|
-
canExpand && (expanded ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, { size: 12, className: "text-zinc-500" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { size: 12, className: "text-zinc-500" }))
|
|
14493
|
-
]
|
|
14494
|
-
}
|
|
14495
|
-
),
|
|
14496
|
-
expanded && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-zinc-700/50 px-3 py-2 space-y-2", children: [
|
|
14497
|
-
hasArguments && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
14498
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[10px] text-zinc-500 uppercase tracking-wide mb-1", children: "\u53C2\u6570" }),
|
|
14499
|
-
/* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-[11px] text-zinc-400 bg-zinc-800/50 rounded p-2 overflow-x-auto font-mono", children: JSON.stringify(toolCall.arguments, null, 2) })
|
|
14500
|
-
] }),
|
|
14501
|
-
toolCall.result && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
14502
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[10px] text-zinc-500 uppercase tracking-wide mb-1", children: "\u7ED3\u679C" }),
|
|
14503
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[11px] text-zinc-300 bg-zinc-800/50 rounded p-2 overflow-x-auto max-h-40 overflow-y-auto", children: typeof toolCall.result === "string" ? toolCall.result.length > 500 ? /* @__PURE__ */ jsxRuntime.jsxs("pre", { className: "font-mono whitespace-pre-wrap break-words", children: [
|
|
14504
|
-
toolCall.result.slice(0, 500),
|
|
14505
|
-
"..."
|
|
14506
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "font-mono whitespace-pre-wrap break-words", children: toolCall.result }) : /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "font-mono", children: JSON.stringify(toolCall.result, null, 2) }) })
|
|
14507
|
-
] }),
|
|
14508
|
-
toolCall.error && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
14509
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[10px] text-red-400 uppercase tracking-wide mb-1", children: "\u9519\u8BEF" }),
|
|
14510
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[11px] text-red-300 bg-red-500/10 rounded p-2 overflow-x-auto", children: toolCall.error })
|
|
14511
|
-
] })
|
|
14512
|
-
] })
|
|
14513
|
-
] });
|
|
14514
|
-
});
|
|
14515
|
-
var ThinkingBubble = React21.memo(function ThinkingBubble2({
|
|
14516
|
-
thoughts,
|
|
14517
|
-
pendingToolCalls = [],
|
|
14518
|
-
config
|
|
14519
|
-
}) {
|
|
14520
|
-
const [expanded, setExpanded] = React21.useState(true);
|
|
14521
|
-
const { content: thinkingContent, toolCalls: thoughtToolCalls, isThinking } = React21.useMemo(
|
|
14522
|
-
() => parseThoughts(thoughts),
|
|
14523
|
-
[thoughts]
|
|
14524
|
-
);
|
|
14525
|
-
const toolCalls = React21.useMemo(() => {
|
|
14526
|
-
const toolCallMap = /* @__PURE__ */ new Map();
|
|
14527
|
-
thoughtToolCalls.forEach((tc) => {
|
|
14528
|
-
toolCallMap.set(tc.id, tc);
|
|
14529
|
-
});
|
|
14530
|
-
console.log("[UI] \u{1F3A8} thoughtToolCalls:", thoughtToolCalls.map((tc) => ({ id: tc.id, status: tc.status })));
|
|
14531
|
-
console.log("[UI] \u{1F3A8} pendingToolCalls:", pendingToolCalls.map((tc) => ({ id: tc.id, status: tc.status })));
|
|
14532
|
-
pendingToolCalls.forEach((tc) => {
|
|
14533
|
-
const existing = toolCallMap.get(tc.id);
|
|
14534
|
-
if (existing) {
|
|
14535
|
-
const existingPriority = getToolCallStatusPriority(existing.status);
|
|
14536
|
-
const tcPriority = getToolCallStatusPriority(tc.status);
|
|
14537
|
-
console.log(`[UI] \u{1F3A8} \u5408\u5E76 id=${tc.id}: existing.status=${existing.status}(${existingPriority}), pending.status=${tc.status}(${tcPriority})`);
|
|
14538
|
-
if (tcPriority >= existingPriority) {
|
|
14539
|
-
toolCallMap.set(tc.id, { ...existing, ...tc });
|
|
14540
|
-
} else {
|
|
14541
|
-
toolCallMap.set(tc.id, { ...tc, ...existing });
|
|
14542
|
-
}
|
|
14543
|
-
} else {
|
|
14544
|
-
toolCallMap.set(tc.id, tc);
|
|
14545
|
-
}
|
|
14546
|
-
});
|
|
14547
|
-
const result = Array.from(toolCallMap.values());
|
|
14548
|
-
console.log("[UI] \u{1F3A8} \u6700\u7EC8 toolCalls:", result.map((tc) => ({ id: tc.id, status: tc.status })));
|
|
14549
|
-
return result;
|
|
14550
|
-
}, [thoughtToolCalls, pendingToolCalls]);
|
|
14551
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3", children: [
|
|
14552
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-8 h-8 rounded-lg bg-[#d8ff00] flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bot, { size: 16, className: "text-black" }) }),
|
|
14553
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-start max-w-[75%] min-w-0", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-zinc-800/80 text-zinc-100 rounded-2xl rounded-tl-sm overflow-hidden w-full", children: [
|
|
14554
|
-
/* @__PURE__ */ jsxRuntime.jsxs("button", { onClick: () => setExpanded(!expanded), className: "w-full flex items-center justify-between px-4 py-3 hover:bg-zinc-700/30 transition-colors", children: [
|
|
14555
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
14556
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { size: 16, className: "text-[#d8ff00] animate-spin" }),
|
|
14557
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-zinc-200", children: "\u6B63\u5728\u601D\u8003..." }),
|
|
14558
|
-
toolCalls.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-zinc-500", children: [
|
|
14559
|
-
toolCalls.length,
|
|
14560
|
-
" \u6B21\u5DE5\u5177\u8C03\u7528"
|
|
14561
|
-
] })
|
|
14562
|
-
] }),
|
|
14563
|
-
expanded ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, { size: 14, className: "text-zinc-500" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { size: 14, className: "text-zinc-500" })
|
|
14564
|
-
] }),
|
|
14565
|
-
expanded && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 pb-4 space-y-3 border-t border-zinc-700/50 overflow-hidden", children: [
|
|
14566
|
-
thinkingContent ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm text-zinc-400 leading-relaxed pt-3 prose prose-invert prose-sm max-w-none [&_*]:break-words", children: [
|
|
14567
|
-
/* @__PURE__ */ jsxRuntime.jsx(MarkdownContent3, { content: thinkingContent, config }),
|
|
14568
|
-
isThinking && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-block w-0.5 h-4 bg-[#d8ff00] animate-pulse ml-1 align-middle" })
|
|
14569
|
-
] }) : isThinking && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm text-zinc-500 pt-3", children: [
|
|
14570
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex gap-1", children: [
|
|
14571
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-1.5 h-1.5 bg-[#d8ff00] rounded-full animate-bounce", style: { animationDelay: "0ms" } }),
|
|
14572
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-1.5 h-1.5 bg-[#d8ff00] rounded-full animate-bounce", style: { animationDelay: "150ms" } }),
|
|
14573
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-1.5 h-1.5 bg-[#d8ff00] rounded-full animate-bounce", style: { animationDelay: "300ms" } })
|
|
14574
|
-
] }),
|
|
14575
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u6B63\u5728\u5206\u6790..." })
|
|
14576
|
-
] }),
|
|
14577
|
-
toolCalls.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2 pt-2", children: toolCalls.map((tc) => /* @__PURE__ */ jsxRuntime.jsx(ToolCallCard5, { toolCall: tc }, tc.id)) })
|
|
14578
|
-
] })
|
|
14579
|
-
] }) })
|
|
14580
|
-
] });
|
|
14313
|
+
var LoadingState = React20.memo(function LoadingState2() {
|
|
14314
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center justify-center h-full", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "animate-spin rounded-full h-6 w-6 border-b-2 border-[#d8ff00]" }) }) });
|
|
14581
14315
|
});
|
|
14582
14316
|
function ChatWindow({
|
|
14583
14317
|
sessionId,
|
|
@@ -14610,42 +14344,42 @@ function ChatWindow({
|
|
|
14610
14344
|
currentThoughtsSessionId: state.chatUI.currentThoughtsSessionId
|
|
14611
14345
|
}))
|
|
14612
14346
|
);
|
|
14613
|
-
const sessionPendingToolCalls =
|
|
14347
|
+
const sessionPendingToolCalls = React20.useMemo(
|
|
14614
14348
|
() => pendingToolCallsSessionId === sessionId ? pendingToolCalls : [],
|
|
14615
14349
|
[pendingToolCalls, pendingToolCallsSessionId, sessionId]
|
|
14616
14350
|
);
|
|
14617
|
-
const sessionCurrentThoughts =
|
|
14351
|
+
const sessionCurrentThoughts = React20.useMemo(
|
|
14618
14352
|
() => currentThoughtsSessionId === sessionId ? currentThoughts : [],
|
|
14619
14353
|
[currentThoughts, currentThoughtsSessionId, sessionId]
|
|
14620
14354
|
);
|
|
14621
14355
|
const isCurrentSessionStreaming = streamingSessionId === sessionId;
|
|
14622
|
-
const containerRef =
|
|
14623
|
-
const messagesEndRef =
|
|
14624
|
-
const [showScrollButton, setShowScrollButton] =
|
|
14625
|
-
const sessionMessages =
|
|
14356
|
+
const containerRef = React20.useRef(null);
|
|
14357
|
+
const messagesEndRef = React20.useRef(null);
|
|
14358
|
+
const [showScrollButton, setShowScrollButton] = React20.useState(false);
|
|
14359
|
+
const sessionMessages = React20.useMemo(
|
|
14626
14360
|
() => messages.filter((m) => m.sessionId === sessionId),
|
|
14627
14361
|
[messages, sessionId]
|
|
14628
14362
|
);
|
|
14629
|
-
const streamingMessage =
|
|
14363
|
+
const streamingMessage = React20.useMemo(
|
|
14630
14364
|
() => sessionMessages.find((m) => m.status === "streaming"),
|
|
14631
14365
|
[sessionMessages]
|
|
14632
14366
|
);
|
|
14633
|
-
const shouldAutoScrollRef =
|
|
14634
|
-
const isNearBottom =
|
|
14367
|
+
const shouldAutoScrollRef = React20.useRef(true);
|
|
14368
|
+
const isNearBottom = React20.useCallback((threshold = 150) => {
|
|
14635
14369
|
const container = containerRef.current;
|
|
14636
14370
|
if (!container) return true;
|
|
14637
14371
|
const { scrollTop, scrollHeight, clientHeight } = container;
|
|
14638
14372
|
return scrollHeight - scrollTop - clientHeight < threshold;
|
|
14639
14373
|
}, []);
|
|
14640
|
-
const scrollToBottom =
|
|
14374
|
+
const scrollToBottom = React20.useCallback((behavior = "smooth") => {
|
|
14641
14375
|
messagesEndRef.current?.scrollIntoView({ behavior, block: "end" });
|
|
14642
14376
|
}, []);
|
|
14643
|
-
const autoScrollIfNeeded =
|
|
14377
|
+
const autoScrollIfNeeded = React20.useCallback(() => {
|
|
14644
14378
|
if (shouldAutoScrollRef.current) {
|
|
14645
14379
|
scrollToBottom("smooth");
|
|
14646
14380
|
}
|
|
14647
14381
|
}, [scrollToBottom]);
|
|
14648
|
-
const getScrollMetrics =
|
|
14382
|
+
const getScrollMetrics = React20.useCallback(() => {
|
|
14649
14383
|
const container = containerRef.current;
|
|
14650
14384
|
if (container && container.scrollHeight - container.clientHeight > 1) {
|
|
14651
14385
|
return {
|
|
@@ -14661,7 +14395,7 @@ function ChatWindow({
|
|
|
14661
14395
|
clientHeight: doc.clientHeight
|
|
14662
14396
|
};
|
|
14663
14397
|
}, []);
|
|
14664
|
-
const updateScrollState =
|
|
14398
|
+
const updateScrollState = React20.useCallback(() => {
|
|
14665
14399
|
const { scrollTop, scrollHeight, clientHeight } = getScrollMetrics();
|
|
14666
14400
|
const distanceFromBottom = scrollHeight - scrollTop - clientHeight;
|
|
14667
14401
|
setShowScrollButton(distanceFromBottom > 200);
|
|
@@ -14669,8 +14403,8 @@ function ChatWindow({
|
|
|
14669
14403
|
shouldAutoScrollRef.current = true;
|
|
14670
14404
|
}
|
|
14671
14405
|
}, [getScrollMetrics]);
|
|
14672
|
-
const lastScrollTopRef =
|
|
14673
|
-
|
|
14406
|
+
const lastScrollTopRef = React20.useRef(0);
|
|
14407
|
+
React20.useEffect(() => {
|
|
14674
14408
|
const handleScroll = () => {
|
|
14675
14409
|
const container2 = containerRef.current;
|
|
14676
14410
|
if (!container2) return;
|
|
@@ -14725,14 +14459,14 @@ function ChatWindow({
|
|
|
14725
14459
|
window.removeEventListener("wheel", handleWheel);
|
|
14726
14460
|
};
|
|
14727
14461
|
}, [isNearBottom, updateScrollState]);
|
|
14728
|
-
|
|
14462
|
+
React20.useEffect(() => {
|
|
14729
14463
|
if (!loading && sessionMessages.length > 0) {
|
|
14730
14464
|
shouldAutoScrollRef.current = true;
|
|
14731
14465
|
scrollToBottom("instant");
|
|
14732
14466
|
}
|
|
14733
14467
|
}, [loading, sessionId, scrollToBottom]);
|
|
14734
|
-
const prevMessageCountRef =
|
|
14735
|
-
|
|
14468
|
+
const prevMessageCountRef = React20.useRef(sessionMessages.length);
|
|
14469
|
+
React20.useEffect(() => {
|
|
14736
14470
|
const prevCount = prevMessageCountRef.current;
|
|
14737
14471
|
const currentCount = sessionMessages.length;
|
|
14738
14472
|
prevMessageCountRef.current = currentCount;
|
|
@@ -14747,17 +14481,17 @@ function ChatWindow({
|
|
|
14747
14481
|
}
|
|
14748
14482
|
updateScrollState();
|
|
14749
14483
|
}, [sessionMessages.length, sessionMessages, scrollToBottom, autoScrollIfNeeded, updateScrollState]);
|
|
14750
|
-
|
|
14484
|
+
React20.useEffect(() => {
|
|
14751
14485
|
if (streamingContent) {
|
|
14752
14486
|
autoScrollIfNeeded();
|
|
14753
14487
|
}
|
|
14754
14488
|
}, [streamingContent, autoScrollIfNeeded]);
|
|
14755
|
-
|
|
14489
|
+
React20.useEffect(() => {
|
|
14756
14490
|
if (isThinking && isCurrentSessionStreaming && sessionCurrentThoughts.length > 0) {
|
|
14757
14491
|
autoScrollIfNeeded();
|
|
14758
14492
|
}
|
|
14759
14493
|
}, [isThinking, isCurrentSessionStreaming, sessionCurrentThoughts.length, autoScrollIfNeeded]);
|
|
14760
|
-
|
|
14494
|
+
React20.useEffect(() => {
|
|
14761
14495
|
if (!isCurrentSessionStreaming) return;
|
|
14762
14496
|
if (sessionPendingToolCalls.length > 0) {
|
|
14763
14497
|
setTimeout(() => autoScrollIfNeeded(), 50);
|
|
@@ -14803,7 +14537,6 @@ function ChatWindow({
|
|
|
14803
14537
|
message.messageId
|
|
14804
14538
|
);
|
|
14805
14539
|
}),
|
|
14806
|
-
isThinking && isCurrentSessionStreaming && !streamingMessage && (sessionCurrentThoughts.length > 0 || sessionPendingToolCalls.length > 0) && /* @__PURE__ */ jsxRuntime.jsx(ThinkingBubble, { thoughts: sessionCurrentThoughts, pendingToolCalls: sessionPendingToolCalls, config }),
|
|
14807
14540
|
isThinking && isCurrentSessionStreaming && !streamingMessage && sessionCurrentThoughts.length === 0 && sessionPendingToolCalls.length === 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3", children: [
|
|
14808
14541
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-8 h-8 rounded-lg bg-[#d8ff00] flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bot, { size: 16, className: "text-black" }) }),
|
|
14809
14542
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-zinc-800/80 rounded-2xl rounded-tl-sm px-4 py-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-zinc-400 text-sm", children: [
|
|
@@ -14839,10 +14572,10 @@ function ChatWindow({
|
|
|
14839
14572
|
chatError && /* @__PURE__ */ jsxRuntime.jsx(ChatErrorBanner, { error: chatError })
|
|
14840
14573
|
] });
|
|
14841
14574
|
}
|
|
14842
|
-
var ChatErrorBanner =
|
|
14843
|
-
const [visible, setVisible] =
|
|
14575
|
+
var ChatErrorBanner = React20.memo(function ChatErrorBanner2({ error }) {
|
|
14576
|
+
const [visible, setVisible] = React20.useState(true);
|
|
14844
14577
|
const { setChatError } = useAgentStore();
|
|
14845
|
-
|
|
14578
|
+
React20.useEffect(() => {
|
|
14846
14579
|
const timer = setTimeout(() => {
|
|
14847
14580
|
setVisible(false);
|
|
14848
14581
|
setChatError(void 0);
|
|
@@ -14865,10 +14598,10 @@ var ChatErrorBanner = React21.memo(function ChatErrorBanner2({ error }) {
|
|
|
14865
14598
|
)
|
|
14866
14599
|
] }) });
|
|
14867
14600
|
});
|
|
14868
|
-
var ChatWindow_default =
|
|
14869
|
-
var MessageImage =
|
|
14870
|
-
const [loaded, setLoaded] =
|
|
14871
|
-
const [error, setError] =
|
|
14601
|
+
var ChatWindow_default = React20.memo(ChatWindow);
|
|
14602
|
+
var MessageImage = React20.memo(function MessageImage2({ src, alt }) {
|
|
14603
|
+
const [loaded, setLoaded] = React20.useState(false);
|
|
14604
|
+
const [error, setError] = React20.useState(false);
|
|
14872
14605
|
if (error) {
|
|
14873
14606
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 p-3 bg-zinc-800/50 rounded-lg text-zinc-500 text-sm", children: [
|
|
14874
14607
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ImageIcon, { size: 16 }),
|
|
@@ -14890,7 +14623,7 @@ var MessageImage = React21.memo(function MessageImage2({ src, alt }) {
|
|
|
14890
14623
|
)
|
|
14891
14624
|
] });
|
|
14892
14625
|
});
|
|
14893
|
-
var MessageVideo =
|
|
14626
|
+
var MessageVideo = React20.memo(function MessageVideo2({ src }) {
|
|
14894
14627
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-2 relative rounded-lg overflow-hidden bg-zinc-900 border border-zinc-800", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14895
14628
|
"video",
|
|
14896
14629
|
{
|
|
@@ -14902,12 +14635,12 @@ var MessageVideo = React21.memo(function MessageVideo2({ src }) {
|
|
|
14902
14635
|
}
|
|
14903
14636
|
) });
|
|
14904
14637
|
});
|
|
14905
|
-
var ImagePreview =
|
|
14638
|
+
var ImagePreview = React20.memo(function ImagePreview2({
|
|
14906
14639
|
src,
|
|
14907
14640
|
alt,
|
|
14908
14641
|
onClose
|
|
14909
14642
|
}) {
|
|
14910
|
-
|
|
14643
|
+
React20.useEffect(() => {
|
|
14911
14644
|
const handleKeyDown = (e) => {
|
|
14912
14645
|
if (e.key === "Escape") {
|
|
14913
14646
|
onClose();
|
|
@@ -14916,7 +14649,7 @@ var ImagePreview = React21.memo(function ImagePreview2({
|
|
|
14916
14649
|
window.addEventListener("keydown", handleKeyDown);
|
|
14917
14650
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
14918
14651
|
}, [onClose]);
|
|
14919
|
-
const handleDownload =
|
|
14652
|
+
const handleDownload = React20.useCallback((e) => {
|
|
14920
14653
|
e.stopPropagation();
|
|
14921
14654
|
const link2 = document.createElement("a");
|
|
14922
14655
|
link2.href = src;
|
|
@@ -15080,8 +14813,8 @@ function CompactThinking({ thoughts }) {
|
|
|
15080
14813
|
toolCalls.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1.5 pt-1", children: toolCalls.map((tc, i) => /* @__PURE__ */ jsxRuntime.jsx(ToolCallCardCompact, { toolCall: tc, isStreaming: isThinking }, tc.id || i)) })
|
|
15081
14814
|
] });
|
|
15082
14815
|
}
|
|
15083
|
-
function
|
|
15084
|
-
const [showDetails, setShowDetails] =
|
|
14816
|
+
function ToolCallCard5({ toolCall }) {
|
|
14817
|
+
const [showDetails, setShowDetails] = React20.useState(false);
|
|
15085
14818
|
const isPending = !toolCall.result && toolCall.status !== "completed";
|
|
15086
14819
|
toolCall.status === "completed" || toolCall.result;
|
|
15087
14820
|
const toolName = toolCall.displayName || toolCall.name?.replace("comfy_", "Workflow ") || "Tool";
|
|
@@ -15147,7 +14880,7 @@ function FullThinking({ thoughts }) {
|
|
|
15147
14880
|
" \u6B21"
|
|
15148
14881
|
] })
|
|
15149
14882
|
] }),
|
|
15150
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: toolCalls.map((tc, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
14883
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: toolCalls.map((tc, i) => /* @__PURE__ */ jsxRuntime.jsx(ToolCallCard5, { toolCall: tc }, tc.id || i)) })
|
|
15151
14884
|
] }),
|
|
15152
14885
|
errorThought && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2 p-3 bg-red-500/10 border border-red-500/20 rounded-lg", children: [
|
|
15153
14886
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { size: 16, className: "text-red-400 mt-0.5 flex-shrink-0" }),
|
|
@@ -15156,7 +14889,7 @@ function FullThinking({ thoughts }) {
|
|
|
15156
14889
|
] });
|
|
15157
14890
|
}
|
|
15158
14891
|
function ThinkingProcess({ thoughts, collapsed = false, compact = false }) {
|
|
15159
|
-
const [expanded, setExpanded] =
|
|
14892
|
+
const [expanded, setExpanded] = React20.useState(!collapsed);
|
|
15160
14893
|
if (thoughts.length === 0) return null;
|
|
15161
14894
|
if (compact) {
|
|
15162
14895
|
return /* @__PURE__ */ jsxRuntime.jsx(CompactThinking, { thoughts });
|
|
@@ -15189,14 +14922,14 @@ function ThinkingProcess({ thoughts, collapsed = false, compact = false }) {
|
|
|
15189
14922
|
}
|
|
15190
14923
|
function ToolConfirmDialog({ toolCall }) {
|
|
15191
14924
|
const { removePendingToolCall } = useAgentStore();
|
|
15192
|
-
const [isEditing, setIsEditing] =
|
|
15193
|
-
const [editedArguments, setEditedArguments] =
|
|
14925
|
+
const [isEditing, setIsEditing] = React20.useState(false);
|
|
14926
|
+
const [editedArguments, setEditedArguments] = React20.useState(
|
|
15194
14927
|
JSON.stringify(toolCall.arguments, null, 2)
|
|
15195
14928
|
);
|
|
15196
|
-
const [rejectReason, setRejectReason] =
|
|
15197
|
-
const [loading, setLoading] =
|
|
15198
|
-
const [showRejectInput, setShowRejectInput] =
|
|
15199
|
-
const [error, setError] =
|
|
14929
|
+
const [rejectReason, setRejectReason] = React20.useState("");
|
|
14930
|
+
const [loading, setLoading] = React20.useState(false);
|
|
14931
|
+
const [showRejectInput, setShowRejectInput] = React20.useState(false);
|
|
14932
|
+
const [error, setError] = React20.useState("");
|
|
15200
14933
|
const handleConfirm = async () => {
|
|
15201
14934
|
setLoading(true);
|
|
15202
14935
|
setError("");
|
|
@@ -15357,7 +15090,7 @@ function ToolConfirmDialog({ toolCall }) {
|
|
|
15357
15090
|
}
|
|
15358
15091
|
var Dialog = DialogPrimitive__namespace.Root;
|
|
15359
15092
|
var DialogPortal = DialogPrimitive__namespace.Portal;
|
|
15360
|
-
var DialogOverlay =
|
|
15093
|
+
var DialogOverlay = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
15361
15094
|
DialogPrimitive__namespace.Overlay,
|
|
15362
15095
|
{
|
|
15363
15096
|
ref,
|
|
@@ -15369,7 +15102,7 @@ var DialogOverlay = React21__namespace.forwardRef(({ className, ...props }, ref)
|
|
|
15369
15102
|
}
|
|
15370
15103
|
));
|
|
15371
15104
|
DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
|
|
15372
|
-
var DialogContent =
|
|
15105
|
+
var DialogContent = React20__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
|
|
15373
15106
|
/* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
|
|
15374
15107
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
15375
15108
|
DialogPrimitive__namespace.Content,
|
|
@@ -15419,7 +15152,7 @@ var DialogFooter = ({
|
|
|
15419
15152
|
}
|
|
15420
15153
|
);
|
|
15421
15154
|
DialogFooter.displayName = "DialogFooter";
|
|
15422
|
-
var DialogTitle =
|
|
15155
|
+
var DialogTitle = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
15423
15156
|
DialogPrimitive__namespace.Title,
|
|
15424
15157
|
{
|
|
15425
15158
|
ref,
|
|
@@ -15431,7 +15164,7 @@ var DialogTitle = React21__namespace.forwardRef(({ className, ...props }, ref) =
|
|
|
15431
15164
|
}
|
|
15432
15165
|
));
|
|
15433
15166
|
DialogTitle.displayName = DialogPrimitive__namespace.Title.displayName;
|
|
15434
|
-
var DialogDescription =
|
|
15167
|
+
var DialogDescription = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
15435
15168
|
DialogPrimitive__namespace.Description,
|
|
15436
15169
|
{
|
|
15437
15170
|
ref,
|
|
@@ -15507,7 +15240,7 @@ var buttonVariants = cva(
|
|
|
15507
15240
|
}
|
|
15508
15241
|
}
|
|
15509
15242
|
);
|
|
15510
|
-
var Button =
|
|
15243
|
+
var Button = React20__namespace.forwardRef(
|
|
15511
15244
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
15512
15245
|
const Comp = asChild ? reactSlot.Slot : "button";
|
|
15513
15246
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -15524,7 +15257,7 @@ Button.displayName = "Button";
|
|
|
15524
15257
|
var Badge = ({ children, className }) => {
|
|
15525
15258
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("inline-flex items-center rounded-md bg-muted px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", className), children });
|
|
15526
15259
|
};
|
|
15527
|
-
var Card =
|
|
15260
|
+
var Card = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
15528
15261
|
"div",
|
|
15529
15262
|
{
|
|
15530
15263
|
ref,
|
|
@@ -15536,7 +15269,7 @@ var Card = React21__namespace.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
15536
15269
|
}
|
|
15537
15270
|
));
|
|
15538
15271
|
Card.displayName = "Card";
|
|
15539
|
-
var CardHeader =
|
|
15272
|
+
var CardHeader = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
15540
15273
|
"div",
|
|
15541
15274
|
{
|
|
15542
15275
|
ref,
|
|
@@ -15545,7 +15278,7 @@ var CardHeader = React21__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
15545
15278
|
}
|
|
15546
15279
|
));
|
|
15547
15280
|
CardHeader.displayName = "CardHeader";
|
|
15548
|
-
var CardTitle =
|
|
15281
|
+
var CardTitle = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
15549
15282
|
"h3",
|
|
15550
15283
|
{
|
|
15551
15284
|
ref,
|
|
@@ -15557,7 +15290,7 @@ var CardTitle = React21__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
15557
15290
|
}
|
|
15558
15291
|
));
|
|
15559
15292
|
CardTitle.displayName = "CardTitle";
|
|
15560
|
-
var CardDescription =
|
|
15293
|
+
var CardDescription = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
15561
15294
|
"p",
|
|
15562
15295
|
{
|
|
15563
15296
|
ref,
|
|
@@ -15566,9 +15299,9 @@ var CardDescription = React21__namespace.forwardRef(({ className, ...props }, re
|
|
|
15566
15299
|
}
|
|
15567
15300
|
));
|
|
15568
15301
|
CardDescription.displayName = "CardDescription";
|
|
15569
|
-
var CardContent =
|
|
15302
|
+
var CardContent = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
|
|
15570
15303
|
CardContent.displayName = "CardContent";
|
|
15571
|
-
var CardFooter =
|
|
15304
|
+
var CardFooter = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
15572
15305
|
"div",
|
|
15573
15306
|
{
|
|
15574
15307
|
ref,
|
|
@@ -15590,7 +15323,7 @@ var Separator = ({ className, orientation = "horizontal", decorative = true }) =
|
|
|
15590
15323
|
}
|
|
15591
15324
|
);
|
|
15592
15325
|
};
|
|
15593
|
-
var ScrollArea =
|
|
15326
|
+
var ScrollArea = React20__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
15594
15327
|
ScrollAreaPrimitive__namespace.Root,
|
|
15595
15328
|
{
|
|
15596
15329
|
ref,
|
|
@@ -15604,7 +15337,7 @@ var ScrollArea = React21__namespace.forwardRef(({ className, children, ...props
|
|
|
15604
15337
|
}
|
|
15605
15338
|
));
|
|
15606
15339
|
ScrollArea.displayName = ScrollAreaPrimitive__namespace.Root.displayName;
|
|
15607
|
-
var ScrollBar =
|
|
15340
|
+
var ScrollBar = React20__namespace.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
15608
15341
|
ScrollAreaPrimitive__namespace.ScrollAreaScrollbar,
|
|
15609
15342
|
{
|
|
15610
15343
|
ref,
|
|
@@ -15898,7 +15631,7 @@ var PlanProgressPanel = ({
|
|
|
15898
15631
|
] });
|
|
15899
15632
|
};
|
|
15900
15633
|
var PlanProgressPanel_default = PlanProgressPanel;
|
|
15901
|
-
var Textarea =
|
|
15634
|
+
var Textarea = React20__namespace.forwardRef(
|
|
15902
15635
|
({ className, theme, ...props }, ref) => {
|
|
15903
15636
|
const themeClass = theme === "dark" ? "bg-gray-800 text-white" : "bg-white text-black";
|
|
15904
15637
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -15922,8 +15655,8 @@ var HumanInputDialog = ({
|
|
|
15922
15655
|
onSubmit,
|
|
15923
15656
|
onCancel
|
|
15924
15657
|
}) => {
|
|
15925
|
-
const [input, setInput] =
|
|
15926
|
-
const [error, setError] =
|
|
15658
|
+
const [input, setInput] = React20.useState("");
|
|
15659
|
+
const [error, setError] = React20.useState(null);
|
|
15927
15660
|
const handleSubmit = () => {
|
|
15928
15661
|
if (!input.trim()) {
|
|
15929
15662
|
setError("\u8BF7\u8F93\u5165\u5185\u5BB9");
|
|
@@ -16172,7 +15905,7 @@ var Observer = class {
|
|
|
16172
15905
|
"resolve",
|
|
16173
15906
|
response
|
|
16174
15907
|
];
|
|
16175
|
-
const isReactElementResponse =
|
|
15908
|
+
const isReactElementResponse = React20__namespace.default.isValidElement(response);
|
|
16176
15909
|
if (isReactElementResponse) {
|
|
16177
15910
|
shouldDismiss = false;
|
|
16178
15911
|
this.create({
|
|
@@ -16184,7 +15917,7 @@ var Observer = class {
|
|
|
16184
15917
|
shouldDismiss = false;
|
|
16185
15918
|
const promiseData = typeof data.error === "function" ? await data.error(`HTTP error! status: ${response.status}`) : data.error;
|
|
16186
15919
|
const description = typeof data.description === "function" ? await data.description(`HTTP error! status: ${response.status}`) : data.description;
|
|
16187
|
-
const isExtendedResult = typeof promiseData === "object" && !
|
|
15920
|
+
const isExtendedResult = typeof promiseData === "object" && !React20__namespace.default.isValidElement(promiseData);
|
|
16188
15921
|
const toastSettings = isExtendedResult ? promiseData : {
|
|
16189
15922
|
message: promiseData
|
|
16190
15923
|
};
|
|
@@ -16198,7 +15931,7 @@ var Observer = class {
|
|
|
16198
15931
|
shouldDismiss = false;
|
|
16199
15932
|
const promiseData = typeof data.error === "function" ? await data.error(response) : data.error;
|
|
16200
15933
|
const description = typeof data.description === "function" ? await data.description(response) : data.description;
|
|
16201
|
-
const isExtendedResult = typeof promiseData === "object" && !
|
|
15934
|
+
const isExtendedResult = typeof promiseData === "object" && !React20__namespace.default.isValidElement(promiseData);
|
|
16202
15935
|
const toastSettings = isExtendedResult ? promiseData : {
|
|
16203
15936
|
message: promiseData
|
|
16204
15937
|
};
|
|
@@ -16212,7 +15945,7 @@ var Observer = class {
|
|
|
16212
15945
|
shouldDismiss = false;
|
|
16213
15946
|
const promiseData = typeof data.success === "function" ? await data.success(response) : data.success;
|
|
16214
15947
|
const description = typeof data.description === "function" ? await data.description(response) : data.description;
|
|
16215
|
-
const isExtendedResult = typeof promiseData === "object" && !
|
|
15948
|
+
const isExtendedResult = typeof promiseData === "object" && !React20__namespace.default.isValidElement(promiseData);
|
|
16216
15949
|
const toastSettings = isExtendedResult ? promiseData : {
|
|
16217
15950
|
message: promiseData
|
|
16218
15951
|
};
|
|
@@ -16232,7 +15965,7 @@ var Observer = class {
|
|
|
16232
15965
|
shouldDismiss = false;
|
|
16233
15966
|
const promiseData = typeof data.error === "function" ? await data.error(error) : data.error;
|
|
16234
15967
|
const description = typeof data.description === "function" ? await data.description(error) : data.description;
|
|
16235
|
-
const isExtendedResult = typeof promiseData === "object" && !
|
|
15968
|
+
const isExtendedResult = typeof promiseData === "object" && !React20__namespace.default.isValidElement(promiseData);
|
|
16236
15969
|
const toastSettings = isExtendedResult ? promiseData : {
|
|
16237
15970
|
message: promiseData
|
|
16238
15971
|
};
|
|
@@ -16310,22 +16043,22 @@ var toast = Object.assign(basicToast, {
|
|
|
16310
16043
|
});
|
|
16311
16044
|
__insertCSS("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
|
|
16312
16045
|
function ShareModal({ sessionId, sessionTitle, isOpen, onClose }) {
|
|
16313
|
-
const [loading, setLoading] =
|
|
16314
|
-
const [creating, setCreating] =
|
|
16315
|
-
const [shares, setShares] =
|
|
16316
|
-
const [copied, setCopied] =
|
|
16317
|
-
const [showCreateForm, setShowCreateForm] =
|
|
16318
|
-
const [title, setTitle] =
|
|
16319
|
-
const [hasPassword, setHasPassword] =
|
|
16320
|
-
const [password, setPassword] =
|
|
16321
|
-
const [expireDays, setExpireDays] =
|
|
16322
|
-
const [editingShare, setEditingShare] =
|
|
16323
|
-
const [editTitle, setEditTitle] =
|
|
16324
|
-
const [editHasPassword, setEditHasPassword] =
|
|
16325
|
-
const [editPassword, setEditPassword] =
|
|
16326
|
-
const [editEnabled, setEditEnabled] =
|
|
16327
|
-
const [updating, setUpdating] =
|
|
16328
|
-
|
|
16046
|
+
const [loading, setLoading] = React20.useState(true);
|
|
16047
|
+
const [creating, setCreating] = React20.useState(false);
|
|
16048
|
+
const [shares, setShares] = React20.useState([]);
|
|
16049
|
+
const [copied, setCopied] = React20.useState(null);
|
|
16050
|
+
const [showCreateForm, setShowCreateForm] = React20.useState(false);
|
|
16051
|
+
const [title, setTitle] = React20.useState("");
|
|
16052
|
+
const [hasPassword, setHasPassword] = React20.useState(false);
|
|
16053
|
+
const [password, setPassword] = React20.useState("");
|
|
16054
|
+
const [expireDays, setExpireDays] = React20.useState(30);
|
|
16055
|
+
const [editingShare, setEditingShare] = React20.useState(null);
|
|
16056
|
+
const [editTitle, setEditTitle] = React20.useState("");
|
|
16057
|
+
const [editHasPassword, setEditHasPassword] = React20.useState(false);
|
|
16058
|
+
const [editPassword, setEditPassword] = React20.useState("");
|
|
16059
|
+
const [editEnabled, setEditEnabled] = React20.useState(true);
|
|
16060
|
+
const [updating, setUpdating] = React20.useState(false);
|
|
16061
|
+
React20.useEffect(() => {
|
|
16329
16062
|
if (!isOpen || !sessionId) return;
|
|
16330
16063
|
async function loadShares() {
|
|
16331
16064
|
try {
|
|
@@ -16729,17 +16462,17 @@ var SaveTemplateDialog = ({
|
|
|
16729
16462
|
onCancel,
|
|
16730
16463
|
isSaving = false
|
|
16731
16464
|
}) => {
|
|
16732
|
-
const [name, setName] =
|
|
16733
|
-
const [description, setDescription] =
|
|
16734
|
-
const [content, setContent] =
|
|
16735
|
-
const [category, setCategory] =
|
|
16736
|
-
const [visibility, setVisibility] =
|
|
16737
|
-
const [variables, setVariables] =
|
|
16738
|
-
const [error, setError] =
|
|
16739
|
-
|
|
16465
|
+
const [name, setName] = React20.useState("");
|
|
16466
|
+
const [description, setDescription] = React20.useState("");
|
|
16467
|
+
const [content, setContent] = React20.useState(originalContent);
|
|
16468
|
+
const [category, setCategory] = React20.useState("\u5176\u4ED6");
|
|
16469
|
+
const [visibility, setVisibility] = React20.useState("PRIVATE");
|
|
16470
|
+
const [variables, setVariables] = React20.useState([]);
|
|
16471
|
+
const [error, setError] = React20.useState(null);
|
|
16472
|
+
React20.useEffect(() => {
|
|
16740
16473
|
setContent(originalContent);
|
|
16741
16474
|
}, [originalContent]);
|
|
16742
|
-
|
|
16475
|
+
React20.useEffect(() => {
|
|
16743
16476
|
const detectedVars = extractVariables(content);
|
|
16744
16477
|
setVariables(detectedVars);
|
|
16745
16478
|
}, [content]);
|
|
@@ -16932,8 +16665,8 @@ var UpdateTemplateDialog = ({
|
|
|
16932
16665
|
onCancel,
|
|
16933
16666
|
isUpdating = false
|
|
16934
16667
|
}) => {
|
|
16935
|
-
const [changeDescription, setChangeDescription] =
|
|
16936
|
-
const [error, setError] =
|
|
16668
|
+
const [changeDescription, setChangeDescription] = React20.useState("");
|
|
16669
|
+
const [error, setError] = React20.useState(null);
|
|
16937
16670
|
const handleUpdate = () => {
|
|
16938
16671
|
if (!changeDescription.trim()) {
|
|
16939
16672
|
setError("\u8BF7\u8F93\u5165\u53D8\u66F4\u8BF4\u660E");
|
|
@@ -17072,7 +16805,7 @@ var TemplateSourceBadge = ({
|
|
|
17072
16805
|
onUpdateTemplate,
|
|
17073
16806
|
onSaveAsNewTemplate
|
|
17074
16807
|
}) => {
|
|
17075
|
-
const [isExpanded, setIsExpanded] =
|
|
16808
|
+
const [isExpanded, setIsExpanded] = React20.useState(false);
|
|
17076
16809
|
if (!template) return null;
|
|
17077
16810
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2", children: [
|
|
17078
16811
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -17129,12 +16862,12 @@ var TemplateSourceBadge = ({
|
|
|
17129
16862
|
};
|
|
17130
16863
|
var TemplateSourceBadge_default = TemplateSourceBadge;
|
|
17131
16864
|
var TemplateSelector = ({ isOpen, onClose, onSelectTemplate }) => {
|
|
17132
|
-
const [activeTab, setActiveTab] =
|
|
17133
|
-
const [searchKeyword, setSearchKeyword] =
|
|
17134
|
-
const [selectedCategory, setSelectedCategory] =
|
|
17135
|
-
const [loading, setLoading] =
|
|
17136
|
-
const [templates, setTemplates] =
|
|
17137
|
-
const [categories, setCategories] =
|
|
16865
|
+
const [activeTab, setActiveTab] = React20.useState("recent");
|
|
16866
|
+
const [searchKeyword, setSearchKeyword] = React20.useState("");
|
|
16867
|
+
const [selectedCategory, setSelectedCategory] = React20.useState("");
|
|
16868
|
+
const [loading, setLoading] = React20.useState(false);
|
|
16869
|
+
const [templates, setTemplates] = React20.useState([]);
|
|
16870
|
+
const [categories, setCategories] = React20.useState([]);
|
|
17138
16871
|
const loadTemplates = async () => {
|
|
17139
16872
|
try {
|
|
17140
16873
|
setLoading(true);
|
|
@@ -17189,14 +16922,14 @@ var TemplateSelector = ({ isOpen, onClose, onSelectTemplate }) => {
|
|
|
17189
16922
|
setLoading(false);
|
|
17190
16923
|
}
|
|
17191
16924
|
};
|
|
17192
|
-
|
|
16925
|
+
React20.useEffect(() => {
|
|
17193
16926
|
if (isOpen) {
|
|
17194
16927
|
setSearchKeyword("");
|
|
17195
16928
|
setSelectedCategory("");
|
|
17196
16929
|
loadTemplates();
|
|
17197
16930
|
}
|
|
17198
16931
|
}, [isOpen, activeTab]);
|
|
17199
|
-
|
|
16932
|
+
React20.useEffect(() => {
|
|
17200
16933
|
const timer = setTimeout(() => {
|
|
17201
16934
|
if (searchKeyword.trim()) {
|
|
17202
16935
|
searchTemplates();
|
|
@@ -17345,11 +17078,11 @@ var TemplateVariableDialog = ({
|
|
|
17345
17078
|
onSend,
|
|
17346
17079
|
onClose
|
|
17347
17080
|
}) => {
|
|
17348
|
-
const [formValues, setFormValues] =
|
|
17349
|
-
const [formErrors, setFormErrors] =
|
|
17350
|
-
const [isSending, setIsSending] =
|
|
17351
|
-
const [showPreview, setShowPreview] =
|
|
17352
|
-
|
|
17081
|
+
const [formValues, setFormValues] = React20.useState({});
|
|
17082
|
+
const [formErrors, setFormErrors] = React20.useState({});
|
|
17083
|
+
const [isSending, setIsSending] = React20.useState(false);
|
|
17084
|
+
const [showPreview, setShowPreview] = React20.useState(true);
|
|
17085
|
+
React20.useEffect(() => {
|
|
17353
17086
|
if (template && template.variables) {
|
|
17354
17087
|
const initialValues = {};
|
|
17355
17088
|
template.variables.forEach((variable) => {
|
|
@@ -17727,6 +17460,14 @@ var createWebSpeechProvider = (config) => {
|
|
|
17727
17460
|
if (!checkBrowserSupport()) {
|
|
17728
17461
|
throw new Error("Browser does not support speech recognition");
|
|
17729
17462
|
}
|
|
17463
|
+
if (typeof window !== "undefined" && !window.isSecureContext && location.protocol !== "https:") {
|
|
17464
|
+
handleError({
|
|
17465
|
+
code: "INSECURE_CONTEXT",
|
|
17466
|
+
message: "\u8BED\u97F3\u8BC6\u522B\u9700\u8981 HTTPS \u6216 localhost \u73AF\u5883",
|
|
17467
|
+
type: "permission"
|
|
17468
|
+
});
|
|
17469
|
+
return;
|
|
17470
|
+
}
|
|
17730
17471
|
setStatus("requesting");
|
|
17731
17472
|
try {
|
|
17732
17473
|
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
@@ -17742,6 +17483,7 @@ var createWebSpeechProvider = (config) => {
|
|
|
17742
17483
|
}
|
|
17743
17484
|
const SpeechRecognition = getSpeechRecognition();
|
|
17744
17485
|
recognition = new SpeechRecognition();
|
|
17486
|
+
let hasResult = false;
|
|
17745
17487
|
recognition.lang = language;
|
|
17746
17488
|
recognition.continuous = continuous;
|
|
17747
17489
|
recognition.interimResults = interimResults;
|
|
@@ -17771,6 +17513,8 @@ var createWebSpeechProvider = (config) => {
|
|
|
17771
17513
|
const fullText = accumulatedFinalText + interimTranscript;
|
|
17772
17514
|
const hasNewFinal = !!newFinalTranscript;
|
|
17773
17515
|
const confidence = event.results[event.results.length - 1]?.[0]?.confidence || 0;
|
|
17516
|
+
hasResult = true;
|
|
17517
|
+
setStatus("recognizing");
|
|
17774
17518
|
resultCallback?.({
|
|
17775
17519
|
text: fullText,
|
|
17776
17520
|
isFinal: hasNewFinal && !interimTranscript,
|
|
@@ -17830,6 +17574,15 @@ var createWebSpeechProvider = (config) => {
|
|
|
17830
17574
|
};
|
|
17831
17575
|
recognition.onend = () => {
|
|
17832
17576
|
clearTimers();
|
|
17577
|
+
if (!hasResult) {
|
|
17578
|
+
errorCallback?.({
|
|
17579
|
+
code: "NO_SPEECH",
|
|
17580
|
+
message: "\u672A\u68C0\u6D4B\u5230\u6709\u6548\u8BED\u97F3\uFF0C\u8BF7\u91CD\u8BD5",
|
|
17581
|
+
type: "unknown"
|
|
17582
|
+
});
|
|
17583
|
+
setStatus("error");
|
|
17584
|
+
return;
|
|
17585
|
+
}
|
|
17833
17586
|
setStatus("completed");
|
|
17834
17587
|
};
|
|
17835
17588
|
recognition.start();
|
|
@@ -17872,12 +17625,12 @@ var useVoiceRecognition = (config = {}) => {
|
|
|
17872
17625
|
engine = "webspeech",
|
|
17873
17626
|
customProvider
|
|
17874
17627
|
} = config;
|
|
17875
|
-
const [status, setStatus] =
|
|
17876
|
-
const [result, setResult] =
|
|
17877
|
-
const [error, setError] =
|
|
17878
|
-
const [isSupported, setIsSupported] =
|
|
17879
|
-
const providerRef =
|
|
17880
|
-
|
|
17628
|
+
const [status, setStatus] = React20.useState("idle");
|
|
17629
|
+
const [result, setResult] = React20.useState(null);
|
|
17630
|
+
const [error, setError] = React20.useState(null);
|
|
17631
|
+
const [isSupported, setIsSupported] = React20.useState(true);
|
|
17632
|
+
const providerRef = React20.useRef(null);
|
|
17633
|
+
React20.useEffect(() => {
|
|
17881
17634
|
if (engine === "webspeech") {
|
|
17882
17635
|
providerRef.current = createWebSpeechProvider(config);
|
|
17883
17636
|
} else if (engine === "custom" && customProvider) {
|
|
@@ -17901,7 +17654,7 @@ var useVoiceRecognition = (config = {}) => {
|
|
|
17901
17654
|
providerRef.current = null;
|
|
17902
17655
|
};
|
|
17903
17656
|
}, [engine, customProvider, config.language, config.maxDuration, config.autoStopSilence]);
|
|
17904
|
-
const startRecording =
|
|
17657
|
+
const startRecording = React20.useCallback(async () => {
|
|
17905
17658
|
setError(null);
|
|
17906
17659
|
setResult(null);
|
|
17907
17660
|
setStatus("requesting");
|
|
@@ -17916,7 +17669,7 @@ var useVoiceRecognition = (config = {}) => {
|
|
|
17916
17669
|
setStatus("error");
|
|
17917
17670
|
}
|
|
17918
17671
|
}, []);
|
|
17919
|
-
const stopRecording =
|
|
17672
|
+
const stopRecording = React20.useCallback(() => {
|
|
17920
17673
|
providerRef.current?.stop();
|
|
17921
17674
|
}, []);
|
|
17922
17675
|
return {
|
|
@@ -17934,14 +17687,14 @@ var VoiceWaveform = ({
|
|
|
17934
17687
|
className = "",
|
|
17935
17688
|
color: color2 = "#d8ff00"
|
|
17936
17689
|
}) => {
|
|
17937
|
-
const canvasRef =
|
|
17938
|
-
const animationRef =
|
|
17939
|
-
const audioContextRef =
|
|
17940
|
-
const analyserRef =
|
|
17941
|
-
const dataArrayRef =
|
|
17942
|
-
const sourceRef =
|
|
17943
|
-
const streamRef =
|
|
17944
|
-
const draw =
|
|
17690
|
+
const canvasRef = React20.useRef(null);
|
|
17691
|
+
const animationRef = React20.useRef();
|
|
17692
|
+
const audioContextRef = React20.useRef(null);
|
|
17693
|
+
const analyserRef = React20.useRef(null);
|
|
17694
|
+
const dataArrayRef = React20.useRef(null);
|
|
17695
|
+
const sourceRef = React20.useRef(null);
|
|
17696
|
+
const streamRef = React20.useRef(null);
|
|
17697
|
+
const draw = React20.useCallback(() => {
|
|
17945
17698
|
const canvas = canvasRef.current;
|
|
17946
17699
|
const ctx = canvas?.getContext("2d");
|
|
17947
17700
|
const analyser = analyserRef.current;
|
|
@@ -17989,7 +17742,7 @@ var VoiceWaveform = ({
|
|
|
17989
17742
|
}
|
|
17990
17743
|
animationRef.current = requestAnimationFrame(draw);
|
|
17991
17744
|
}, [color2]);
|
|
17992
|
-
|
|
17745
|
+
React20.useEffect(() => {
|
|
17993
17746
|
if (!isRecording) {
|
|
17994
17747
|
if (animationRef.current) {
|
|
17995
17748
|
cancelAnimationFrame(animationRef.current);
|
|
@@ -18061,10 +17814,10 @@ var VoiceInput = ({
|
|
|
18061
17814
|
className = ""
|
|
18062
17815
|
}) => {
|
|
18063
17816
|
const { enabled = true } = config;
|
|
18064
|
-
const resultHandledRef =
|
|
18065
|
-
const lastResultRef =
|
|
18066
|
-
const [isExpanded, setIsExpanded] =
|
|
18067
|
-
const [showResult, setShowResult] =
|
|
17817
|
+
const resultHandledRef = React20.useRef(false);
|
|
17818
|
+
const lastResultRef = React20.useRef(null);
|
|
17819
|
+
const [isExpanded, setIsExpanded] = React20.useState(false);
|
|
17820
|
+
const [showResult, setShowResult] = React20.useState(false);
|
|
18068
17821
|
const {
|
|
18069
17822
|
status,
|
|
18070
17823
|
result,
|
|
@@ -18078,34 +17831,34 @@ var VoiceInput = ({
|
|
|
18078
17831
|
const isRecognizing = status === "recognizing";
|
|
18079
17832
|
const isCompleted = status === "completed";
|
|
18080
17833
|
const hasError = status === "error";
|
|
18081
|
-
const handleStart =
|
|
17834
|
+
const handleStart = React20.useCallback(async () => {
|
|
18082
17835
|
if (!isSupported || disabled) return;
|
|
18083
17836
|
resultHandledRef.current = false;
|
|
18084
17837
|
setIsExpanded(true);
|
|
18085
17838
|
await startRecording();
|
|
18086
17839
|
}, [isSupported, disabled, startRecording]);
|
|
18087
|
-
const handleStop =
|
|
17840
|
+
const handleStop = React20.useCallback(() => {
|
|
18088
17841
|
stopRecording();
|
|
18089
17842
|
}, [stopRecording]);
|
|
18090
|
-
const handleConfirm =
|
|
17843
|
+
const handleConfirm = React20.useCallback((text3) => {
|
|
18091
17844
|
onResult(text3);
|
|
18092
17845
|
setIsExpanded(false);
|
|
18093
17846
|
setShowResult(false);
|
|
18094
17847
|
lastResultRef.current = null;
|
|
18095
17848
|
}, [onResult]);
|
|
18096
|
-
const handleCancel =
|
|
17849
|
+
const handleCancel = React20.useCallback(() => {
|
|
18097
17850
|
stopRecording();
|
|
18098
17851
|
setIsExpanded(false);
|
|
18099
17852
|
setShowResult(false);
|
|
18100
17853
|
resultHandledRef.current = false;
|
|
18101
17854
|
lastResultRef.current = null;
|
|
18102
17855
|
}, [stopRecording]);
|
|
18103
|
-
|
|
17856
|
+
React20.useEffect(() => {
|
|
18104
17857
|
if (result?.text) {
|
|
18105
17858
|
lastResultRef.current = result;
|
|
18106
17859
|
}
|
|
18107
17860
|
}, [result]);
|
|
18108
|
-
|
|
17861
|
+
React20.useEffect(() => {
|
|
18109
17862
|
if (isCompleted && !resultHandledRef.current) {
|
|
18110
17863
|
resultHandledRef.current = true;
|
|
18111
17864
|
const finalText = lastResultRef.current?.text || result?.text;
|
|
@@ -18122,14 +17875,14 @@ var VoiceInput = ({
|
|
|
18122
17875
|
}
|
|
18123
17876
|
}
|
|
18124
17877
|
}, [isCompleted, result, config.autoConfirm, handleConfirm]);
|
|
18125
|
-
|
|
17878
|
+
React20.useEffect(() => {
|
|
18126
17879
|
if (isRecording) {
|
|
18127
17880
|
resultHandledRef.current = false;
|
|
18128
17881
|
lastResultRef.current = null;
|
|
18129
17882
|
setShowResult(false);
|
|
18130
17883
|
}
|
|
18131
17884
|
}, [isRecording]);
|
|
18132
|
-
|
|
17885
|
+
React20.useEffect(() => {
|
|
18133
17886
|
if (error && onError) {
|
|
18134
17887
|
onError(error);
|
|
18135
17888
|
setTimeout(() => {
|
|
@@ -18232,9 +17985,9 @@ var VoiceButton = ({
|
|
|
18232
17985
|
onStart,
|
|
18233
17986
|
onStop
|
|
18234
17987
|
}) => {
|
|
18235
|
-
const buttonRef =
|
|
17988
|
+
const buttonRef = React20.useRef(null);
|
|
18236
17989
|
const isTouchDevice = typeof window !== "undefined" && ("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
18237
|
-
const handleClick =
|
|
17990
|
+
const handleClick = React20.useCallback(() => {
|
|
18238
17991
|
if (disabled) return;
|
|
18239
17992
|
if (isRecording) {
|
|
18240
17993
|
onStop();
|
|
@@ -18242,10 +17995,10 @@ var VoiceButton = ({
|
|
|
18242
17995
|
onStart();
|
|
18243
17996
|
}
|
|
18244
17997
|
}, [disabled, isRecording, onStart, onStop]);
|
|
18245
|
-
const pressTimerRef =
|
|
18246
|
-
const longPressRef =
|
|
17998
|
+
const pressTimerRef = React20.useRef(null);
|
|
17999
|
+
const longPressRef = React20.useRef(false);
|
|
18247
18000
|
const LONG_PRESS_DURATION = 300;
|
|
18248
|
-
const handleTouchStart =
|
|
18001
|
+
const handleTouchStart = React20.useCallback((e) => {
|
|
18249
18002
|
e.preventDefault();
|
|
18250
18003
|
if (disabled) return;
|
|
18251
18004
|
longPressRef.current = false;
|
|
@@ -18254,7 +18007,7 @@ var VoiceButton = ({
|
|
|
18254
18007
|
onStart();
|
|
18255
18008
|
}, LONG_PRESS_DURATION);
|
|
18256
18009
|
}, [disabled, onStart]);
|
|
18257
|
-
const handleTouchEnd =
|
|
18010
|
+
const handleTouchEnd = React20.useCallback((e) => {
|
|
18258
18011
|
e.preventDefault();
|
|
18259
18012
|
if (pressTimerRef.current) {
|
|
18260
18013
|
clearTimeout(pressTimerRef.current);
|
|
@@ -18308,12 +18061,12 @@ var VoiceRecordingModal = ({
|
|
|
18308
18061
|
const isRecognizing = status === "recognizing";
|
|
18309
18062
|
const isCompleted = status === "completed";
|
|
18310
18063
|
const hasError = status === "error";
|
|
18311
|
-
const hasConfirmedRef =
|
|
18312
|
-
const onConfirmRef =
|
|
18313
|
-
|
|
18064
|
+
const hasConfirmedRef = React20.useRef(false);
|
|
18065
|
+
const onConfirmRef = React20.useRef(onConfirm);
|
|
18066
|
+
React20.useEffect(() => {
|
|
18314
18067
|
onConfirmRef.current = onConfirm;
|
|
18315
18068
|
}, [onConfirm]);
|
|
18316
|
-
|
|
18069
|
+
React20.useEffect(() => {
|
|
18317
18070
|
if (isCompleted && result?.isFinal && result.text && !hasConfirmedRef.current) {
|
|
18318
18071
|
hasConfirmedRef.current = true;
|
|
18319
18072
|
const timer = setTimeout(() => {
|
|
@@ -18322,7 +18075,7 @@ var VoiceRecordingModal = ({
|
|
|
18322
18075
|
return () => clearTimeout(timer);
|
|
18323
18076
|
}
|
|
18324
18077
|
}, [isCompleted, result]);
|
|
18325
|
-
|
|
18078
|
+
React20.useEffect(() => {
|
|
18326
18079
|
if (!visible) {
|
|
18327
18080
|
hasConfirmedRef.current = false;
|
|
18328
18081
|
}
|
|
@@ -18453,8 +18206,8 @@ var VoiceInputButton = ({
|
|
|
18453
18206
|
style
|
|
18454
18207
|
}) => {
|
|
18455
18208
|
const { enabled = true } = config;
|
|
18456
|
-
const [modalVisible, setModalVisible] =
|
|
18457
|
-
const [hasPermission, setHasPermission] =
|
|
18209
|
+
const [modalVisible, setModalVisible] = React20.useState(false);
|
|
18210
|
+
const [hasPermission, setHasPermission] = React20.useState(null);
|
|
18458
18211
|
const {
|
|
18459
18212
|
status,
|
|
18460
18213
|
result,
|
|
@@ -18463,7 +18216,7 @@ var VoiceInputButton = ({
|
|
|
18463
18216
|
startRecording,
|
|
18464
18217
|
stopRecording
|
|
18465
18218
|
} = useVoiceRecognition(config);
|
|
18466
|
-
|
|
18219
|
+
React20.useEffect(() => {
|
|
18467
18220
|
if (typeof navigator === "undefined") return;
|
|
18468
18221
|
navigator.permissions?.query({ name: "microphone" }).then((permissionStatus) => {
|
|
18469
18222
|
setHasPermission(permissionStatus.state === "granted");
|
|
@@ -18473,7 +18226,7 @@ var VoiceInputButton = ({
|
|
|
18473
18226
|
}).catch(() => {
|
|
18474
18227
|
});
|
|
18475
18228
|
}, []);
|
|
18476
|
-
const handleOpenModal =
|
|
18229
|
+
const handleOpenModal = React20.useCallback(() => {
|
|
18477
18230
|
if (!isSupported) {
|
|
18478
18231
|
onError?.({
|
|
18479
18232
|
code: "NOT_SUPPORTED",
|
|
@@ -18484,17 +18237,17 @@ var VoiceInputButton = ({
|
|
|
18484
18237
|
}
|
|
18485
18238
|
setModalVisible(true);
|
|
18486
18239
|
}, [isSupported, onError]);
|
|
18487
|
-
const handleCloseModal =
|
|
18240
|
+
const handleCloseModal = React20.useCallback(() => {
|
|
18488
18241
|
if (status === "recording") {
|
|
18489
18242
|
stopRecording();
|
|
18490
18243
|
}
|
|
18491
18244
|
setModalVisible(false);
|
|
18492
18245
|
}, [status, stopRecording]);
|
|
18493
|
-
const handleConfirm =
|
|
18246
|
+
const handleConfirm = React20.useCallback((text3) => {
|
|
18494
18247
|
onResult(text3);
|
|
18495
18248
|
setModalVisible(false);
|
|
18496
18249
|
}, [onResult]);
|
|
18497
|
-
|
|
18250
|
+
React20.useEffect(() => {
|
|
18498
18251
|
if (error && onError) {
|
|
18499
18252
|
onError(error);
|
|
18500
18253
|
}
|
|
@@ -18542,10 +18295,10 @@ function cn2(...inputs) {
|
|
|
18542
18295
|
return twMerge(clsx(inputs));
|
|
18543
18296
|
}
|
|
18544
18297
|
function useResizablePanel(defaultWidth, minWidth, maxWidth, onWidthChange) {
|
|
18545
|
-
const [width, setWidth] =
|
|
18546
|
-
const [isResizing, setIsResizing] =
|
|
18547
|
-
const containerRef =
|
|
18548
|
-
const startResize =
|
|
18298
|
+
const [width, setWidth] = React20.useState(defaultWidth);
|
|
18299
|
+
const [isResizing, setIsResizing] = React20.useState(false);
|
|
18300
|
+
const containerRef = React20.useRef(null);
|
|
18301
|
+
const startResize = React20.useCallback((e) => {
|
|
18549
18302
|
e.preventDefault();
|
|
18550
18303
|
setIsResizing(true);
|
|
18551
18304
|
const startX = e.clientX;
|
|
@@ -18571,7 +18324,7 @@ function useResizablePanel(defaultWidth, minWidth, maxWidth, onWidthChange) {
|
|
|
18571
18324
|
}, [width, minWidth, maxWidth, onWidthChange]);
|
|
18572
18325
|
return { width, isResizing, startResize, containerRef };
|
|
18573
18326
|
}
|
|
18574
|
-
var SidePanel =
|
|
18327
|
+
var SidePanel = React20.memo(function SidePanel2({
|
|
18575
18328
|
isOpen,
|
|
18576
18329
|
onClose,
|
|
18577
18330
|
title,
|
|
@@ -18594,7 +18347,7 @@ var SidePanel = React21.memo(function SidePanel2({
|
|
|
18594
18347
|
minWidth,
|
|
18595
18348
|
maxWidth
|
|
18596
18349
|
);
|
|
18597
|
-
|
|
18350
|
+
React20.useEffect(() => {
|
|
18598
18351
|
const handleKeyDown = (e) => {
|
|
18599
18352
|
if (e.key === "Escape" && isOpen) {
|
|
18600
18353
|
onClose();
|
|
@@ -18603,7 +18356,7 @@ var SidePanel = React21.memo(function SidePanel2({
|
|
|
18603
18356
|
window.addEventListener("keydown", handleKeyDown);
|
|
18604
18357
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
18605
18358
|
}, [isOpen, onClose]);
|
|
18606
|
-
|
|
18359
|
+
React20.useEffect(() => {
|
|
18607
18360
|
if (isOpen) {
|
|
18608
18361
|
const originalOverflow = document.body.style.overflow;
|
|
18609
18362
|
document.body.style.overflow = "hidden";
|
|
@@ -18705,7 +18458,7 @@ var SidePanel = React21.memo(function SidePanel2({
|
|
|
18705
18458
|
isResizing && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "fixed inset-0 z-[60]" })
|
|
18706
18459
|
] });
|
|
18707
18460
|
});
|
|
18708
|
-
var ViewTabs =
|
|
18461
|
+
var ViewTabs = React20.memo(function ViewTabs2({
|
|
18709
18462
|
activeView,
|
|
18710
18463
|
onViewChange,
|
|
18711
18464
|
views
|
|
@@ -18726,7 +18479,7 @@ var ViewTabs = React21.memo(function ViewTabs2({
|
|
|
18726
18479
|
view.id
|
|
18727
18480
|
)) });
|
|
18728
18481
|
});
|
|
18729
|
-
var ToolbarButton =
|
|
18482
|
+
var ToolbarButton = React20.memo(function ToolbarButton2({
|
|
18730
18483
|
onClick,
|
|
18731
18484
|
title,
|
|
18732
18485
|
children,
|
|
@@ -18745,14 +18498,14 @@ var ToolbarButton = React21.memo(function ToolbarButton2({
|
|
|
18745
18498
|
}
|
|
18746
18499
|
);
|
|
18747
18500
|
});
|
|
18748
|
-
var
|
|
18501
|
+
var CodeBlock3 = React20.memo(function CodeBlock4({
|
|
18749
18502
|
code: code3,
|
|
18750
18503
|
language,
|
|
18751
18504
|
showLineNumbers = true
|
|
18752
18505
|
}) {
|
|
18753
18506
|
const lines = code3.split("\n");
|
|
18754
|
-
const [copied, setCopied] =
|
|
18755
|
-
const handleCopy =
|
|
18507
|
+
const [copied, setCopied] = React20.useState(false);
|
|
18508
|
+
const handleCopy = React20.useCallback(async () => {
|
|
18756
18509
|
try {
|
|
18757
18510
|
await navigator.clipboard.writeText(code3);
|
|
18758
18511
|
setCopied(true);
|
|
@@ -18787,14 +18540,14 @@ var CodeBlock5 = React21.memo(function CodeBlock6({
|
|
|
18787
18540
|
] }, i)) }) }) })
|
|
18788
18541
|
] });
|
|
18789
18542
|
});
|
|
18790
|
-
var HtmlPreview3 =
|
|
18791
|
-
const [scale, setScale] =
|
|
18792
|
-
const [deviceMode, setDeviceMode] =
|
|
18793
|
-
const [isLoading, setIsLoading] =
|
|
18794
|
-
const [iframeHeight, setIframeHeight] =
|
|
18795
|
-
const iframeRef =
|
|
18796
|
-
const containerRef =
|
|
18797
|
-
const blobUrl =
|
|
18543
|
+
var HtmlPreview3 = React20.memo(function HtmlPreview4({ content }) {
|
|
18544
|
+
const [scale, setScale] = React20.useState(1);
|
|
18545
|
+
const [deviceMode, setDeviceMode] = React20.useState("responsive");
|
|
18546
|
+
const [isLoading, setIsLoading] = React20.useState(true);
|
|
18547
|
+
const [iframeHeight, setIframeHeight] = React20.useState(600);
|
|
18548
|
+
const iframeRef = React20.useRef(null);
|
|
18549
|
+
const containerRef = React20.useRef(null);
|
|
18550
|
+
const blobUrl = React20.useMemo(() => {
|
|
18798
18551
|
const styleInjection = `
|
|
18799
18552
|
<style>
|
|
18800
18553
|
html, body {
|
|
@@ -18822,7 +18575,7 @@ var HtmlPreview3 = React21.memo(function HtmlPreview4({ content }) {
|
|
|
18822
18575
|
const blob = new Blob([modifiedContent], { type: "text/html" });
|
|
18823
18576
|
return URL.createObjectURL(blob);
|
|
18824
18577
|
}, [content]);
|
|
18825
|
-
|
|
18578
|
+
React20.useEffect(() => {
|
|
18826
18579
|
return () => {
|
|
18827
18580
|
URL.revokeObjectURL(blobUrl);
|
|
18828
18581
|
};
|
|
@@ -18834,7 +18587,7 @@ var HtmlPreview3 = React21.memo(function HtmlPreview4({ content }) {
|
|
|
18834
18587
|
responsive: { width: "100%", height: 600, icon: lucideReact.Maximize2, label: "Responsive" }
|
|
18835
18588
|
};
|
|
18836
18589
|
const currentDevice = deviceConfig[deviceMode];
|
|
18837
|
-
const adjustIframeHeight =
|
|
18590
|
+
const adjustIframeHeight = React20.useCallback(() => {
|
|
18838
18591
|
if (deviceMode === "responsive" && containerRef.current) {
|
|
18839
18592
|
const containerHeight = containerRef.current.clientHeight - 32;
|
|
18840
18593
|
setIframeHeight(Math.max(containerHeight, 400));
|
|
@@ -18842,12 +18595,12 @@ var HtmlPreview3 = React21.memo(function HtmlPreview4({ content }) {
|
|
|
18842
18595
|
setIframeHeight(currentDevice.height);
|
|
18843
18596
|
}
|
|
18844
18597
|
}, [deviceMode, currentDevice.height]);
|
|
18845
|
-
|
|
18598
|
+
React20.useEffect(() => {
|
|
18846
18599
|
adjustIframeHeight();
|
|
18847
18600
|
window.addEventListener("resize", adjustIframeHeight);
|
|
18848
18601
|
return () => window.removeEventListener("resize", adjustIframeHeight);
|
|
18849
18602
|
}, [adjustIframeHeight]);
|
|
18850
|
-
const handleIframeLoad =
|
|
18603
|
+
const handleIframeLoad = React20.useCallback(() => {
|
|
18851
18604
|
setIsLoading(false);
|
|
18852
18605
|
try {
|
|
18853
18606
|
const iframe = iframeRef.current;
|
|
@@ -18868,13 +18621,13 @@ var HtmlPreview3 = React21.memo(function HtmlPreview4({ content }) {
|
|
|
18868
18621
|
} catch {
|
|
18869
18622
|
}
|
|
18870
18623
|
}, [deviceMode]);
|
|
18871
|
-
const handleRefresh =
|
|
18624
|
+
const handleRefresh = React20.useCallback(() => {
|
|
18872
18625
|
setIsLoading(true);
|
|
18873
18626
|
if (iframeRef.current) {
|
|
18874
18627
|
iframeRef.current.src = blobUrl;
|
|
18875
18628
|
}
|
|
18876
18629
|
}, [blobUrl]);
|
|
18877
|
-
const handleDownload =
|
|
18630
|
+
const handleDownload = React20.useCallback(() => {
|
|
18878
18631
|
const link2 = document.createElement("a");
|
|
18879
18632
|
link2.href = blobUrl;
|
|
18880
18633
|
link2.download = `artifact-${Date.now()}.html`;
|
|
@@ -18882,7 +18635,7 @@ var HtmlPreview3 = React21.memo(function HtmlPreview4({ content }) {
|
|
|
18882
18635
|
link2.click();
|
|
18883
18636
|
document.body.removeChild(link2);
|
|
18884
18637
|
}, [blobUrl]);
|
|
18885
|
-
const handleOpenNewTab =
|
|
18638
|
+
const handleOpenNewTab = React20.useCallback(() => {
|
|
18886
18639
|
window.open(blobUrl, "_blank");
|
|
18887
18640
|
}, [blobUrl]);
|
|
18888
18641
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-full flex flex-col bg-zinc-950 agent-sdk-light:bg-white", children: [
|
|
@@ -19003,21 +18756,21 @@ var HtmlPreview3 = React21.memo(function HtmlPreview4({ content }) {
|
|
|
19003
18756
|
)
|
|
19004
18757
|
] });
|
|
19005
18758
|
});
|
|
19006
|
-
var MarkdownPreview =
|
|
18759
|
+
var MarkdownPreview = React20.memo(function MarkdownPreview2({
|
|
19007
18760
|
content,
|
|
19008
18761
|
config
|
|
19009
18762
|
}) {
|
|
19010
18763
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full overflow-auto bg-zinc-950 agent-sdk-light:bg-white", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-3xl mx-auto p-8", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "prose prose-invert prose-zinc agent-sdk-light:prose max-w-none", children: /* @__PURE__ */ jsxRuntime.jsx(MarkdownContent, { content, config }) }) }) });
|
|
19011
18764
|
});
|
|
19012
|
-
|
|
19013
|
-
const parsedData =
|
|
18765
|
+
React20.memo(function JsonPreview2({ content }) {
|
|
18766
|
+
const parsedData = React20.useMemo(() => {
|
|
19014
18767
|
try {
|
|
19015
18768
|
return JSON.parse(content);
|
|
19016
18769
|
} catch {
|
|
19017
18770
|
return null;
|
|
19018
18771
|
}
|
|
19019
18772
|
}, [content]);
|
|
19020
|
-
const formattedJson =
|
|
18773
|
+
const formattedJson = React20.useMemo(() => {
|
|
19021
18774
|
if (parsedData === null) return content;
|
|
19022
18775
|
try {
|
|
19023
18776
|
return JSON.stringify(parsedData, null, 2);
|
|
@@ -19031,7 +18784,7 @@ React21.memo(function JsonPreview2({ content }) {
|
|
|
19031
18784
|
/* @__PURE__ */ jsxRuntime.jsx("pre", { className: "mt-2 text-xs text-zinc-500 agent-sdk-light:text-zinc-600 whitespace-pre-wrap", children: content })
|
|
19032
18785
|
] }) }) });
|
|
19033
18786
|
}
|
|
19034
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18787
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CodeBlock3, { code: formattedJson, language: "json" });
|
|
19035
18788
|
});
|
|
19036
18789
|
var artifactTypeConfig = {
|
|
19037
18790
|
html: {
|
|
@@ -19065,7 +18818,7 @@ var artifactTypeConfig = {
|
|
|
19065
18818
|
bgColor: "bg-zinc-500/10"
|
|
19066
18819
|
}
|
|
19067
18820
|
};
|
|
19068
|
-
var ArtifactViewer =
|
|
18821
|
+
var ArtifactViewer = React20.memo(function ArtifactViewer2({
|
|
19069
18822
|
artifact,
|
|
19070
18823
|
isOpen,
|
|
19071
18824
|
onClose,
|
|
@@ -19075,8 +18828,8 @@ var ArtifactViewer = React21.memo(function ArtifactViewer2({
|
|
|
19075
18828
|
onFullscreenToggle,
|
|
19076
18829
|
embedded = false
|
|
19077
18830
|
}) {
|
|
19078
|
-
const [viewMode, setViewMode] =
|
|
19079
|
-
|
|
18831
|
+
const [viewMode, setViewMode] = React20.useState(defaultView);
|
|
18832
|
+
React20.useEffect(() => {
|
|
19080
18833
|
if (artifact) {
|
|
19081
18834
|
if (artifact.type === "html" || artifact.type === "markdown") {
|
|
19082
18835
|
setViewMode("preview");
|
|
@@ -19091,7 +18844,7 @@ var ArtifactViewer = React21.memo(function ArtifactViewer2({
|
|
|
19091
18844
|
const renderContent = () => {
|
|
19092
18845
|
if (viewMode === "code" || !canPreview) {
|
|
19093
18846
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
19094
|
-
|
|
18847
|
+
CodeBlock3,
|
|
19095
18848
|
{
|
|
19096
18849
|
code: artifact.content,
|
|
19097
18850
|
language: artifact.language || artifact.type
|
|
@@ -19105,7 +18858,7 @@ var ArtifactViewer = React21.memo(function ArtifactViewer2({
|
|
|
19105
18858
|
return /* @__PURE__ */ jsxRuntime.jsx(MarkdownPreview, { content: artifact.content, config });
|
|
19106
18859
|
default:
|
|
19107
18860
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
19108
|
-
|
|
18861
|
+
CodeBlock3,
|
|
19109
18862
|
{
|
|
19110
18863
|
code: artifact.content,
|
|
19111
18864
|
language: artifact.language || artifact.type
|
|
@@ -19226,7 +18979,7 @@ function InformationSupplement({
|
|
|
19226
18979
|
referenceImage,
|
|
19227
18980
|
qrCode
|
|
19228
18981
|
}) {
|
|
19229
|
-
const [open, setOpen] =
|
|
18982
|
+
const [open, setOpen] = React20__namespace.default.useState(!confirmed);
|
|
19230
18983
|
const resolvedMain = main_image || mainImage;
|
|
19231
18984
|
const resolvedRef = reference_image || referenceImage;
|
|
19232
18985
|
const resolvedQr = qrcode || qrCode;
|
|
@@ -19274,8 +19027,8 @@ function InformationSupplement({
|
|
|
19274
19027
|
] });
|
|
19275
19028
|
}
|
|
19276
19029
|
function BriefReview({ content, confirmed }) {
|
|
19277
|
-
const [open, setOpen] =
|
|
19278
|
-
const sanitizedContent =
|
|
19030
|
+
const [open, setOpen] = React20.useState(!confirmed);
|
|
19031
|
+
const sanitizedContent = React20.useMemo(() => sanitizeMarkdownContent(content || ""), [content]);
|
|
19279
19032
|
if (!sanitizedContent) {
|
|
19280
19033
|
return null;
|
|
19281
19034
|
}
|
|
@@ -19307,8 +19060,8 @@ function SessionItem({
|
|
|
19307
19060
|
onReplay,
|
|
19308
19061
|
onShare
|
|
19309
19062
|
}) {
|
|
19310
|
-
const [editing, setEditing] =
|
|
19311
|
-
const [title, setTitle] =
|
|
19063
|
+
const [editing, setEditing] = React20.useState(false);
|
|
19064
|
+
const [title, setTitle] = React20.useState("");
|
|
19312
19065
|
const startEdit = (e) => {
|
|
19313
19066
|
e.stopPropagation();
|
|
19314
19067
|
setTitle(session.title || "\u65B0\u5BF9\u8BDD");
|
|
@@ -19383,7 +19136,7 @@ function Sidebar({
|
|
|
19383
19136
|
collapsed,
|
|
19384
19137
|
onToggle
|
|
19385
19138
|
}) {
|
|
19386
|
-
const [search, setSearch] =
|
|
19139
|
+
const [search, setSearch] = React20.useState("");
|
|
19387
19140
|
const filtered = sessions.filter(
|
|
19388
19141
|
(s) => !search || (s.title || "").toLowerCase().includes(search.toLowerCase())
|
|
19389
19142
|
);
|
|
@@ -19458,7 +19211,7 @@ function Sidebar({
|
|
|
19458
19211
|
] });
|
|
19459
19212
|
}
|
|
19460
19213
|
function WelcomePage({ agentName, welcomeMessage, tools, onNew, onPrompt }) {
|
|
19461
|
-
const quickPrompts =
|
|
19214
|
+
const quickPrompts = React20__namespace.default.useMemo(() => {
|
|
19462
19215
|
const prompts = [];
|
|
19463
19216
|
const hasImageTool = tools?.some(
|
|
19464
19217
|
(t) => t.name?.toLowerCase().includes("image") || t.name?.toLowerCase().includes("\u56FE\u7247") || t.type === "COMFY_APP"
|
|
@@ -19542,8 +19295,8 @@ function ChatInputArea({
|
|
|
19542
19295
|
isStreaming,
|
|
19543
19296
|
config
|
|
19544
19297
|
}) {
|
|
19545
|
-
const textareaRef =
|
|
19546
|
-
const fileInputRef =
|
|
19298
|
+
const textareaRef = React20.useRef(null);
|
|
19299
|
+
const fileInputRef = React20.useRef(null);
|
|
19547
19300
|
const removeImage = (index) => {
|
|
19548
19301
|
setImages((prev) => {
|
|
19549
19302
|
const newImages = [...prev];
|
|
@@ -19745,13 +19498,13 @@ function ChatInputArea({
|
|
|
19745
19498
|
] })
|
|
19746
19499
|
] }) });
|
|
19747
19500
|
}
|
|
19748
|
-
var DragHandle =
|
|
19501
|
+
var DragHandle = React20__namespace.default.memo(function DragHandle2({
|
|
19749
19502
|
artifactPanelWidth,
|
|
19750
19503
|
isDragging,
|
|
19751
19504
|
onMouseDown
|
|
19752
19505
|
}) {
|
|
19753
|
-
const [isHovered, setIsHovered] =
|
|
19754
|
-
|
|
19506
|
+
const [isHovered, setIsHovered] = React20.useState(false);
|
|
19507
|
+
React20.useEffect(() => {
|
|
19755
19508
|
if (isHovered || isDragging) {
|
|
19756
19509
|
document.body.style.cursor = "col-resize";
|
|
19757
19510
|
} else {
|
|
@@ -19785,7 +19538,7 @@ var DragHandle = React21__namespace.default.memo(function DragHandle2({
|
|
|
19785
19538
|
}
|
|
19786
19539
|
);
|
|
19787
19540
|
});
|
|
19788
|
-
var AgentChat =
|
|
19541
|
+
var AgentChat = React20__namespace.default.forwardRef(({
|
|
19789
19542
|
agentId,
|
|
19790
19543
|
projectId,
|
|
19791
19544
|
agentName,
|
|
@@ -19813,7 +19566,7 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
19813
19566
|
const showSidebar = !embedded && !hideSidebar;
|
|
19814
19567
|
const showHeader = !embedded && !hideHeader;
|
|
19815
19568
|
const outerComponents = useComponents();
|
|
19816
|
-
const mergedComponents =
|
|
19569
|
+
const mergedComponents = React20__namespace.default.useMemo(() => {
|
|
19817
19570
|
const configComponents = config?.components || {};
|
|
19818
19571
|
const mergedRegistry = {
|
|
19819
19572
|
InformationSupplement,
|
|
@@ -19828,24 +19581,24 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
19828
19581
|
};
|
|
19829
19582
|
}, [config?.components, outerComponents]);
|
|
19830
19583
|
const { sessions, setSessions, currentSession, setCurrentSession, addSession, removeSession, tools: _tools, setTools, setSkills, setShowItemTime } = useAgentStore();
|
|
19831
|
-
const [loading, setLoading] =
|
|
19832
|
-
const [messagesLoading, setMessagesLoading] =
|
|
19833
|
-
const [collapsed, setCollapsed] =
|
|
19834
|
-
const [mobileOpen, setMobileOpen] =
|
|
19835
|
-
const [input, setInput] =
|
|
19836
|
-
const [images, setImages] =
|
|
19837
|
-
const textareaRef =
|
|
19838
|
-
|
|
19839
|
-
const lastUserMessageRef =
|
|
19840
|
-
const [shareModalOpen, setShareModalOpen] =
|
|
19841
|
-
const [shareSession, setShareSession] =
|
|
19842
|
-
const [currentArtifact, setCurrentArtifact] =
|
|
19843
|
-
const [isArtifactFullscreen, setIsArtifactFullscreen] =
|
|
19844
|
-
const [artifactPanelWidth, setArtifactPanelWidth] =
|
|
19845
|
-
const [isDragging, setIsDragging] =
|
|
19846
|
-
const dragStartRef =
|
|
19847
|
-
const containerRef =
|
|
19848
|
-
const handleDragMouseDown =
|
|
19584
|
+
const [loading, setLoading] = React20.useState(true);
|
|
19585
|
+
const [messagesLoading, setMessagesLoading] = React20.useState(false);
|
|
19586
|
+
const [collapsed, setCollapsed] = React20.useState(false);
|
|
19587
|
+
const [mobileOpen, setMobileOpen] = React20.useState(false);
|
|
19588
|
+
const [input, setInput] = React20.useState("");
|
|
19589
|
+
const [images, setImages] = React20.useState([]);
|
|
19590
|
+
const textareaRef = React20.useRef(null);
|
|
19591
|
+
React20.useRef(null);
|
|
19592
|
+
const lastUserMessageRef = React20.useRef("");
|
|
19593
|
+
const [shareModalOpen, setShareModalOpen] = React20.useState(false);
|
|
19594
|
+
const [shareSession, setShareSession] = React20.useState(null);
|
|
19595
|
+
const [currentArtifact, setCurrentArtifact] = React20.useState(null);
|
|
19596
|
+
const [isArtifactFullscreen, setIsArtifactFullscreen] = React20.useState(false);
|
|
19597
|
+
const [artifactPanelWidth, setArtifactPanelWidth] = React20.useState(50);
|
|
19598
|
+
const [isDragging, setIsDragging] = React20.useState(false);
|
|
19599
|
+
const dragStartRef = React20.useRef(null);
|
|
19600
|
+
const containerRef = React20.useRef(null);
|
|
19601
|
+
const handleDragMouseDown = React20.useCallback((e) => {
|
|
19849
19602
|
e.preventDefault();
|
|
19850
19603
|
e.stopPropagation();
|
|
19851
19604
|
dragStartRef.current = {
|
|
@@ -19856,7 +19609,7 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
19856
19609
|
document.body.style.cursor = "col-resize";
|
|
19857
19610
|
document.body.style.userSelect = "none";
|
|
19858
19611
|
}, [artifactPanelWidth]);
|
|
19859
|
-
|
|
19612
|
+
React20.useEffect(() => {
|
|
19860
19613
|
if (!isDragging) return;
|
|
19861
19614
|
const handleMouseMove = (e) => {
|
|
19862
19615
|
if (!dragStartRef.current || !containerRef.current) return;
|
|
@@ -19883,10 +19636,10 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
19883
19636
|
document.body.style.userSelect = "";
|
|
19884
19637
|
};
|
|
19885
19638
|
}, [isDragging]);
|
|
19886
|
-
|
|
19639
|
+
React20.useEffect(() => {
|
|
19887
19640
|
setShowItemTime(showItemTime);
|
|
19888
19641
|
}, [showItemTime]);
|
|
19889
|
-
const handleOpenArtifact =
|
|
19642
|
+
const handleOpenArtifact = React20.useCallback((data) => {
|
|
19890
19643
|
if (currentArtifact && currentArtifact.content === data.content && currentArtifact.type === data.type) {
|
|
19891
19644
|
setCurrentArtifact(null);
|
|
19892
19645
|
setIsArtifactFullscreen(false);
|
|
@@ -19902,11 +19655,11 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
19902
19655
|
};
|
|
19903
19656
|
setCurrentArtifact(artifact);
|
|
19904
19657
|
}, [currentArtifact]);
|
|
19905
|
-
const handleCloseArtifact =
|
|
19658
|
+
const handleCloseArtifact = React20.useCallback(() => {
|
|
19906
19659
|
setCurrentArtifact(null);
|
|
19907
19660
|
setIsArtifactFullscreen(false);
|
|
19908
19661
|
}, []);
|
|
19909
|
-
|
|
19662
|
+
React20.useEffect(() => {
|
|
19910
19663
|
const handleKeyDown = (e) => {
|
|
19911
19664
|
if (e.key === "Escape" && currentArtifact) {
|
|
19912
19665
|
if (isArtifactFullscreen) {
|
|
@@ -19919,7 +19672,7 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
19919
19672
|
document.addEventListener("keydown", handleKeyDown);
|
|
19920
19673
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
19921
19674
|
}, [currentArtifact, isArtifactFullscreen]);
|
|
19922
|
-
const handleToggleArtifactFullscreen =
|
|
19675
|
+
const handleToggleArtifactFullscreen = React20.useCallback(() => {
|
|
19923
19676
|
setIsArtifactFullscreen((prev) => !prev);
|
|
19924
19677
|
}, []);
|
|
19925
19678
|
const { sendMessage, reconnect, abort } = useSSE({
|
|
@@ -19954,8 +19707,8 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
19954
19707
|
const setShowPlanConfirmDialog = useAgentStore((state) => state.setShowPlanConfirmDialog);
|
|
19955
19708
|
const setShowHumanInputDialog = useAgentStore((state) => state.setShowHumanInputDialog);
|
|
19956
19709
|
const clearPlanState = useAgentStore((state) => state.clearPlanState);
|
|
19957
|
-
const [planProcessing, setPlanProcessing] =
|
|
19958
|
-
|
|
19710
|
+
const [planProcessing, setPlanProcessing] = React20.useState(false);
|
|
19711
|
+
React20.useEffect(() => {
|
|
19959
19712
|
if (initialSessionId) {
|
|
19960
19713
|
console.log("sessions: ", sessions, initialSessionId);
|
|
19961
19714
|
const session = sessions.find((s) => s.sessionId === initialSessionId);
|
|
@@ -19965,7 +19718,7 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
19965
19718
|
}
|
|
19966
19719
|
}
|
|
19967
19720
|
}, [initialSessionId, setCurrentSession, sessions]);
|
|
19968
|
-
const handlePlanConfirm =
|
|
19721
|
+
const handlePlanConfirm = React20.useCallback(async () => {
|
|
19969
19722
|
if (!currentPlan?.publicId) return;
|
|
19970
19723
|
setPlanProcessing(true);
|
|
19971
19724
|
try {
|
|
@@ -19978,7 +19731,7 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
19978
19731
|
setPlanProcessing(false);
|
|
19979
19732
|
}
|
|
19980
19733
|
}, [currentPlan, setShowPlanConfirmDialog]);
|
|
19981
|
-
const handlePlanReject =
|
|
19734
|
+
const handlePlanReject = React20.useCallback(async () => {
|
|
19982
19735
|
if (!currentPlan?.publicId) return;
|
|
19983
19736
|
setPlanProcessing(true);
|
|
19984
19737
|
try {
|
|
@@ -19992,7 +19745,7 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
19992
19745
|
setPlanProcessing(false);
|
|
19993
19746
|
}
|
|
19994
19747
|
}, [currentPlan, clearPlanState]);
|
|
19995
|
-
const handlePlanPause =
|
|
19748
|
+
const handlePlanPause = React20.useCallback(async () => {
|
|
19996
19749
|
if (!currentPlan?.publicId) return;
|
|
19997
19750
|
try {
|
|
19998
19751
|
await planService.pause(currentPlan.publicId);
|
|
@@ -20001,7 +19754,7 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
20001
19754
|
toast.error("\u6682\u505C\u8BA1\u5212\u5931\u8D25");
|
|
20002
19755
|
}
|
|
20003
19756
|
}, [currentPlan]);
|
|
20004
|
-
const handlePlanResume =
|
|
19757
|
+
const handlePlanResume = React20.useCallback(async () => {
|
|
20005
19758
|
if (!currentPlan?.publicId) return;
|
|
20006
19759
|
try {
|
|
20007
19760
|
await planService.resume(currentPlan.publicId);
|
|
@@ -20010,7 +19763,7 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
20010
19763
|
toast.error("\u6062\u590D\u8BA1\u5212\u5931\u8D25");
|
|
20011
19764
|
}
|
|
20012
19765
|
}, [currentPlan]);
|
|
20013
|
-
const handlePlanCancel =
|
|
19766
|
+
const handlePlanCancel = React20.useCallback(async () => {
|
|
20014
19767
|
if (!currentPlan?.publicId) return;
|
|
20015
19768
|
try {
|
|
20016
19769
|
await planService.cancel(currentPlan.publicId);
|
|
@@ -20020,7 +19773,7 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
20020
19773
|
toast.error("\u53D6\u6D88\u8BA1\u5212\u5931\u8D25");
|
|
20021
19774
|
}
|
|
20022
19775
|
}, [currentPlan, clearPlanState]);
|
|
20023
|
-
const handlePlanRetry =
|
|
19776
|
+
const handlePlanRetry = React20.useCallback(async () => {
|
|
20024
19777
|
if (!currentPlan?.publicId) return;
|
|
20025
19778
|
setPlanProcessing(true);
|
|
20026
19779
|
try {
|
|
@@ -20033,7 +19786,7 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
20033
19786
|
setPlanProcessing(false);
|
|
20034
19787
|
}
|
|
20035
19788
|
}, [currentPlan]);
|
|
20036
|
-
const handlePlanSkip =
|
|
19789
|
+
const handlePlanSkip = React20.useCallback(async () => {
|
|
20037
19790
|
if (!currentPlan?.publicId) return;
|
|
20038
19791
|
setPlanProcessing(true);
|
|
20039
19792
|
try {
|
|
@@ -20046,7 +19799,7 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
20046
19799
|
setPlanProcessing(false);
|
|
20047
19800
|
}
|
|
20048
19801
|
}, [currentPlan]);
|
|
20049
|
-
const handleHumanInputSubmit =
|
|
19802
|
+
const handleHumanInputSubmit = React20.useCallback(async (stepId, input2) => {
|
|
20050
19803
|
if (!stepId || !currentPlan?.publicId) return;
|
|
20051
19804
|
try {
|
|
20052
19805
|
await planService.provideHumanInput(currentPlan.publicId, stepId, { input: input2 });
|
|
@@ -20056,10 +19809,10 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
20056
19809
|
toast.error("\u63D0\u4EA4\u8F93\u5165\u5931\u8D25");
|
|
20057
19810
|
}
|
|
20058
19811
|
}, [currentPlan, setShowHumanInputDialog]);
|
|
20059
|
-
|
|
19812
|
+
React20.useCallback(() => {
|
|
20060
19813
|
setShowHumanInputDialog(false);
|
|
20061
19814
|
}, [setShowHumanInputDialog]);
|
|
20062
|
-
|
|
19815
|
+
React20.useEffect(() => {
|
|
20063
19816
|
sessionService.list({ projectId, agentId, pageSize: 100 }).then(async (res) => {
|
|
20064
19817
|
if (res.success && res.data) {
|
|
20065
19818
|
const list2 = res.data.list.map((s) => ({ ...s, sessionId: s.publicId || s.session_id || s.id }));
|
|
@@ -20114,7 +19867,7 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
20114
19867
|
}
|
|
20115
19868
|
}
|
|
20116
19869
|
};
|
|
20117
|
-
const handleNew =
|
|
19870
|
+
const handleNew = React20.useCallback(async () => {
|
|
20118
19871
|
const s = await createAndStartSession(projectId, agentId, "\u65B0\u5BF9\u8BDD");
|
|
20119
19872
|
if (s?.sessionId) {
|
|
20120
19873
|
addSession(s);
|
|
@@ -20122,12 +19875,12 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
20122
19875
|
useAgentStore.getState().setMessages([]);
|
|
20123
19876
|
}
|
|
20124
19877
|
}, [projectId, agentId]);
|
|
20125
|
-
const handlePrompt =
|
|
19878
|
+
const handlePrompt = React20.useCallback(async (p) => {
|
|
20126
19879
|
await handleNew();
|
|
20127
19880
|
setInput(p);
|
|
20128
19881
|
setTimeout(() => textareaRef.current?.focus(), 100);
|
|
20129
19882
|
}, [handleNew]);
|
|
20130
|
-
const handleSelect =
|
|
19883
|
+
const handleSelect = React20.useCallback(async (s) => {
|
|
20131
19884
|
setCurrentSession(s);
|
|
20132
19885
|
onSessionIdChange?.(s.sessionId);
|
|
20133
19886
|
setMobileOpen(false);
|
|
@@ -20136,7 +19889,7 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
20136
19889
|
await loadMessages(s.sessionId);
|
|
20137
19890
|
setMessagesLoading(false);
|
|
20138
19891
|
}, []);
|
|
20139
|
-
const handleDelete2 =
|
|
19892
|
+
const handleDelete2 = React20.useCallback(async (id) => {
|
|
20140
19893
|
toast("\u5220\u9664\u6B64\u5BF9\u8BDD\uFF1F", {
|
|
20141
19894
|
action: {
|
|
20142
19895
|
label: "\u786E\u8BA4\u5220\u9664",
|
|
@@ -20161,11 +19914,11 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
20161
19914
|
}
|
|
20162
19915
|
});
|
|
20163
19916
|
}, [currentSession, sessions, removeSession]);
|
|
20164
|
-
const handleRename =
|
|
19917
|
+
const handleRename = React20.useCallback(async (id, title) => {
|
|
20165
19918
|
const res = await sessionService.updateTitle(id, title);
|
|
20166
19919
|
if (res.success) useAgentStore.getState().updateSession(id, { title });
|
|
20167
19920
|
}, []);
|
|
20168
|
-
const handleDeleteMessage =
|
|
19921
|
+
const handleDeleteMessage = React20.useCallback(async (messageId) => {
|
|
20169
19922
|
try {
|
|
20170
19923
|
const res = await messageService.delete(messageId);
|
|
20171
19924
|
if (res.success) {
|
|
@@ -20182,7 +19935,7 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
20182
19935
|
return false;
|
|
20183
19936
|
}
|
|
20184
19937
|
}, []);
|
|
20185
|
-
const handleSend =
|
|
19938
|
+
const handleSend = React20.useCallback(async () => {
|
|
20186
19939
|
if (!input.trim() && images.length === 0) return;
|
|
20187
19940
|
if (!currentSession) return;
|
|
20188
19941
|
let messageContent = input.trim();
|
|
@@ -20233,20 +19986,20 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
20233
19986
|
setImages([]);
|
|
20234
19987
|
await sendMessage(currentSession.sessionId, messageContent);
|
|
20235
19988
|
}, [input, images, currentSession, sendMessage, config]);
|
|
20236
|
-
const sendTextMessage =
|
|
19989
|
+
const sendTextMessage = React20.useCallback(async (content) => {
|
|
20237
19990
|
if (!content.trim()) return;
|
|
20238
19991
|
if (!currentSession) return;
|
|
20239
19992
|
lastUserMessageRef.current = content.trim();
|
|
20240
19993
|
await sendMessage(currentSession.sessionId, content.trim());
|
|
20241
19994
|
}, [currentSession, sendMessage]);
|
|
20242
|
-
const abortStreaming =
|
|
19995
|
+
const abortStreaming = React20.useCallback(async () => {
|
|
20243
19996
|
await abort();
|
|
20244
19997
|
}, [abort]);
|
|
20245
|
-
|
|
19998
|
+
React20.useImperativeHandle(ref, () => ({
|
|
20246
19999
|
sendTextMessage,
|
|
20247
20000
|
abortStreaming
|
|
20248
20001
|
}), [sendTextMessage, abortStreaming]);
|
|
20249
|
-
const handleAbortMessage =
|
|
20002
|
+
const handleAbortMessage = React20.useCallback(async (messageId) => {
|
|
20250
20003
|
const { messages, updateMessage } = useAgentStore.getState();
|
|
20251
20004
|
const target = messages.find((m) => m.messageId === messageId);
|
|
20252
20005
|
const backendId = target?.metadata?.backendId || target?.messageId || messageId;
|
|
@@ -20263,7 +20016,7 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
20263
20016
|
console.error("[AgentChat] Cancel message failed:", err);
|
|
20264
20017
|
}
|
|
20265
20018
|
}, [abort]);
|
|
20266
|
-
|
|
20019
|
+
React20.useCallback(async (assets) => {
|
|
20267
20020
|
const previews = await Promise.all(
|
|
20268
20021
|
assets.map(async (asset) => {
|
|
20269
20022
|
if (asset.file instanceof File) {
|
|
@@ -20286,7 +20039,7 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
20286
20039
|
setImages((prev) => [...prev, ...validPreviews]);
|
|
20287
20040
|
}
|
|
20288
20041
|
}, [config]);
|
|
20289
|
-
const handleStop =
|
|
20042
|
+
const handleStop = React20.useCallback(() => {
|
|
20290
20043
|
const streamingMsg = useAgentStore.getState().messages.find((m) => m.status === "streaming");
|
|
20291
20044
|
if (streamingMsg) {
|
|
20292
20045
|
handleAbortMessage(streamingMsg.messageId);
|
|
@@ -20295,7 +20048,7 @@ var AgentChat = React21__namespace.default.forwardRef(({
|
|
|
20295
20048
|
}
|
|
20296
20049
|
}, [handleAbortMessage, abort]);
|
|
20297
20050
|
if (loading) {
|
|
20298
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `agent-sdk-theme h-screen flex items-center justify-center bg-black ${themeClass} ${className || ""}`, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
20051
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `agent-sdk-theme h-screen flex items-center justify-center bg-black ${themeClass} ${className || ""}`, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-b-2 border-[#d8ff00]" }) });
|
|
20299
20052
|
}
|
|
20300
20053
|
return /* @__PURE__ */ jsxRuntime.jsx(ComponentProvider, { components: mergedComponents, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20301
20054
|
"div",
|
|
@@ -20489,26 +20242,26 @@ var SPEED_OPTIONS = [
|
|
|
20489
20242
|
{ value: 20, label: "20x" }
|
|
20490
20243
|
];
|
|
20491
20244
|
function ShareReplayPage({ shareId, onNavigateBack }) {
|
|
20492
|
-
const [pageState, setPageState] =
|
|
20493
|
-
const [error, setError] =
|
|
20494
|
-
const [password, setPassword] =
|
|
20495
|
-
const [verifying, setVerifying] =
|
|
20496
|
-
const [shareToken, setShareToken] =
|
|
20497
|
-
const [sharedData, setSharedData] =
|
|
20498
|
-
const [allMessages, setAllMessages] =
|
|
20499
|
-
const [playState, setPlayState] =
|
|
20500
|
-
const [currentIndex, setCurrentIndex] =
|
|
20501
|
-
const [displayedMessages, setDisplayedMessages] =
|
|
20502
|
-
const [speed, setSpeed] =
|
|
20503
|
-
const [isTyping, setIsTyping] =
|
|
20504
|
-
const [typingContent, setTypingContent] =
|
|
20505
|
-
const timerRef =
|
|
20506
|
-
const messagesEndRef =
|
|
20507
|
-
const playStateRef =
|
|
20508
|
-
const currentIndexRef =
|
|
20509
|
-
const isTypingRef =
|
|
20510
|
-
const typingStartTimeRef =
|
|
20511
|
-
const typingMessage =
|
|
20245
|
+
const [pageState, setPageState] = React20.useState("loading");
|
|
20246
|
+
const [error, setError] = React20.useState(null);
|
|
20247
|
+
const [password, setPassword] = React20.useState("");
|
|
20248
|
+
const [verifying, setVerifying] = React20.useState(false);
|
|
20249
|
+
const [shareToken, setShareToken] = React20.useState(null);
|
|
20250
|
+
const [sharedData, setSharedData] = React20.useState(null);
|
|
20251
|
+
const [allMessages, setAllMessages] = React20.useState([]);
|
|
20252
|
+
const [playState, setPlayState] = React20.useState("idle");
|
|
20253
|
+
const [currentIndex, setCurrentIndex] = React20.useState(0);
|
|
20254
|
+
const [displayedMessages, setDisplayedMessages] = React20.useState([]);
|
|
20255
|
+
const [speed, setSpeed] = React20.useState(2);
|
|
20256
|
+
const [isTyping, setIsTyping] = React20.useState(false);
|
|
20257
|
+
const [typingContent, setTypingContent] = React20.useState("");
|
|
20258
|
+
const timerRef = React20.useRef(null);
|
|
20259
|
+
const messagesEndRef = React20.useRef(null);
|
|
20260
|
+
const playStateRef = React20.useRef("idle");
|
|
20261
|
+
const currentIndexRef = React20.useRef(0);
|
|
20262
|
+
const isTypingRef = React20.useRef(false);
|
|
20263
|
+
const typingStartTimeRef = React20.useRef("");
|
|
20264
|
+
const typingMessage = React20.useMemo(() => {
|
|
20512
20265
|
const sessionIdValue = sharedData?.session?.sessionId || shareId;
|
|
20513
20266
|
if (!sessionIdValue) return null;
|
|
20514
20267
|
return {
|
|
@@ -20521,7 +20274,7 @@ function ShareReplayPage({ shareId, onNavigateBack }) {
|
|
|
20521
20274
|
};
|
|
20522
20275
|
}, [sharedData?.session?.sessionId, shareId]);
|
|
20523
20276
|
const getTokenStorageKey = (id) => `share_token_${id}`;
|
|
20524
|
-
|
|
20277
|
+
React20.useEffect(() => {
|
|
20525
20278
|
async function checkShare() {
|
|
20526
20279
|
if (!shareId) {
|
|
20527
20280
|
setError("\u5206\u4EAB ID \u65E0\u6548");
|
|
@@ -20588,29 +20341,29 @@ function ShareReplayPage({ shareId, onNavigateBack }) {
|
|
|
20588
20341
|
setVerifying(false);
|
|
20589
20342
|
}
|
|
20590
20343
|
};
|
|
20591
|
-
const scrollToBottom =
|
|
20344
|
+
const scrollToBottom = React20.useCallback(() => {
|
|
20592
20345
|
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
20593
20346
|
}, []);
|
|
20594
|
-
|
|
20347
|
+
React20.useEffect(() => {
|
|
20595
20348
|
scrollToBottom();
|
|
20596
20349
|
}, [displayedMessages, typingContent, scrollToBottom]);
|
|
20597
|
-
|
|
20350
|
+
React20.useEffect(() => {
|
|
20598
20351
|
return () => {
|
|
20599
20352
|
if (timerRef.current) {
|
|
20600
20353
|
clearTimeout(timerRef.current);
|
|
20601
20354
|
}
|
|
20602
20355
|
};
|
|
20603
20356
|
}, []);
|
|
20604
|
-
|
|
20357
|
+
React20.useEffect(() => {
|
|
20605
20358
|
playStateRef.current = playState;
|
|
20606
20359
|
}, [playState]);
|
|
20607
|
-
|
|
20360
|
+
React20.useEffect(() => {
|
|
20608
20361
|
currentIndexRef.current = currentIndex;
|
|
20609
20362
|
}, [currentIndex]);
|
|
20610
|
-
|
|
20363
|
+
React20.useEffect(() => {
|
|
20611
20364
|
isTypingRef.current = isTyping;
|
|
20612
20365
|
}, [isTyping]);
|
|
20613
|
-
const scheduleNext =
|
|
20366
|
+
const scheduleNext = React20.useCallback(() => {
|
|
20614
20367
|
if (playStateRef.current !== "playing") return;
|
|
20615
20368
|
const idx = currentIndexRef.current;
|
|
20616
20369
|
if (idx >= allMessages.length) {
|
|
@@ -20660,7 +20413,7 @@ function ShareReplayPage({ shareId, onNavigateBack }) {
|
|
|
20660
20413
|
};
|
|
20661
20414
|
typeChar();
|
|
20662
20415
|
}, [allMessages, speed]);
|
|
20663
|
-
const handlePlay =
|
|
20416
|
+
const handlePlay = React20.useCallback(() => {
|
|
20664
20417
|
if (timerRef.current) {
|
|
20665
20418
|
clearTimeout(timerRef.current);
|
|
20666
20419
|
}
|
|
@@ -20690,14 +20443,14 @@ function ShareReplayPage({ shareId, onNavigateBack }) {
|
|
|
20690
20443
|
scheduleNext();
|
|
20691
20444
|
}, 100);
|
|
20692
20445
|
}, [playState, allMessages, scheduleNext]);
|
|
20693
|
-
const handlePause =
|
|
20446
|
+
const handlePause = React20.useCallback(() => {
|
|
20694
20447
|
if (timerRef.current) {
|
|
20695
20448
|
clearTimeout(timerRef.current);
|
|
20696
20449
|
}
|
|
20697
20450
|
setPlayState("paused");
|
|
20698
20451
|
playStateRef.current = "paused";
|
|
20699
20452
|
}, []);
|
|
20700
|
-
const handleReset =
|
|
20453
|
+
const handleReset = React20.useCallback(() => {
|
|
20701
20454
|
if (timerRef.current) {
|
|
20702
20455
|
clearTimeout(timerRef.current);
|
|
20703
20456
|
}
|
|
@@ -20710,7 +20463,7 @@ function ShareReplayPage({ shareId, onNavigateBack }) {
|
|
|
20710
20463
|
isTypingRef.current = false;
|
|
20711
20464
|
setTypingContent("");
|
|
20712
20465
|
}, []);
|
|
20713
|
-
const handleSkip =
|
|
20466
|
+
const handleSkip = React20.useCallback(() => {
|
|
20714
20467
|
if (timerRef.current) {
|
|
20715
20468
|
clearTimeout(timerRef.current);
|
|
20716
20469
|
}
|
|
@@ -20728,12 +20481,12 @@ function ShareReplayPage({ shareId, onNavigateBack }) {
|
|
|
20728
20481
|
}
|
|
20729
20482
|
}
|
|
20730
20483
|
}, [allMessages, scheduleNext]);
|
|
20731
|
-
const handleShare =
|
|
20484
|
+
const handleShare = React20.useCallback(() => {
|
|
20732
20485
|
const url = window.location.href;
|
|
20733
20486
|
navigator.clipboard.writeText(url);
|
|
20734
20487
|
toast.success("\u94FE\u63A5\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F");
|
|
20735
20488
|
}, []);
|
|
20736
|
-
const handleShowAll =
|
|
20489
|
+
const handleShowAll = React20.useCallback(() => {
|
|
20737
20490
|
if (timerRef.current) {
|
|
20738
20491
|
clearTimeout(timerRef.current);
|
|
20739
20492
|
}
|