@blade-hq/agent-kit 1.0.14 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{SkillStatusBar-cYkuNAmR.d.ts → SkillStatusBar-DskumalP.d.ts} +19 -7
- package/dist/{blade-client-CGhtHnQN.d.ts → blade-client-KZiBuBHI.d.ts} +4 -1
- package/dist/{chunk-4K25SSZ4.js → chunk-J3PQU7BQ.js} +3 -3
- package/dist/{chunk-DXDLZXDP.js → chunk-JHUSL3JZ.js} +720 -626
- package/dist/chunk-JHUSL3JZ.js.map +1 -0
- package/dist/{chunk-CVCQSRVP.js → chunk-OMIVYL5D.js} +4 -4
- package/dist/chunk-OMIVYL5D.js.map +1 -0
- package/dist/{chunk-3UY7SD3P.js → chunk-QEYZZDLM.js} +1091 -11
- package/dist/chunk-QEYZZDLM.js.map +1 -0
- package/dist/{chunk-CM3H6ZNV.js → chunk-U4KVB5OB.js} +2 -2
- package/dist/{chunk-DN4CKDDQ.js → chunk-V74REX3Q.js} +2 -1
- package/dist/chunk-V74REX3Q.js.map +1 -0
- package/dist/client/index.d.ts +445 -2
- package/dist/client/index.js +1 -1
- package/dist/react/api/vibe-coding.d.ts +3 -3
- package/dist/react/api/vibe-coding.js +2 -2
- package/dist/react/components/chat/index.d.ts +4 -4
- package/dist/react/components/chat/index.js +7 -5
- package/dist/react/components/plan/index.js +4 -4
- package/dist/react/components/session/index.d.ts +1 -1
- package/dist/react/components/session/index.js +3 -3
- package/dist/react/components/workspace/index.d.ts +3 -3
- package/dist/react/components/workspace/index.js +3 -3
- package/dist/react/index.d.ts +22 -11
- package/dist/react/index.js +11 -6
- package/dist/react/index.js.map +1 -1
- package/dist/{session-o8bAQoXK.d.ts → session-CT8Y2KHr.d.ts} +2 -0
- package/dist/{sessions-BDau9Lk7.d.ts → sessions-BX8qHBN3.d.ts} +2 -2
- package/package.json +1 -1
- package/dist/chunk-3UY7SD3P.js.map +0 -1
- package/dist/chunk-CVCQSRVP.js.map +0 -1
- package/dist/chunk-DN4CKDDQ.js.map +0 -1
- package/dist/chunk-DXDLZXDP.js.map +0 -1
- /package/dist/{chunk-4K25SSZ4.js.map → chunk-J3PQU7BQ.js.map} +0 -0
- /package/dist/{chunk-CM3H6ZNV.js.map → chunk-U4KVB5OB.js.map} +0 -0
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
getCodeLanguageFromFilename,
|
|
9
9
|
parseAskUserQuestion,
|
|
10
10
|
useHighlightedCodeHtml
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-J3PQU7BQ.js";
|
|
12
12
|
import {
|
|
13
13
|
Collapsible,
|
|
14
14
|
CollapsibleContent,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from "./chunk-H62LH2AG.js";
|
|
17
17
|
import {
|
|
18
18
|
resolveSessionFilePreviewTarget
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-U4KVB5OB.js";
|
|
20
20
|
import {
|
|
21
21
|
apiFetchResponse,
|
|
22
22
|
buildMessageContent,
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
useUiBridgeStore,
|
|
61
61
|
useUiStore,
|
|
62
62
|
writeFile
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-QEYZZDLM.js";
|
|
64
64
|
import {
|
|
65
65
|
registerBridgeIframe,
|
|
66
66
|
tapBridgeEvent
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
ModelOption,
|
|
70
70
|
ModelsConfig,
|
|
71
71
|
ModelsResource
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-V74REX3Q.js";
|
|
73
73
|
import {
|
|
74
74
|
cn,
|
|
75
75
|
copyToClipboard
|
|
@@ -688,8 +688,10 @@ var upgradeComputer = (...args) => r2().upgradeComputer(...args);
|
|
|
688
688
|
|
|
689
689
|
// src/react/hooks/use-model-preferences.ts
|
|
690
690
|
var PREFERRED_MODEL_KEY = "preferred_model";
|
|
691
|
+
var THINKING_ENABLED_KEY = "llm.enable_thinking";
|
|
691
692
|
var MODEL_CONFIG_QUERY_KEY = ["model-config"];
|
|
692
693
|
var PREFERRED_MODEL_QUERY_KEY = ["user-preference", PREFERRED_MODEL_KEY];
|
|
694
|
+
var THINKING_ENABLED_QUERY_KEY = ["user-preference", THINKING_ENABLED_KEY];
|
|
693
695
|
function useModelConfig() {
|
|
694
696
|
const { data, isLoading } = useQuery({
|
|
695
697
|
queryKey: MODEL_CONFIG_QUERY_KEY,
|
|
@@ -732,6 +734,36 @@ function usePreferredModel() {
|
|
|
732
734
|
setPreferredModel: (modelId) => mutation.mutate(modelId)
|
|
733
735
|
};
|
|
734
736
|
}
|
|
737
|
+
function useThinkingPreference() {
|
|
738
|
+
const queryClient = useQueryClient();
|
|
739
|
+
const { data, isLoading } = useQuery({
|
|
740
|
+
queryKey: THINKING_ENABLED_QUERY_KEY,
|
|
741
|
+
queryFn: () => getUserPreference(THINKING_ENABLED_KEY),
|
|
742
|
+
staleTime: Number.POSITIVE_INFINITY
|
|
743
|
+
});
|
|
744
|
+
const mutation = useMutation({
|
|
745
|
+
mutationFn: (enabled) => setUserPreference(THINKING_ENABLED_KEY, enabled ? "true" : "false"),
|
|
746
|
+
onMutate: async (enabled) => {
|
|
747
|
+
await queryClient.cancelQueries({ queryKey: THINKING_ENABLED_QUERY_KEY });
|
|
748
|
+
const previous = queryClient.getQueryData(THINKING_ENABLED_QUERY_KEY);
|
|
749
|
+
queryClient.setQueryData(THINKING_ENABLED_QUERY_KEY, enabled ? "true" : "false");
|
|
750
|
+
return { previous };
|
|
751
|
+
},
|
|
752
|
+
onError: (_error, _enabled, context) => {
|
|
753
|
+
queryClient.setQueryData(THINKING_ENABLED_QUERY_KEY, context?.previous ?? null);
|
|
754
|
+
},
|
|
755
|
+
onSettled: () => {
|
|
756
|
+
void queryClient.invalidateQueries({ queryKey: THINKING_ENABLED_QUERY_KEY });
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
return {
|
|
760
|
+
thinkingEnabled: data !== "false",
|
|
761
|
+
thinkingPreference: data === "true" ? true : data === "false" ? false : null,
|
|
762
|
+
preferenceLoaded: data !== void 0,
|
|
763
|
+
setThinkingEnabled: (enabled) => mutation.mutate(enabled),
|
|
764
|
+
isLoading
|
|
765
|
+
};
|
|
766
|
+
}
|
|
735
767
|
|
|
736
768
|
// src/react/components/model/ModelSelector.tsx
|
|
737
769
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
@@ -2064,8 +2096,43 @@ var SkillMention = Mention2.extend({
|
|
|
2064
2096
|
}
|
|
2065
2097
|
});
|
|
2066
2098
|
|
|
2099
|
+
// src/react/components/chat/ThinkingToggle.tsx
|
|
2100
|
+
import { Brain } from "lucide-react";
|
|
2101
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2102
|
+
function ThinkingToggle({ enabled, onChange, disabled }) {
|
|
2103
|
+
return /* @__PURE__ */ jsxs8(
|
|
2104
|
+
"button",
|
|
2105
|
+
{
|
|
2106
|
+
type: "button",
|
|
2107
|
+
role: "switch",
|
|
2108
|
+
"aria-checked": enabled,
|
|
2109
|
+
"aria-label": enabled ? "\u5173\u95ED\u601D\u8003\u6A21\u5F0F" : "\u5F00\u542F\u601D\u8003\u6A21\u5F0F",
|
|
2110
|
+
onClick: () => onChange(!enabled),
|
|
2111
|
+
disabled,
|
|
2112
|
+
className: "flex w-full items-center justify-between gap-3 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))] disabled:cursor-not-allowed disabled:opacity-50",
|
|
2113
|
+
children: [
|
|
2114
|
+
/* @__PURE__ */ jsxs8("span", { className: "flex items-center gap-2", children: [
|
|
2115
|
+
/* @__PURE__ */ jsx9(Brain, { size: 14, "aria-hidden": "true" }),
|
|
2116
|
+
"\u601D\u8003\u6A21\u5F0F"
|
|
2117
|
+
] }),
|
|
2118
|
+
/* @__PURE__ */ jsxs8("span", { className: "flex items-center gap-2", children: [
|
|
2119
|
+
/* @__PURE__ */ jsx9("span", { className: "text-[10px] text-[hsl(var(--muted-foreground))]", children: enabled ? "\u5F00" : "\u5173" }),
|
|
2120
|
+
/* @__PURE__ */ jsx9(
|
|
2121
|
+
"span",
|
|
2122
|
+
{
|
|
2123
|
+
className: `flex h-4 w-7 items-center rounded-full p-0.5 transition-colors ${enabled ? "justify-end bg-[hsl(var(--primary))]" : "justify-start bg-[hsl(var(--muted))]"}`,
|
|
2124
|
+
"aria-hidden": "true",
|
|
2125
|
+
children: /* @__PURE__ */ jsx9("span", { className: "h-3 w-3 rounded-full bg-[hsl(var(--background))] shadow-sm" })
|
|
2126
|
+
}
|
|
2127
|
+
)
|
|
2128
|
+
] })
|
|
2129
|
+
]
|
|
2130
|
+
}
|
|
2131
|
+
);
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2067
2134
|
// src/react/components/chat/ChatInput.tsx
|
|
2068
|
-
import { Fragment as Fragment2, jsx as
|
|
2135
|
+
import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2069
2136
|
var DOUBLE_ESCAPE_MS = 450;
|
|
2070
2137
|
function getEditorText(editor) {
|
|
2071
2138
|
return editor?.getText({ blockSeparator: "\n" }) ?? "";
|
|
@@ -2186,7 +2253,7 @@ function isMessageContentEmpty(content) {
|
|
|
2186
2253
|
function isImageAttachment(attachment) {
|
|
2187
2254
|
return attachment.kind === "file" && attachment.mimeType.startsWith("image/");
|
|
2188
2255
|
}
|
|
2189
|
-
function buildSubmitPayload(text, attachments, pendingContexts, onBeforeSend) {
|
|
2256
|
+
async function buildSubmitPayload(text, attachments, pendingContexts, onBeforeSend) {
|
|
2190
2257
|
const validAttachments = attachments.filter((attachment) => attachment.status !== "failed");
|
|
2191
2258
|
const payload = buildMessageContent(text, validAttachments);
|
|
2192
2259
|
const contextParts = pendingContexts.flatMap((context) => {
|
|
@@ -2206,7 +2273,7 @@ ${context.content}`
|
|
|
2206
2273
|
return parts;
|
|
2207
2274
|
});
|
|
2208
2275
|
const mergedPayload = contextParts.length === 0 ? payload : typeof payload === "string" ? payload.trim() ? [...contextParts, { type: "text", text: payload }] : contextParts : [...contextParts, ...payload];
|
|
2209
|
-
return onBeforeSend ? onBeforeSend(mergedPayload) : mergedPayload;
|
|
2276
|
+
return onBeforeSend ? await onBeforeSend(mergedPayload) : mergedPayload;
|
|
2210
2277
|
}
|
|
2211
2278
|
function estimateTokenCount(text) {
|
|
2212
2279
|
const cjkCount = (text.match(/[\u3400-\u9FFF]/g) ?? []).length;
|
|
@@ -2231,38 +2298,38 @@ function ComposerFilePill({
|
|
|
2231
2298
|
const isFailed = isFile && attachment.status === "failed";
|
|
2232
2299
|
const isUploading = isFile && attachment.status === "uploading";
|
|
2233
2300
|
const uploadPercent = isUploading && typeof attachment.uploadProgress === "number" ? Math.max(0, Math.min(100, Math.round(attachment.uploadProgress * 100))) : null;
|
|
2234
|
-
return /* @__PURE__ */
|
|
2301
|
+
return /* @__PURE__ */ jsxs9(
|
|
2235
2302
|
"div",
|
|
2236
2303
|
{
|
|
2237
2304
|
className: `relative flex shrink-0 items-center gap-1.5 overflow-hidden rounded-full border px-2.5 py-1 text-[11px] ${isFailed ? "border-red-500/30 bg-red-500/5 text-red-400" : "border-[hsl(var(--border))] bg-[hsl(var(--card))] text-[hsl(var(--foreground))]"}`,
|
|
2238
2305
|
children: [
|
|
2239
|
-
uploadPercent !== null ? /* @__PURE__ */
|
|
2306
|
+
uploadPercent !== null ? /* @__PURE__ */ jsx10(
|
|
2240
2307
|
"span",
|
|
2241
2308
|
{
|
|
2242
2309
|
className: "absolute inset-y-0 left-0 bg-[hsl(var(--primary))]/10 transition-[width]",
|
|
2243
2310
|
style: { width: `${uploadPercent}%` }
|
|
2244
2311
|
}
|
|
2245
2312
|
) : null,
|
|
2246
|
-
isUploading ? /* @__PURE__ */
|
|
2313
|
+
isUploading ? /* @__PURE__ */ jsx10(
|
|
2247
2314
|
Loader22,
|
|
2248
2315
|
{
|
|
2249
2316
|
size: 12,
|
|
2250
2317
|
className: "relative z-10 shrink-0 animate-spin text-[hsl(var(--muted-foreground))]"
|
|
2251
2318
|
}
|
|
2252
|
-
) : /* @__PURE__ */
|
|
2253
|
-
/* @__PURE__ */
|
|
2254
|
-
uploadPercent !== null ? /* @__PURE__ */
|
|
2319
|
+
) : /* @__PURE__ */ jsx10(Icon, { size: 12, className: "relative z-10 shrink-0 text-[hsl(var(--muted-foreground))]" }),
|
|
2320
|
+
/* @__PURE__ */ jsx10("span", { className: "relative z-10 max-w-32 truncate", children: attachment.name }),
|
|
2321
|
+
uploadPercent !== null ? /* @__PURE__ */ jsxs9("span", { className: "relative z-10 font-mono text-[10px] tabular-nums text-[hsl(var(--muted-foreground))]", children: [
|
|
2255
2322
|
uploadPercent,
|
|
2256
2323
|
"%"
|
|
2257
2324
|
] }) : null,
|
|
2258
|
-
/* @__PURE__ */
|
|
2325
|
+
/* @__PURE__ */ jsx10(
|
|
2259
2326
|
"button",
|
|
2260
2327
|
{
|
|
2261
2328
|
type: "button",
|
|
2262
2329
|
onClick: () => onRemove(attachment.id),
|
|
2263
2330
|
"aria-label": `\u79FB\u9664 ${attachment.name}`,
|
|
2264
2331
|
className: "relative z-10 ml-0.5 inline-flex shrink-0 items-center justify-center rounded-full text-[hsl(var(--muted-foreground))] transition hover:text-rose-400",
|
|
2265
|
-
children: /* @__PURE__ */
|
|
2332
|
+
children: /* @__PURE__ */ jsx10(X2, { size: 10 })
|
|
2266
2333
|
}
|
|
2267
2334
|
)
|
|
2268
2335
|
]
|
|
@@ -2381,7 +2448,7 @@ ${upload.rawResultStr.slice(0, CONTEXT_INLINE_THRESHOLD)}...`
|
|
|
2381
2448
|
setImportingId(null);
|
|
2382
2449
|
}
|
|
2383
2450
|
};
|
|
2384
|
-
return /* @__PURE__ */
|
|
2451
|
+
return /* @__PURE__ */ jsx10(
|
|
2385
2452
|
"div",
|
|
2386
2453
|
{
|
|
2387
2454
|
className: "fixed inset-0 z-[60] flex items-center justify-center bg-black/55 p-4",
|
|
@@ -2389,44 +2456,44 @@ ${upload.rawResultStr.slice(0, CONTEXT_INLINE_THRESHOLD)}...`
|
|
|
2389
2456
|
onKeyDown: (e) => {
|
|
2390
2457
|
if (e.key === "Escape") onClose();
|
|
2391
2458
|
},
|
|
2392
|
-
children: /* @__PURE__ */
|
|
2459
|
+
children: /* @__PURE__ */ jsxs9(
|
|
2393
2460
|
"div",
|
|
2394
2461
|
{
|
|
2395
2462
|
className: "w-full max-w-lg flex flex-col rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] shadow-2xl",
|
|
2396
2463
|
onClick: (e) => e.stopPropagation(),
|
|
2397
2464
|
onKeyDown: (e) => e.stopPropagation(),
|
|
2398
2465
|
children: [
|
|
2399
|
-
/* @__PURE__ */
|
|
2400
|
-
/* @__PURE__ */
|
|
2401
|
-
/* @__PURE__ */
|
|
2466
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between border-b border-[hsl(var(--border))] px-5 py-3", children: [
|
|
2467
|
+
/* @__PURE__ */ jsx10("h4", { className: "text-sm font-semibold text-[hsl(var(--foreground))]", children: "\u6DFB\u52A0\u4E0A\u4E0B\u6587" }),
|
|
2468
|
+
/* @__PURE__ */ jsx10(
|
|
2402
2469
|
"button",
|
|
2403
2470
|
{
|
|
2404
2471
|
type: "button",
|
|
2405
2472
|
onClick: onClose,
|
|
2406
2473
|
className: "rounded-md p-1 text-[hsl(var(--muted-foreground))] transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]",
|
|
2407
|
-
children: /* @__PURE__ */
|
|
2474
|
+
children: /* @__PURE__ */ jsx10(X2, { size: 14 })
|
|
2408
2475
|
}
|
|
2409
2476
|
)
|
|
2410
2477
|
] }),
|
|
2411
|
-
/* @__PURE__ */
|
|
2412
|
-
/* @__PURE__ */
|
|
2413
|
-
/* @__PURE__ */
|
|
2478
|
+
/* @__PURE__ */ jsxs9("div", { className: "px-5 py-4 space-y-3", children: [
|
|
2479
|
+
/* @__PURE__ */ jsxs9("div", { className: "relative", children: [
|
|
2480
|
+
/* @__PURE__ */ jsxs9(
|
|
2414
2481
|
"button",
|
|
2415
2482
|
{
|
|
2416
2483
|
type: "button",
|
|
2417
2484
|
onClick: handleLoadSessions,
|
|
2418
2485
|
className: "inline-flex items-center gap-1.5 rounded-md border border-[hsl(var(--border))] px-2.5 py-1.5 text-xs text-[hsl(var(--foreground))] transition-colors hover:bg-[hsl(var(--accent))]",
|
|
2419
2486
|
children: [
|
|
2420
|
-
/* @__PURE__ */
|
|
2487
|
+
/* @__PURE__ */ jsx10(Import, { size: 12 }),
|
|
2421
2488
|
"\u4ECE\u5176\u4ED6\u4F1A\u8BDD\u5BFC\u5165",
|
|
2422
|
-
/* @__PURE__ */
|
|
2489
|
+
/* @__PURE__ */ jsx10(ChevronDown, { size: 10, className: `transition-transform ${showSessionPicker ? "rotate-180" : ""}` })
|
|
2423
2490
|
]
|
|
2424
2491
|
}
|
|
2425
2492
|
),
|
|
2426
|
-
showSessionPicker && /* @__PURE__ */
|
|
2427
|
-
/* @__PURE__ */
|
|
2493
|
+
showSessionPicker && /* @__PURE__ */ jsx10("div", { className: "absolute left-0 top-full z-10 mt-1 max-h-48 w-full overflow-y-auto rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] shadow-lg", children: loadingSessions ? /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2 px-3 py-2.5 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
2494
|
+
/* @__PURE__ */ jsx10(Loader22, { size: 12, className: "animate-spin" }),
|
|
2428
2495
|
"\u52A0\u8F7D\u4F1A\u8BDD\u5217\u8868\u2026"
|
|
2429
|
-
] }) : sessions.length === 0 ? /* @__PURE__ */
|
|
2496
|
+
] }) : sessions.length === 0 ? /* @__PURE__ */ jsx10("div", { className: "px-3 py-2.5 text-xs text-[hsl(var(--muted-foreground))]", children: "\u6682\u65E0\u5176\u4ED6\u4F1A\u8BDD" }) : sessions.map((s) => /* @__PURE__ */ jsxs9(
|
|
2430
2497
|
"button",
|
|
2431
2498
|
{
|
|
2432
2499
|
type: "button",
|
|
@@ -2434,16 +2501,16 @@ ${upload.rawResultStr.slice(0, CONTEXT_INLINE_THRESHOLD)}...`
|
|
|
2434
2501
|
onClick: () => handleImportSession(s.id),
|
|
2435
2502
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left text-xs text-[hsl(var(--foreground))] transition-colors hover:bg-[hsl(var(--accent))] disabled:opacity-50",
|
|
2436
2503
|
children: [
|
|
2437
|
-
importingId === s.id && /* @__PURE__ */
|
|
2438
|
-
/* @__PURE__ */
|
|
2504
|
+
importingId === s.id && /* @__PURE__ */ jsx10(Loader22, { size: 10, className: "shrink-0 animate-spin" }),
|
|
2505
|
+
/* @__PURE__ */ jsx10("span", { className: "truncate", children: s.intent })
|
|
2439
2506
|
]
|
|
2440
2507
|
},
|
|
2441
2508
|
s.id
|
|
2442
2509
|
)) })
|
|
2443
2510
|
] }),
|
|
2444
|
-
/* @__PURE__ */
|
|
2445
|
-
/* @__PURE__ */
|
|
2446
|
-
/* @__PURE__ */
|
|
2511
|
+
/* @__PURE__ */ jsxs9("div", { children: [
|
|
2512
|
+
/* @__PURE__ */ jsx10("label", { htmlFor: "ctx-label", className: "block text-xs font-medium text-[hsl(var(--foreground))] mb-1", children: "\u6807\u7B7E" }),
|
|
2513
|
+
/* @__PURE__ */ jsx10(
|
|
2447
2514
|
"input",
|
|
2448
2515
|
{
|
|
2449
2516
|
id: "ctx-label",
|
|
@@ -2454,13 +2521,13 @@ ${upload.rawResultStr.slice(0, CONTEXT_INLINE_THRESHOLD)}...`
|
|
|
2454
2521
|
}
|
|
2455
2522
|
)
|
|
2456
2523
|
] }),
|
|
2457
|
-
/* @__PURE__ */
|
|
2458
|
-
/* @__PURE__ */
|
|
2459
|
-
isImportProcessing && /* @__PURE__ */
|
|
2460
|
-
/* @__PURE__ */
|
|
2524
|
+
/* @__PURE__ */ jsxs9("div", { children: [
|
|
2525
|
+
/* @__PURE__ */ jsx10("label", { htmlFor: "ctx-content", className: "block text-xs font-medium text-[hsl(var(--foreground))] mb-1", children: "\u5185\u5BB9" }),
|
|
2526
|
+
isImportProcessing && /* @__PURE__ */ jsxs9("div", { className: "mb-1.5 flex items-center gap-1.5 text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
2527
|
+
/* @__PURE__ */ jsx10(Loader22, { size: 11, className: "animate-spin" }),
|
|
2461
2528
|
"\u6B63\u5728\u5904\u7406\u5BFC\u5165\u5185\u5BB9\u5E76\u5199\u5165 workspace/context\uFF0C\u5B8C\u6210\u540E\u53EF\u70B9\u51FB\u201C\u786E\u5B9A\u201D"
|
|
2462
2529
|
] }),
|
|
2463
|
-
/* @__PURE__ */
|
|
2530
|
+
/* @__PURE__ */ jsx10(
|
|
2464
2531
|
"textarea",
|
|
2465
2532
|
{
|
|
2466
2533
|
id: "ctx-content",
|
|
@@ -2473,8 +2540,8 @@ ${upload.rawResultStr.slice(0, CONTEXT_INLINE_THRESHOLD)}...`
|
|
|
2473
2540
|
)
|
|
2474
2541
|
] })
|
|
2475
2542
|
] }),
|
|
2476
|
-
/* @__PURE__ */
|
|
2477
|
-
/* @__PURE__ */
|
|
2543
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex justify-end gap-2 border-t border-[hsl(var(--border))] px-5 py-3", children: [
|
|
2544
|
+
/* @__PURE__ */ jsx10(
|
|
2478
2545
|
"button",
|
|
2479
2546
|
{
|
|
2480
2547
|
type: "button",
|
|
@@ -2483,7 +2550,7 @@ ${upload.rawResultStr.slice(0, CONTEXT_INLINE_THRESHOLD)}...`
|
|
|
2483
2550
|
children: "\u53D6\u6D88"
|
|
2484
2551
|
}
|
|
2485
2552
|
),
|
|
2486
|
-
/* @__PURE__ */
|
|
2553
|
+
/* @__PURE__ */ jsx10(
|
|
2487
2554
|
"button",
|
|
2488
2555
|
{
|
|
2489
2556
|
type: "button",
|
|
@@ -2514,19 +2581,19 @@ function ComposerContextPill({
|
|
|
2514
2581
|
}) {
|
|
2515
2582
|
const [showDetail, setShowDetail] = useState8(false);
|
|
2516
2583
|
const tokenK = formatTokenK(content);
|
|
2517
|
-
return /* @__PURE__ */
|
|
2518
|
-
/* @__PURE__ */
|
|
2519
|
-
imageUrl ? /* @__PURE__ */
|
|
2584
|
+
return /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
2585
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex shrink-0 items-center gap-1.5 rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--accent))] px-2.5 py-1 text-[11px] text-[hsl(var(--foreground))]", children: [
|
|
2586
|
+
imageUrl ? /* @__PURE__ */ jsx10(
|
|
2520
2587
|
"button",
|
|
2521
2588
|
{
|
|
2522
2589
|
type: "button",
|
|
2523
2590
|
onClick: () => setShowDetail(true),
|
|
2524
2591
|
className: "h-6 w-6 overflow-hidden rounded-md border border-[hsl(var(--border))] bg-white",
|
|
2525
2592
|
title: "\u67E5\u770B\u9009\u4E2D\u533A\u57DF\u622A\u56FE",
|
|
2526
|
-
children: /* @__PURE__ */
|
|
2593
|
+
children: /* @__PURE__ */ jsx10("img", { src: imageUrl, alt: "\u9009\u4E2D\u533A\u57DF\u622A\u56FE", className: "h-full w-full object-cover" })
|
|
2527
2594
|
}
|
|
2528
2595
|
) : null,
|
|
2529
|
-
/* @__PURE__ */
|
|
2596
|
+
/* @__PURE__ */ jsx10(
|
|
2530
2597
|
"button",
|
|
2531
2598
|
{
|
|
2532
2599
|
type: "button",
|
|
@@ -2536,7 +2603,7 @@ function ComposerContextPill({
|
|
|
2536
2603
|
children: label
|
|
2537
2604
|
}
|
|
2538
2605
|
),
|
|
2539
|
-
/* @__PURE__ */
|
|
2606
|
+
/* @__PURE__ */ jsx10(
|
|
2540
2607
|
"span",
|
|
2541
2608
|
{
|
|
2542
2609
|
className: "shrink-0 rounded bg-[hsl(var(--background))] px-1.5 py-0.5 text-[10px] text-[hsl(var(--muted-foreground))]",
|
|
@@ -2544,18 +2611,18 @@ function ComposerContextPill({
|
|
|
2544
2611
|
children: tokenK
|
|
2545
2612
|
}
|
|
2546
2613
|
),
|
|
2547
|
-
/* @__PURE__ */
|
|
2614
|
+
/* @__PURE__ */ jsx10(
|
|
2548
2615
|
"button",
|
|
2549
2616
|
{
|
|
2550
2617
|
type: "button",
|
|
2551
2618
|
onClick: () => onRemove(id),
|
|
2552
2619
|
"aria-label": `\u79FB\u9664\u4E0A\u4E0B\u6587 ${label}`,
|
|
2553
2620
|
className: "ml-0.5 inline-flex shrink-0 items-center justify-center rounded-full text-[hsl(var(--muted-foreground))] transition hover:text-rose-400",
|
|
2554
|
-
children: /* @__PURE__ */
|
|
2621
|
+
children: /* @__PURE__ */ jsx10(X2, { size: 10 })
|
|
2555
2622
|
}
|
|
2556
2623
|
)
|
|
2557
2624
|
] }),
|
|
2558
|
-
showDetail && /* @__PURE__ */
|
|
2625
|
+
showDetail && /* @__PURE__ */ jsx10(
|
|
2559
2626
|
"div",
|
|
2560
2627
|
{
|
|
2561
2628
|
className: "fixed inset-0 z-[60] flex items-center justify-center bg-black/55 p-6",
|
|
@@ -2563,31 +2630,31 @@ function ComposerContextPill({
|
|
|
2563
2630
|
onKeyDown: (e) => {
|
|
2564
2631
|
if (e.key === "Escape") setShowDetail(false);
|
|
2565
2632
|
},
|
|
2566
|
-
children: /* @__PURE__ */
|
|
2633
|
+
children: /* @__PURE__ */ jsxs9(
|
|
2567
2634
|
"div",
|
|
2568
2635
|
{
|
|
2569
2636
|
className: "w-full max-w-4xl max-h-[85vh] flex flex-col rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] shadow-2xl",
|
|
2570
2637
|
onClick: (e) => e.stopPropagation(),
|
|
2571
2638
|
onKeyDown: (e) => e.stopPropagation(),
|
|
2572
2639
|
children: [
|
|
2573
|
-
/* @__PURE__ */
|
|
2574
|
-
/* @__PURE__ */
|
|
2575
|
-
/* @__PURE__ */
|
|
2576
|
-
imageUrl ? /* @__PURE__ */
|
|
2640
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between border-b border-[hsl(var(--border))] px-6 py-3", children: [
|
|
2641
|
+
/* @__PURE__ */ jsxs9("div", { className: "min-w-0", children: [
|
|
2642
|
+
/* @__PURE__ */ jsx10("h4", { className: "truncate text-xs font-semibold text-[hsl(var(--foreground))]", children: label }),
|
|
2643
|
+
imageUrl ? /* @__PURE__ */ jsx10("p", { className: "mt-0.5 text-[11px] text-[hsl(var(--muted-foreground))]", children: "\u5DF2\u9644\u52A0\u9009\u4E2D\u533A\u57DF\u622A\u56FE\uFF0C\u975E\u591A\u6A21\u6001\u6A21\u578B\u4F1A\u81EA\u52A8\u5FFD\u7565\u56FE\u7247\u3002" }) : null
|
|
2577
2644
|
] }),
|
|
2578
|
-
/* @__PURE__ */
|
|
2645
|
+
/* @__PURE__ */ jsx10(
|
|
2579
2646
|
"button",
|
|
2580
2647
|
{
|
|
2581
2648
|
type: "button",
|
|
2582
2649
|
onClick: () => setShowDetail(false),
|
|
2583
2650
|
className: "rounded-md p-1 text-[hsl(var(--muted-foreground))] transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]",
|
|
2584
|
-
children: /* @__PURE__ */
|
|
2651
|
+
children: /* @__PURE__ */ jsx10(X2, { size: 14 })
|
|
2585
2652
|
}
|
|
2586
2653
|
)
|
|
2587
2654
|
] }),
|
|
2588
|
-
/* @__PURE__ */
|
|
2589
|
-
imageUrl ? /* @__PURE__ */
|
|
2590
|
-
/* @__PURE__ */
|
|
2655
|
+
/* @__PURE__ */ jsxs9("div", { className: "min-h-0 flex-1 overflow-y-auto px-6 py-4", children: [
|
|
2656
|
+
imageUrl ? /* @__PURE__ */ jsx10("div", { className: "mb-4 rounded-xl border border-[hsl(var(--border))] bg-white p-2", children: /* @__PURE__ */ jsx10("img", { src: imageUrl, alt: "\u9009\u4E2D\u533A\u57DF\u622A\u56FE", className: "max-h-72 max-w-full rounded-lg object-contain" }) }) : null,
|
|
2657
|
+
/* @__PURE__ */ jsx10("pre", { className: "whitespace-pre-wrap break-words font-mono text-[11px] leading-[1.6] text-[hsl(var(--foreground)/0.85)]", children: content })
|
|
2591
2658
|
] })
|
|
2592
2659
|
]
|
|
2593
2660
|
}
|
|
@@ -2788,7 +2855,13 @@ function ChatInput({
|
|
|
2788
2855
|
const [isEditorFocused, setIsEditorFocused] = useState8(false);
|
|
2789
2856
|
const [oversizedFiles, setOversizedFiles] = useState8([]);
|
|
2790
2857
|
const [selectedModel, setSelectedModel] = useState8("");
|
|
2858
|
+
const [thinkingOverride, setThinkingOverride] = useState8(null);
|
|
2791
2859
|
const { setPreferredModel } = usePreferredModel();
|
|
2860
|
+
const {
|
|
2861
|
+
thinkingEnabled: preferredThinkingEnabled,
|
|
2862
|
+
thinkingPreference,
|
|
2863
|
+
setThinkingEnabled: setPreferredThinkingEnabled
|
|
2864
|
+
} = useThinkingPreference();
|
|
2792
2865
|
const queryClient = useQueryClient2();
|
|
2793
2866
|
const actionMenuRef = useRef5(null);
|
|
2794
2867
|
const fileInputRef = useRef5(null);
|
|
@@ -2957,7 +3030,7 @@ function ChatInput({
|
|
|
2957
3030
|
if (!container || !root) return;
|
|
2958
3031
|
updateSuggestionPosition(container, props.clientRect);
|
|
2959
3032
|
root.render(
|
|
2960
|
-
/* @__PURE__ */
|
|
3033
|
+
/* @__PURE__ */ jsx10(
|
|
2961
3034
|
FileCompletionMenu,
|
|
2962
3035
|
{
|
|
2963
3036
|
ref: (instance) => {
|
|
@@ -3034,7 +3107,7 @@ function ChatInput({
|
|
|
3034
3107
|
if (!container || !root) return;
|
|
3035
3108
|
updateSuggestionPosition(container, props.clientRect);
|
|
3036
3109
|
root.render(
|
|
3037
|
-
/* @__PURE__ */
|
|
3110
|
+
/* @__PURE__ */ jsx10(
|
|
3038
3111
|
SkillCompletionMenu,
|
|
3039
3112
|
{
|
|
3040
3113
|
ref: (instance) => {
|
|
@@ -3391,7 +3464,7 @@ function ChatInput({
|
|
|
3391
3464
|
}
|
|
3392
3465
|
}
|
|
3393
3466
|
const activePendingContexts = pendingContexts ?? [];
|
|
3394
|
-
const nextPayload = buildSubmitPayload(
|
|
3467
|
+
const nextPayload = await buildSubmitPayload(
|
|
3395
3468
|
text,
|
|
3396
3469
|
updatedAttachments,
|
|
3397
3470
|
activePendingContexts,
|
|
@@ -3403,7 +3476,11 @@ function ChatInput({
|
|
|
3403
3476
|
if (activeSessionId && activePendingContexts.length > 0) {
|
|
3404
3477
|
consumePendingContexts(activeSessionId);
|
|
3405
3478
|
}
|
|
3406
|
-
onSend(nextPayload,
|
|
3479
|
+
onSend(nextPayload, {
|
|
3480
|
+
targetSessionId: uploadTargetSessionId,
|
|
3481
|
+
model: selectedModel || null,
|
|
3482
|
+
thinkingOverride: sessionThinking != null || thinkingPreference != null ? thinkingEnabled : void 0
|
|
3483
|
+
});
|
|
3407
3484
|
if (text.trim()) {
|
|
3408
3485
|
inputHistory.addEntry(text);
|
|
3409
3486
|
}
|
|
@@ -3424,6 +3501,8 @@ function ChatInput({
|
|
|
3424
3501
|
const currentSession = useSessionStore(
|
|
3425
3502
|
(state) => activeSessionId ? state.sessions.find((s) => s.id === activeSessionId) : void 0
|
|
3426
3503
|
);
|
|
3504
|
+
const sessionThinking = currentSession?.enable_thinking;
|
|
3505
|
+
const thinkingEnabled = thinkingOverride != null && thinkingOverride.sid === activeSessionId ? thinkingOverride.val : sessionThinking ?? preferredThinkingEnabled;
|
|
3427
3506
|
const isSkillEditor = currentSession?.solution_id === "skill_editor" || currentSession?.template_id === "skill_editor";
|
|
3428
3507
|
const imageAttachments = composerAttachments.filter(isImageAttachment);
|
|
3429
3508
|
const fileAttachments = composerAttachments.filter(
|
|
@@ -3434,11 +3513,11 @@ function ChatInput({
|
|
|
3434
3513
|
);
|
|
3435
3514
|
const hasValidAttachments = composerAttachments.some((attachment) => attachment.status !== "failed");
|
|
3436
3515
|
const isSendDisabled = connectionStatus !== "connected" || isModelLoading || !hasAvailableModel || hasUploadingFiles || !input.trim() && !hasValidAttachments && !hasRenderedAttachments && !hasPendingContexts;
|
|
3437
|
-
return /* @__PURE__ */
|
|
3438
|
-
/* @__PURE__ */
|
|
3439
|
-
activeSessionId ? /* @__PURE__ */
|
|
3440
|
-
!isModelLoading && !hasAvailableModel ? /* @__PURE__ */
|
|
3441
|
-
/* @__PURE__ */
|
|
3516
|
+
return /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
3517
|
+
/* @__PURE__ */ jsx10("div", { className: `bg-[hsl(var(--background))] px-5 py-3 ${className ?? ""}`, children: /* @__PURE__ */ jsxs9("div", { className: `mx-auto ${maxWidthClassName} ${innerClassName ?? ""}`, children: [
|
|
3518
|
+
activeSessionId ? /* @__PURE__ */ jsx10(BackgroundTasksPill, { sessionId: activeSessionId }) : null,
|
|
3519
|
+
!isModelLoading && !hasAvailableModel ? /* @__PURE__ */ jsx10("div", { className: "mb-2 rounded-lg border border-[hsl(var(--destructive))]/30 bg-[hsl(var(--destructive))]/8 px-3 py-2 text-xs text-[hsl(var(--destructive))]", children: "\u6CA1\u6709\u53EF\u7528\u6A21\u578B\uFF0C\u8BF7\u68C0\u67E5\u6A21\u578B\u670D\u52A1\u914D\u7F6E" }) : null,
|
|
3520
|
+
/* @__PURE__ */ jsx10(
|
|
3442
3521
|
"div",
|
|
3443
3522
|
{
|
|
3444
3523
|
className: "relative",
|
|
@@ -3472,19 +3551,19 @@ function ChatInput({
|
|
|
3472
3551
|
if (files.length > 0) void stableAppendFiles(files);
|
|
3473
3552
|
});
|
|
3474
3553
|
},
|
|
3475
|
-
children: /* @__PURE__ */
|
|
3554
|
+
children: /* @__PURE__ */ jsxs9(
|
|
3476
3555
|
"div",
|
|
3477
3556
|
{
|
|
3478
3557
|
className: `overflow-visible rounded-2xl border bg-[hsl(var(--card))] transition-[box-shadow,border-color] duration-300 ${isRecording ? "border-emerald-400/70! shadow-[0_0_0_3px_rgba(52,211,153,0.18),0_0_24px_rgba(52,211,153,0.28)]" : dragging ? isPlanning ? "border-amber-400/60" : "border-[hsl(var(--primary)/0.6)]" : isEditorFocused ? isPlanning ? "border-amber-400/60" : "border-[hsl(var(--primary)/0.6)]" : isPlanning ? "border-amber-400/30" : "border-[hsl(var(--border))]"}`,
|
|
3479
3558
|
children: [
|
|
3480
|
-
dragging && /* @__PURE__ */
|
|
3481
|
-
composerAttachments.length > 0 && /* @__PURE__ */
|
|
3482
|
-
imageAttachments.length > 0 && /* @__PURE__ */
|
|
3559
|
+
dragging && /* @__PURE__ */ jsx10("div", { className: "pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-2xl bg-[hsl(var(--primary)/0.06)]", children: /* @__PURE__ */ jsx10("span", { className: "rounded-full bg-[hsl(var(--primary)/0.12)] px-4 py-2 text-sm font-medium text-[hsl(var(--primary))]", children: "\u677E\u624B\u5F15\u7528\u6587\u4EF6" }) }),
|
|
3560
|
+
composerAttachments.length > 0 && /* @__PURE__ */ jsxs9("div", { className: "flex max-h-40 flex-col gap-2 overflow-y-auto border-b border-[hsl(var(--border))] px-3 py-2", children: [
|
|
3561
|
+
imageAttachments.length > 0 && /* @__PURE__ */ jsx10("div", { className: "grid grid-cols-3 gap-2", children: imageAttachments.map((attachment) => /* @__PURE__ */ jsxs9(
|
|
3483
3562
|
"div",
|
|
3484
3563
|
{
|
|
3485
3564
|
className: "relative overflow-hidden rounded-xl border border-[hsl(var(--border))]",
|
|
3486
3565
|
children: [
|
|
3487
|
-
/* @__PURE__ */
|
|
3566
|
+
/* @__PURE__ */ jsx10(
|
|
3488
3567
|
"img",
|
|
3489
3568
|
{
|
|
3490
3569
|
src: getImagePreviewUrl(attachment, activeSessionId, localImageUrls),
|
|
@@ -3492,21 +3571,21 @@ function ChatInput({
|
|
|
3492
3571
|
className: "h-24 w-full object-cover"
|
|
3493
3572
|
}
|
|
3494
3573
|
),
|
|
3495
|
-
/* @__PURE__ */
|
|
3574
|
+
/* @__PURE__ */ jsx10(
|
|
3496
3575
|
"button",
|
|
3497
3576
|
{
|
|
3498
3577
|
type: "button",
|
|
3499
3578
|
onClick: () => removeAttachment(attachment.id),
|
|
3500
3579
|
"aria-label": `\u79FB\u9664 ${attachment.name || "\u56FE\u7247"}`,
|
|
3501
3580
|
className: "absolute right-1.5 top-1.5 flex h-6 w-6 items-center justify-center rounded-full bg-[hsl(var(--background)/0.85)] text-[hsl(var(--foreground))]",
|
|
3502
|
-
children: /* @__PURE__ */
|
|
3581
|
+
children: /* @__PURE__ */ jsx10(X2, { size: 12 })
|
|
3503
3582
|
}
|
|
3504
3583
|
)
|
|
3505
3584
|
]
|
|
3506
3585
|
},
|
|
3507
3586
|
attachment.id
|
|
3508
3587
|
)) }),
|
|
3509
|
-
fileAttachments.length > 0 && /* @__PURE__ */
|
|
3588
|
+
fileAttachments.length > 0 && /* @__PURE__ */ jsx10("div", { className: "flex flex-wrap gap-1.5", children: fileAttachments.map((attachment) => /* @__PURE__ */ jsx10(
|
|
3510
3589
|
ComposerFilePill,
|
|
3511
3590
|
{
|
|
3512
3591
|
attachment,
|
|
@@ -3515,8 +3594,8 @@ function ChatInput({
|
|
|
3515
3594
|
attachment.id
|
|
3516
3595
|
)) })
|
|
3517
3596
|
] }),
|
|
3518
|
-
hasPendingContexts || isSkillEditor ? /* @__PURE__ */
|
|
3519
|
-
pendingContexts?.map((context) => /* @__PURE__ */
|
|
3597
|
+
hasPendingContexts || isSkillEditor ? /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center gap-1.5 border-b border-[hsl(var(--border))] px-3 py-2", children: [
|
|
3598
|
+
pendingContexts?.map((context) => /* @__PURE__ */ jsx10(
|
|
3520
3599
|
ComposerContextPill,
|
|
3521
3600
|
{
|
|
3522
3601
|
id: context.id,
|
|
@@ -3532,18 +3611,18 @@ function ChatInput({
|
|
|
3532
3611
|
},
|
|
3533
3612
|
context.id
|
|
3534
3613
|
)),
|
|
3535
|
-
isSkillEditor && /* @__PURE__ */
|
|
3614
|
+
isSkillEditor && /* @__PURE__ */ jsx10(
|
|
3536
3615
|
"button",
|
|
3537
3616
|
{
|
|
3538
3617
|
type: "button",
|
|
3539
3618
|
onClick: () => setShowAddContext(true),
|
|
3540
3619
|
title: "\u6DFB\u52A0\u4E0A\u4E0B\u6587",
|
|
3541
3620
|
className: "inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-dashed border-[hsl(var(--border))] text-[hsl(var(--muted-foreground))] transition-colors hover:border-[hsl(var(--ring))] hover:text-[hsl(var(--foreground))]",
|
|
3542
|
-
children: /* @__PURE__ */
|
|
3621
|
+
children: /* @__PURE__ */ jsx10(Plus, { size: 12 })
|
|
3543
3622
|
}
|
|
3544
3623
|
)
|
|
3545
3624
|
] }) : null,
|
|
3546
|
-
showAddContext && activeSessionId && /* @__PURE__ */
|
|
3625
|
+
showAddContext && activeSessionId && /* @__PURE__ */ jsx10(
|
|
3547
3626
|
AddContextDialog,
|
|
3548
3627
|
{
|
|
3549
3628
|
sessionId: activeSessionId,
|
|
@@ -3555,15 +3634,15 @@ function ChatInput({
|
|
|
3555
3634
|
}
|
|
3556
3635
|
}
|
|
3557
3636
|
),
|
|
3558
|
-
attachments ? /* @__PURE__ */
|
|
3559
|
-
slotAboveTextarea ? /* @__PURE__ */
|
|
3560
|
-
/* @__PURE__ */
|
|
3561
|
-
input.length === 0 && /* @__PURE__ */
|
|
3562
|
-
/* @__PURE__ */
|
|
3637
|
+
attachments ? /* @__PURE__ */ jsx10("div", { className: "border-b border-[hsl(var(--border))] px-3 py-3", children: attachments }) : null,
|
|
3638
|
+
slotAboveTextarea ? /* @__PURE__ */ jsx10("div", { className: "border-b border-[hsl(var(--border))] px-3 py-2", children: slotAboveTextarea }) : null,
|
|
3639
|
+
/* @__PURE__ */ jsxs9("div", { className: "relative", children: [
|
|
3640
|
+
input.length === 0 && /* @__PURE__ */ jsx10("div", { className: "pointer-events-none absolute left-4 top-3 text-sm leading-relaxed text-[hsl(var(--muted-foreground))]", children: placeholder }),
|
|
3641
|
+
/* @__PURE__ */ jsx10(EditorContent, { editor })
|
|
3563
3642
|
] }),
|
|
3564
|
-
/* @__PURE__ */
|
|
3565
|
-
/* @__PURE__ */
|
|
3566
|
-
/* @__PURE__ */
|
|
3643
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between border-t border-[hsl(var(--border))] px-3 py-1.5", children: [
|
|
3644
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
|
|
3645
|
+
/* @__PURE__ */ jsx10(
|
|
3567
3646
|
"input",
|
|
3568
3647
|
{
|
|
3569
3648
|
ref: fileInputRef,
|
|
@@ -3579,7 +3658,7 @@ function ChatInput({
|
|
|
3579
3658
|
className: "hidden"
|
|
3580
3659
|
}
|
|
3581
3660
|
),
|
|
3582
|
-
/* @__PURE__ */
|
|
3661
|
+
/* @__PURE__ */ jsx10(
|
|
3583
3662
|
"input",
|
|
3584
3663
|
{
|
|
3585
3664
|
ref: folderInputRef,
|
|
@@ -3595,18 +3674,18 @@ function ChatInput({
|
|
|
3595
3674
|
...{ webkitdirectory: "" }
|
|
3596
3675
|
}
|
|
3597
3676
|
),
|
|
3598
|
-
/* @__PURE__ */
|
|
3599
|
-
/* @__PURE__ */
|
|
3677
|
+
/* @__PURE__ */ jsxs9("details", { ref: actionMenuRef, className: "group relative", children: [
|
|
3678
|
+
/* @__PURE__ */ jsx10(
|
|
3600
3679
|
"summary",
|
|
3601
3680
|
{
|
|
3602
3681
|
"aria-label": "\u6DFB\u52A0\u5185\u5BB9",
|
|
3603
3682
|
title: "\u6DFB\u52A0\u5185\u5BB9",
|
|
3604
3683
|
className: "flex h-7 w-7 shrink-0 cursor-pointer list-none items-center justify-center rounded-lg border border-[hsl(var(--border))] text-[hsl(var(--muted-foreground))] transition-colors hover:border-[hsl(var(--ring))] hover:text-[hsl(var(--foreground))] [&::-webkit-details-marker]:hidden",
|
|
3605
|
-
children: /* @__PURE__ */
|
|
3684
|
+
children: /* @__PURE__ */ jsx10(Plus, { size: 14 })
|
|
3606
3685
|
}
|
|
3607
3686
|
),
|
|
3608
|
-
/* @__PURE__ */
|
|
3609
|
-
/* @__PURE__ */
|
|
3687
|
+
/* @__PURE__ */ jsxs9("div", { className: "absolute bottom-full left-0 z-30 mb-2 min-w-36 overflow-visible rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--popover))] py-1 text-[11px] text-[hsl(var(--popover-foreground))] shadow-lg", children: [
|
|
3688
|
+
/* @__PURE__ */ jsxs9(
|
|
3610
3689
|
"button",
|
|
3611
3690
|
{
|
|
3612
3691
|
type: "button",
|
|
@@ -3616,12 +3695,12 @@ function ChatInput({
|
|
|
3616
3695
|
},
|
|
3617
3696
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))]",
|
|
3618
3697
|
children: [
|
|
3619
|
-
/* @__PURE__ */
|
|
3698
|
+
/* @__PURE__ */ jsx10(Paperclip, { size: 13 }),
|
|
3620
3699
|
"\u4E0A\u4F20\u6587\u4EF6"
|
|
3621
3700
|
]
|
|
3622
3701
|
}
|
|
3623
3702
|
),
|
|
3624
|
-
/* @__PURE__ */
|
|
3703
|
+
/* @__PURE__ */ jsxs9(
|
|
3625
3704
|
"button",
|
|
3626
3705
|
{
|
|
3627
3706
|
type: "button",
|
|
@@ -3631,12 +3710,12 @@ function ChatInput({
|
|
|
3631
3710
|
},
|
|
3632
3711
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))]",
|
|
3633
3712
|
children: [
|
|
3634
|
-
/* @__PURE__ */
|
|
3713
|
+
/* @__PURE__ */ jsx10(FolderUp, { size: 13 }),
|
|
3635
3714
|
"\u4E0A\u4F20\u6587\u4EF6\u5939"
|
|
3636
3715
|
]
|
|
3637
3716
|
}
|
|
3638
3717
|
),
|
|
3639
|
-
onDoubleEscape ? /* @__PURE__ */
|
|
3718
|
+
onDoubleEscape ? /* @__PURE__ */ jsxs9(
|
|
3640
3719
|
"button",
|
|
3641
3720
|
{
|
|
3642
3721
|
type: "button",
|
|
@@ -3648,13 +3727,13 @@ function ChatInput({
|
|
|
3648
3727
|
},
|
|
3649
3728
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))]",
|
|
3650
3729
|
children: [
|
|
3651
|
-
/* @__PURE__ */
|
|
3730
|
+
/* @__PURE__ */ jsx10(RotateCcw, { size: 13 }),
|
|
3652
3731
|
"\u56DE\u5230\u4E4B\u524D\u7684\u67D0\u4E00\u6B65"
|
|
3653
3732
|
]
|
|
3654
3733
|
}
|
|
3655
3734
|
) : null,
|
|
3656
|
-
onCommand ? /* @__PURE__ */
|
|
3657
|
-
/* @__PURE__ */
|
|
3735
|
+
onCommand ? /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
3736
|
+
/* @__PURE__ */ jsxs9(
|
|
3658
3737
|
"button",
|
|
3659
3738
|
{
|
|
3660
3739
|
type: "button",
|
|
@@ -3665,12 +3744,12 @@ function ChatInput({
|
|
|
3665
3744
|
disabled: isStreaming,
|
|
3666
3745
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))] disabled:cursor-not-allowed disabled:opacity-50",
|
|
3667
3746
|
children: [
|
|
3668
|
-
isStreaming ? /* @__PURE__ */
|
|
3747
|
+
isStreaming ? /* @__PURE__ */ jsx10(Loader22, { size: 13, className: "animate-spin" }) : /* @__PURE__ */ jsx10(Scissors, { size: 13 }),
|
|
3669
3748
|
"\u6574\u7406\u5BF9\u8BDD"
|
|
3670
3749
|
]
|
|
3671
3750
|
}
|
|
3672
3751
|
),
|
|
3673
|
-
/* @__PURE__ */
|
|
3752
|
+
/* @__PURE__ */ jsxs9(
|
|
3674
3753
|
"button",
|
|
3675
3754
|
{
|
|
3676
3755
|
type: "button",
|
|
@@ -3680,12 +3759,12 @@ function ChatInput({
|
|
|
3680
3759
|
},
|
|
3681
3760
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))]",
|
|
3682
3761
|
children: [
|
|
3683
|
-
/* @__PURE__ */
|
|
3762
|
+
/* @__PURE__ */ jsx10(Download, { size: 13 }),
|
|
3684
3763
|
"\u5BFC\u51FA\u4F1A\u8BDD"
|
|
3685
3764
|
]
|
|
3686
3765
|
}
|
|
3687
3766
|
),
|
|
3688
|
-
canShareSession ? /* @__PURE__ */
|
|
3767
|
+
canShareSession ? /* @__PURE__ */ jsxs9(
|
|
3689
3768
|
"button",
|
|
3690
3769
|
{
|
|
3691
3770
|
type: "button",
|
|
@@ -3695,12 +3774,12 @@ function ChatInput({
|
|
|
3695
3774
|
},
|
|
3696
3775
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))]",
|
|
3697
3776
|
children: [
|
|
3698
|
-
/* @__PURE__ */
|
|
3777
|
+
/* @__PURE__ */ jsx10(Share2, { size: 13 }),
|
|
3699
3778
|
"\u5206\u4EAB\u4F1A\u8BDD"
|
|
3700
3779
|
]
|
|
3701
3780
|
}
|
|
3702
3781
|
) : null,
|
|
3703
|
-
/* @__PURE__ */
|
|
3782
|
+
/* @__PURE__ */ jsxs9(
|
|
3704
3783
|
"button",
|
|
3705
3784
|
{
|
|
3706
3785
|
type: "button",
|
|
@@ -3710,12 +3789,12 @@ function ChatInput({
|
|
|
3710
3789
|
},
|
|
3711
3790
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))]",
|
|
3712
3791
|
children: [
|
|
3713
|
-
/* @__PURE__ */
|
|
3792
|
+
/* @__PURE__ */ jsx10(FlaskConical, { size: 13 }),
|
|
3714
3793
|
"\u63D0\u53D6\u6280\u80FD"
|
|
3715
3794
|
]
|
|
3716
3795
|
}
|
|
3717
3796
|
),
|
|
3718
|
-
/* @__PURE__ */
|
|
3797
|
+
/* @__PURE__ */ jsxs9(
|
|
3719
3798
|
"button",
|
|
3720
3799
|
{
|
|
3721
3800
|
type: "button",
|
|
@@ -3725,16 +3804,26 @@ function ChatInput({
|
|
|
3725
3804
|
},
|
|
3726
3805
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))]",
|
|
3727
3806
|
children: [
|
|
3728
|
-
/* @__PURE__ */
|
|
3807
|
+
/* @__PURE__ */ jsx10(Rocket, { size: 13 }),
|
|
3729
3808
|
"\u751F\u6210\u5E94\u7528"
|
|
3730
3809
|
]
|
|
3731
3810
|
}
|
|
3732
3811
|
)
|
|
3733
3812
|
] }) : null,
|
|
3734
|
-
/* @__PURE__ */
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3813
|
+
/* @__PURE__ */ jsx10(
|
|
3814
|
+
ThinkingToggle,
|
|
3815
|
+
{
|
|
3816
|
+
enabled: thinkingEnabled,
|
|
3817
|
+
onChange: (next) => {
|
|
3818
|
+
setThinkingOverride({ sid: activeSessionId, val: next });
|
|
3819
|
+
setPreferredThinkingEnabled(next);
|
|
3820
|
+
}
|
|
3821
|
+
}
|
|
3822
|
+
),
|
|
3823
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2 px-3 py-2", children: [
|
|
3824
|
+
/* @__PURE__ */ jsx10(Sparkles2, { size: 13 }),
|
|
3825
|
+
/* @__PURE__ */ jsx10("span", { className: "shrink-0", children: "\u6A21\u578B" }),
|
|
3826
|
+
/* @__PURE__ */ jsx10(
|
|
3738
3827
|
ModelSelector,
|
|
3739
3828
|
{
|
|
3740
3829
|
value: selectedModel,
|
|
@@ -3752,7 +3841,7 @@ function ChatInput({
|
|
|
3752
3841
|
] })
|
|
3753
3842
|
] })
|
|
3754
3843
|
] }),
|
|
3755
|
-
/* @__PURE__ */
|
|
3844
|
+
/* @__PURE__ */ jsx10(
|
|
3756
3845
|
"button",
|
|
3757
3846
|
{
|
|
3758
3847
|
type: "button",
|
|
@@ -3762,23 +3851,23 @@ function ChatInput({
|
|
|
3762
3851
|
"aria-label": isPlanning ? "\u5173\u95ED\u89C4\u5212\u6A21\u5F0F" : "\u5F00\u542F\u89C4\u5212\u6A21\u5F0F",
|
|
3763
3852
|
title: isPlanning ? "\u89C4\u5212\u6A21\u5F0F\u5DF2\u5F00\u542F" : "\u5F00\u542F\u89C4\u5212\u6A21\u5F0F",
|
|
3764
3853
|
className: `flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border transition-colors ${isPlanning ? "border-amber-500/45 bg-amber-500/15 text-amber-400" : "border-[hsl(var(--border))] text-[hsl(var(--muted-foreground))] hover:border-amber-500/35 hover:text-[hsl(var(--foreground))]"} disabled:cursor-not-allowed disabled:opacity-50`,
|
|
3765
|
-
children: /* @__PURE__ */
|
|
3854
|
+
children: /* @__PURE__ */ jsx10(Lightbulb, { size: 13 })
|
|
3766
3855
|
}
|
|
3767
3856
|
)
|
|
3768
3857
|
] }),
|
|
3769
|
-
/* @__PURE__ */
|
|
3770
|
-
/* @__PURE__ */
|
|
3771
|
-
/* @__PURE__ */
|
|
3858
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1.5", children: [
|
|
3859
|
+
/* @__PURE__ */ jsxs9("div", { className: "group/help relative", children: [
|
|
3860
|
+
/* @__PURE__ */ jsx10(
|
|
3772
3861
|
"button",
|
|
3773
3862
|
{
|
|
3774
3863
|
type: "button",
|
|
3775
3864
|
"aria-label": "\u67E5\u770B\u8F93\u5165\u63D0\u793A",
|
|
3776
3865
|
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-lg text-[hsl(var(--muted-foreground))] transition-colors hover:text-[hsl(var(--foreground))]",
|
|
3777
|
-
children: /* @__PURE__ */
|
|
3866
|
+
children: /* @__PURE__ */ jsx10(CircleHelp, { size: 13 })
|
|
3778
3867
|
}
|
|
3779
3868
|
),
|
|
3780
|
-
/* @__PURE__ */
|
|
3781
|
-
activeSessionId ? /* @__PURE__ */
|
|
3869
|
+
/* @__PURE__ */ jsx10("div", { className: "pointer-events-auto absolute bottom-full right-0 z-30 hidden pb-2 group-hover/help:block group-focus-within/help:block", children: /* @__PURE__ */ jsxs9("div", { className: "min-w-64 rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--popover))] p-3 text-left text-[11px] leading-5 text-[hsl(var(--popover-foreground))] shadow-lg", children: [
|
|
3870
|
+
activeSessionId ? /* @__PURE__ */ jsx10("div", { className: "mb-2 border-b border-[hsl(var(--border))] pb-2", children: /* @__PURE__ */ jsx10(
|
|
3782
3871
|
SkillStatusBarComponent,
|
|
3783
3872
|
{
|
|
3784
3873
|
sessionId: activeSessionId,
|
|
@@ -3789,15 +3878,15 @@ function ChatInput({
|
|
|
3789
3878
|
innerClassName: skillStatusBarInnerClassName
|
|
3790
3879
|
}
|
|
3791
3880
|
) }) : null,
|
|
3792
|
-
/* @__PURE__ */
|
|
3793
|
-
/* @__PURE__ */
|
|
3794
|
-
/* @__PURE__ */
|
|
3795
|
-
/* @__PURE__ */
|
|
3796
|
-
composerHint && /* @__PURE__ */
|
|
3881
|
+
/* @__PURE__ */ jsxs9("div", { className: "space-y-0.5", children: [
|
|
3882
|
+
/* @__PURE__ */ jsx10("div", { children: "Shift+Enter \u6362\u884C" }),
|
|
3883
|
+
/* @__PURE__ */ jsx10("div", { children: "/ \u8C03\u7528\u6280\u80FD" }),
|
|
3884
|
+
/* @__PURE__ */ jsx10("div", { children: "@ \u5F15\u7528\u6587\u4EF6" }),
|
|
3885
|
+
composerHint && /* @__PURE__ */ jsx10("div", { children: composerHint })
|
|
3797
3886
|
] })
|
|
3798
3887
|
] }) })
|
|
3799
3888
|
] }),
|
|
3800
|
-
/* @__PURE__ */
|
|
3889
|
+
/* @__PURE__ */ jsx10(
|
|
3801
3890
|
"button",
|
|
3802
3891
|
{
|
|
3803
3892
|
type: "button",
|
|
@@ -3806,10 +3895,10 @@ function ChatInput({
|
|
|
3806
3895
|
"aria-label": !asrEnabled ? "\u8BED\u97F3\u8F93\u5165\u672A\u5F00\u542F" : isRecording ? "\u505C\u6B62\u8BED\u97F3\u8F93\u5165" : "\u5F00\u59CB\u8BED\u97F3\u8F93\u5165",
|
|
3807
3896
|
title: !asrEnabled ? "\u8BED\u97F3\u8F93\u5165\u672A\u5F00\u542F" : isRecording ? "\u505C\u6B62\u8BED\u97F3\u8F93\u5165" : "\u8BED\u97F3\u8F93\u5165",
|
|
3808
3897
|
className: `flex items-center justify-center rounded-lg border transition-[width,height,border-color,background-color,color,box-shadow] duration-300 disabled:opacity-40 ${!asrEnabled ? "h-7 w-7 border-[hsl(var(--border))] text-[hsl(var(--muted-foreground))]/50 hover:text-[hsl(var(--muted-foreground))]" : isRecording ? "h-9 w-9 border-emerald-400/80! bg-emerald-400/15 text-emerald-400 shadow-[0_0_0_2px_rgba(52,211,153,0.2),0_0_12px_rgba(52,211,153,0.35)]" : "h-7 w-7 border-[hsl(var(--border))] text-[hsl(var(--muted-foreground))] hover:border-[hsl(var(--ring))] hover:text-[hsl(var(--foreground))]"}`,
|
|
3809
|
-
children: !asrEnabled ? /* @__PURE__ */
|
|
3898
|
+
children: !asrEnabled ? /* @__PURE__ */ jsx10(MicOff, { size: 13 }) : isRecording ? /* @__PURE__ */ jsx10(VoiceWaveform, { level: voiceLevel, size: 18 }) : /* @__PURE__ */ jsx10(Mic, { size: 13 })
|
|
3810
3899
|
}
|
|
3811
3900
|
),
|
|
3812
|
-
isStreaming ? /* @__PURE__ */
|
|
3901
|
+
isStreaming ? /* @__PURE__ */ jsx10(
|
|
3813
3902
|
"button",
|
|
3814
3903
|
{
|
|
3815
3904
|
type: "button",
|
|
@@ -3817,9 +3906,9 @@ function ChatInput({
|
|
|
3817
3906
|
disabled: isStopping,
|
|
3818
3907
|
"aria-label": isStopping ? "\u6B63\u5728\u505C\u6B62" : "\u505C\u6B62\u751F\u6210",
|
|
3819
3908
|
className: "flex h-7 w-7 items-center justify-center rounded-lg bg-[hsl(var(--destructive))] text-[hsl(var(--destructive-foreground))] transition-opacity hover:opacity-80 disabled:cursor-wait disabled:opacity-70",
|
|
3820
|
-
children: isStopping ? /* @__PURE__ */
|
|
3909
|
+
children: isStopping ? /* @__PURE__ */ jsx10(Loader22, { size: 13, className: "animate-spin" }) : /* @__PURE__ */ jsx10(Square2, { size: 13 })
|
|
3821
3910
|
}
|
|
3822
|
-
) : /* @__PURE__ */
|
|
3911
|
+
) : /* @__PURE__ */ jsx10(
|
|
3823
3912
|
"button",
|
|
3824
3913
|
{
|
|
3825
3914
|
type: "button",
|
|
@@ -3828,7 +3917,7 @@ function ChatInput({
|
|
|
3828
3917
|
"aria-label": "\u53D1\u9001\u6D88\u606F",
|
|
3829
3918
|
title: isModelLoading ? "\u6B63\u5728\u52A0\u8F7D\u6A21\u578B\u914D\u7F6E" : !hasAvailableModel ? "\u6CA1\u6709\u53EF\u7528\u6A21\u578B\uFF0C\u8BF7\u68C0\u67E5\u6A21\u578B\u670D\u52A1\u914D\u7F6E" : "\u53D1\u9001\u6D88\u606F",
|
|
3830
3919
|
className: "flex h-7 w-7 items-center justify-center rounded-lg bg-[hsl(var(--primary))] text-[hsl(var(--primary-foreground))] transition-opacity hover:opacity-80 disabled:opacity-25",
|
|
3831
|
-
children: /* @__PURE__ */
|
|
3920
|
+
children: /* @__PURE__ */ jsx10(Send, { size: 13 })
|
|
3832
3921
|
}
|
|
3833
3922
|
)
|
|
3834
3923
|
] })
|
|
@@ -3839,7 +3928,7 @@ function ChatInput({
|
|
|
3839
3928
|
}
|
|
3840
3929
|
)
|
|
3841
3930
|
] }) }),
|
|
3842
|
-
/* @__PURE__ */
|
|
3931
|
+
/* @__PURE__ */ jsx10(
|
|
3843
3932
|
FileSizeLimitDialog,
|
|
3844
3933
|
{
|
|
3845
3934
|
open: oversizedFiles.length > 0,
|
|
@@ -3857,18 +3946,18 @@ function ChatInput({
|
|
|
3857
3946
|
|
|
3858
3947
|
// src/react/components/chat/ConnectionBanner.tsx
|
|
3859
3948
|
import { AlertTriangle, LoaderCircle } from "lucide-react";
|
|
3860
|
-
import { jsx as
|
|
3949
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3861
3950
|
function getBannerCopy(status, reconnectAttempt, hasEverConnected) {
|
|
3862
3951
|
if (status === "connecting") {
|
|
3863
3952
|
return {
|
|
3864
|
-
icon: /* @__PURE__ */
|
|
3953
|
+
icon: /* @__PURE__ */ jsx11(LoaderCircle, { size: 14, className: "animate-spin" }),
|
|
3865
3954
|
toneClass: "border-amber-500/25 bg-amber-500/10 text-amber-100",
|
|
3866
3955
|
title: "\u8FDE\u63A5\u5DF2\u65AD\u5F00\uFF0C\u6B63\u5728\u91CD\u8FDE\u2026",
|
|
3867
3956
|
detail: reconnectAttempt > 0 ? `\u6B63\u5728\u5C1D\u8BD5\u6062\u590D\u5B9E\u65F6\u8FDE\u63A5\uFF08\u7B2C ${reconnectAttempt} \u6B21\uFF09` : "\u6B63\u5728\u5C1D\u8BD5\u6062\u590D\u5B9E\u65F6\u8FDE\u63A5\uFF0C\u8BF7\u7A0D\u5019"
|
|
3868
3957
|
};
|
|
3869
3958
|
}
|
|
3870
3959
|
return {
|
|
3871
|
-
icon: /* @__PURE__ */
|
|
3960
|
+
icon: /* @__PURE__ */ jsx11(AlertTriangle, { size: 14 }),
|
|
3872
3961
|
toneClass: "border-rose-500/25 bg-rose-500/10 text-rose-100",
|
|
3873
3962
|
title: hasEverConnected ? "\u8FDE\u63A5\u5DF2\u65AD\u5F00\uFF0C\u6B63\u5728\u7B49\u5F85\u91CD\u8FDE\u2026" : "\u6682\u65F6\u65E0\u6CD5\u5EFA\u7ACB\u8FDE\u63A5",
|
|
3874
3963
|
detail: hasEverConnected ? "\u6D88\u606F\u540C\u6B65\u53EF\u80FD\u4F1A\u5EF6\u8FDF\uFF0C\u7CFB\u7EDF\u4F1A\u7EE7\u7EED\u81EA\u52A8\u91CD\u8BD5" : "\u8BF7\u68C0\u67E5\u670D\u52A1\u662F\u5426\u53EF\u7528\uFF0C\u7CFB\u7EDF\u4F1A\u7EE7\u7EED\u81EA\u52A8\u91CD\u8BD5"
|
|
@@ -3883,7 +3972,7 @@ function ConnectionBanner() {
|
|
|
3883
3972
|
return null;
|
|
3884
3973
|
}
|
|
3885
3974
|
const copy = getBannerCopy(status, reconnectAttempt, hasEverConnected);
|
|
3886
|
-
return /* @__PURE__ */
|
|
3975
|
+
return /* @__PURE__ */ jsx11("div", { className: "bg-[hsl(var(--background))] px-5 pt-3", children: /* @__PURE__ */ jsxs10(
|
|
3887
3976
|
"div",
|
|
3888
3977
|
{
|
|
3889
3978
|
className: cn(
|
|
@@ -3891,10 +3980,10 @@ function ConnectionBanner() {
|
|
|
3891
3980
|
copy.toneClass
|
|
3892
3981
|
),
|
|
3893
3982
|
children: [
|
|
3894
|
-
/* @__PURE__ */
|
|
3895
|
-
/* @__PURE__ */
|
|
3896
|
-
/* @__PURE__ */
|
|
3897
|
-
/* @__PURE__ */
|
|
3983
|
+
/* @__PURE__ */ jsx11("span", { className: "mt-0.5 shrink-0", children: copy.icon }),
|
|
3984
|
+
/* @__PURE__ */ jsxs10("div", { className: "min-w-0", children: [
|
|
3985
|
+
/* @__PURE__ */ jsx11("div", { className: "text-sm font-medium", children: copy.title }),
|
|
3986
|
+
/* @__PURE__ */ jsx11("div", { className: "text-xs opacity-80", children: copy.detail })
|
|
3898
3987
|
] })
|
|
3899
3988
|
]
|
|
3900
3989
|
}
|
|
@@ -4365,7 +4454,7 @@ import { Streamdown } from "streamdown";
|
|
|
4365
4454
|
// src/react/components/ai-elements/shimmer.tsx
|
|
4366
4455
|
import { motion } from "motion/react";
|
|
4367
4456
|
import { memo, useMemo as useMemo11 } from "react";
|
|
4368
|
-
import { jsx as
|
|
4457
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
4369
4458
|
var motionComponentCache = /* @__PURE__ */ new Map();
|
|
4370
4459
|
var getMotionComponent = (element) => {
|
|
4371
4460
|
let component = motionComponentCache.get(element);
|
|
@@ -4389,7 +4478,7 @@ var ShimmerComponent = ({
|
|
|
4389
4478
|
() => (children?.length ?? 0) * spread,
|
|
4390
4479
|
[children, spread]
|
|
4391
4480
|
);
|
|
4392
|
-
return /* @__PURE__ */
|
|
4481
|
+
return /* @__PURE__ */ jsx12(
|
|
4393
4482
|
MotionComponent,
|
|
4394
4483
|
{
|
|
4395
4484
|
animate: { backgroundPosition: "0% center" },
|
|
@@ -4415,7 +4504,7 @@ var ShimmerComponent = ({
|
|
|
4415
4504
|
var Shimmer = memo(ShimmerComponent);
|
|
4416
4505
|
|
|
4417
4506
|
// src/react/components/ai-elements/reasoning.tsx
|
|
4418
|
-
import { Fragment as Fragment3, jsx as
|
|
4507
|
+
import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4419
4508
|
var ReasoningContext = createContext2(null);
|
|
4420
4509
|
var useReasoning = () => {
|
|
4421
4510
|
const context = useContext2(ReasoningContext);
|
|
@@ -4466,7 +4555,7 @@ var Reasoning = memo2(
|
|
|
4466
4555
|
() => ({ duration, isOpen, isStreaming, setIsOpen }),
|
|
4467
4556
|
[duration, isOpen, isStreaming, setIsOpen]
|
|
4468
4557
|
);
|
|
4469
|
-
return /* @__PURE__ */
|
|
4558
|
+
return /* @__PURE__ */ jsx13(ReasoningContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx13(
|
|
4470
4559
|
Collapsible,
|
|
4471
4560
|
{
|
|
4472
4561
|
className: cn("not-prose", className),
|
|
@@ -4491,7 +4580,7 @@ var ReasoningTrigger = memo2(
|
|
|
4491
4580
|
const { isStreaming, isOpen, duration } = useReasoning();
|
|
4492
4581
|
const status = isStreaming || duration === 0 ? "\u6B63\u5728\u601D\u8003" : "\u5DF2\u601D\u8003";
|
|
4493
4582
|
const detail = `${formatWordCount(wordCount)} \u5B57`;
|
|
4494
|
-
return /* @__PURE__ */
|
|
4583
|
+
return /* @__PURE__ */ jsx13(
|
|
4495
4584
|
CollapsibleTrigger,
|
|
4496
4585
|
{
|
|
4497
4586
|
className: cn(
|
|
@@ -4499,16 +4588,16 @@ var ReasoningTrigger = memo2(
|
|
|
4499
4588
|
className
|
|
4500
4589
|
),
|
|
4501
4590
|
...props,
|
|
4502
|
-
children: children ?? /* @__PURE__ */
|
|
4503
|
-
/* @__PURE__ */
|
|
4504
|
-
/* @__PURE__ */
|
|
4505
|
-
isStreaming || duration === 0 ? /* @__PURE__ */
|
|
4506
|
-
/* @__PURE__ */
|
|
4591
|
+
children: children ?? /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
4592
|
+
/* @__PURE__ */ jsx13(BrainIcon, { className: "size-4" }),
|
|
4593
|
+
/* @__PURE__ */ jsxs11("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
4594
|
+
isStreaming || duration === 0 ? /* @__PURE__ */ jsx13(Shimmer, { duration: 1, children: status }) : /* @__PURE__ */ jsx13("span", { children: status }),
|
|
4595
|
+
/* @__PURE__ */ jsxs11("span", { className: "text-[hsl(var(--muted-foreground))]/70", children: [
|
|
4507
4596
|
"\xB7 ",
|
|
4508
4597
|
detail
|
|
4509
4598
|
] })
|
|
4510
4599
|
] }),
|
|
4511
|
-
/* @__PURE__ */
|
|
4600
|
+
/* @__PURE__ */ jsx13(
|
|
4512
4601
|
ChevronDownIcon,
|
|
4513
4602
|
{
|
|
4514
4603
|
className: cn(
|
|
@@ -4525,7 +4614,7 @@ var ReasoningTrigger = memo2(
|
|
|
4525
4614
|
var streamdownPlugins = { cjk, math, mermaid };
|
|
4526
4615
|
var streamdownComponents = { code: CardCodeBlock };
|
|
4527
4616
|
var ReasoningContent = memo2(
|
|
4528
|
-
({ className, children, ...props }) => /* @__PURE__ */
|
|
4617
|
+
({ className, children, ...props }) => /* @__PURE__ */ jsx13(
|
|
4529
4618
|
CollapsibleContent,
|
|
4530
4619
|
{
|
|
4531
4620
|
className: cn(
|
|
@@ -4534,7 +4623,7 @@ var ReasoningContent = memo2(
|
|
|
4534
4623
|
className
|
|
4535
4624
|
),
|
|
4536
4625
|
...props,
|
|
4537
|
-
children: /* @__PURE__ */
|
|
4626
|
+
children: /* @__PURE__ */ jsx13(Streamdown, { components: streamdownComponents, plugins: streamdownPlugins, children })
|
|
4538
4627
|
}
|
|
4539
4628
|
)
|
|
4540
4629
|
);
|
|
@@ -4544,7 +4633,7 @@ function compactReasoningText(text) {
|
|
|
4544
4633
|
function ThinkingBadge({ reasoning, variant = "inline", onClick }) {
|
|
4545
4634
|
const compactReasoning = compactReasoningText(reasoning);
|
|
4546
4635
|
const [open, setOpen] = useState10(false);
|
|
4547
|
-
return /* @__PURE__ */
|
|
4636
|
+
return /* @__PURE__ */ jsxs11(
|
|
4548
4637
|
"span",
|
|
4549
4638
|
{
|
|
4550
4639
|
className: cn(
|
|
@@ -4552,7 +4641,7 @@ function ThinkingBadge({ reasoning, variant = "inline", onClick }) {
|
|
|
4552
4641
|
variant === "inline" ? "ml-1" : "ml-1 shrink-0"
|
|
4553
4642
|
),
|
|
4554
4643
|
children: [
|
|
4555
|
-
/* @__PURE__ */
|
|
4644
|
+
/* @__PURE__ */ jsx13(
|
|
4556
4645
|
"button",
|
|
4557
4646
|
{
|
|
4558
4647
|
type: "button",
|
|
@@ -4567,7 +4656,7 @@ function ThinkingBadge({ reasoning, variant = "inline", onClick }) {
|
|
|
4567
4656
|
}
|
|
4568
4657
|
),
|
|
4569
4658
|
open ? createPortal2(
|
|
4570
|
-
/* @__PURE__ */
|
|
4659
|
+
/* @__PURE__ */ jsx13(
|
|
4571
4660
|
"div",
|
|
4572
4661
|
{
|
|
4573
4662
|
className: "fixed inset-0 z-[70] flex items-center justify-center bg-black/10 p-6",
|
|
@@ -4583,26 +4672,26 @@ function ThinkingBadge({ reasoning, variant = "inline", onClick }) {
|
|
|
4583
4672
|
setOpen(false);
|
|
4584
4673
|
}
|
|
4585
4674
|
},
|
|
4586
|
-
children: /* @__PURE__ */
|
|
4675
|
+
children: /* @__PURE__ */ jsxs11(
|
|
4587
4676
|
"div",
|
|
4588
4677
|
{
|
|
4589
4678
|
className: "m-0 flex max-h-[min(520px,calc(100vh-48px))] w-[min(760px,calc(100vw-48px))] flex-col overflow-hidden rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--popover))] text-left text-[13px] leading-6 text-[hsl(var(--popover-foreground))] shadow-xl",
|
|
4590
4679
|
"aria-label": "\u601D\u8003\u8BE6\u60C5",
|
|
4591
4680
|
children: [
|
|
4592
|
-
/* @__PURE__ */
|
|
4593
|
-
/* @__PURE__ */
|
|
4594
|
-
/* @__PURE__ */
|
|
4681
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-3 border-b border-[hsl(var(--border))] px-4 py-2", children: [
|
|
4682
|
+
/* @__PURE__ */ jsx13("span", { className: "text-xs font-medium text-[hsl(var(--muted-foreground))]", children: "\u601D\u8003\u8BE6\u60C5" }),
|
|
4683
|
+
/* @__PURE__ */ jsx13(
|
|
4595
4684
|
"button",
|
|
4596
4685
|
{
|
|
4597
4686
|
type: "button",
|
|
4598
4687
|
onClick: () => setOpen(false),
|
|
4599
4688
|
className: "inline-flex h-6 w-6 items-center justify-center rounded-md text-[hsl(var(--muted-foreground))] transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))] focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
4600
4689
|
"aria-label": "\u5173\u95ED\u601D\u8003\u8BE6\u60C5",
|
|
4601
|
-
children: /* @__PURE__ */
|
|
4690
|
+
children: /* @__PURE__ */ jsx13(XIcon, { size: 14, "aria-hidden": "true" })
|
|
4602
4691
|
}
|
|
4603
4692
|
)
|
|
4604
4693
|
] }),
|
|
4605
|
-
/* @__PURE__ */
|
|
4694
|
+
/* @__PURE__ */ jsx13("div", { className: "overflow-auto px-4 py-3 whitespace-normal [&_*]:whitespace-normal [&_p]:my-1.5 [&_p:first-child]:mt-0 [&_p:last-child]:mb-0 [&_ul]:my-1.5 [&_ol]:my-1.5", children: /* @__PURE__ */ jsx13(Streamdown, { components: streamdownComponents, plugins: streamdownPlugins, children: compactReasoning }) })
|
|
4606
4695
|
]
|
|
4607
4696
|
}
|
|
4608
4697
|
)
|
|
@@ -4624,7 +4713,7 @@ import { useEffect as useEffect14, useMemo as useMemo15, useState as useState17
|
|
|
4624
4713
|
|
|
4625
4714
|
// src/react/components/chat/ResourceIframe.tsx
|
|
4626
4715
|
import { useEffect as useEffect10, useEffectEvent as useEffectEvent3, useRef as useRef9, useState as useState11 } from "react";
|
|
4627
|
-
import { jsx as
|
|
4716
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
4628
4717
|
function isResourceBridgeMessage(value) {
|
|
4629
4718
|
return typeof value === "object" && value !== null && value.__resourceBridge === true && typeof value.action === "string";
|
|
4630
4719
|
}
|
|
@@ -4731,7 +4820,7 @@ function ResourceIframe({ ui, sessionId }) {
|
|
|
4731
4820
|
const inlineHeight = autoHeight ?? ui.height;
|
|
4732
4821
|
const sandbox = resourceUri ? "allow-scripts allow-same-origin" : "allow-scripts";
|
|
4733
4822
|
const srcDoc = ui.resourceHTML ? injectBaseTag(ui.resourceHTML) : void 0;
|
|
4734
|
-
return /* @__PURE__ */
|
|
4823
|
+
return /* @__PURE__ */ jsx14(
|
|
4735
4824
|
"iframe",
|
|
4736
4825
|
{
|
|
4737
4826
|
ref: iframeRef,
|
|
@@ -4770,7 +4859,7 @@ import { Check as Check2, ChevronRight as ChevronRight3, Loader2 as Loader23, Me
|
|
|
4770
4859
|
import { useMemo as useMemo13, useState as useState14 } from "react";
|
|
4771
4860
|
|
|
4772
4861
|
// src/react/components/chat/tool-renderers/shared.tsx
|
|
4773
|
-
import { jsx as
|
|
4862
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
4774
4863
|
function getResultText(result) {
|
|
4775
4864
|
if (typeof result === "string") return result;
|
|
4776
4865
|
if (Array.isArray(result)) {
|
|
@@ -4837,7 +4926,7 @@ function CodePreview({
|
|
|
4837
4926
|
}) {
|
|
4838
4927
|
const { highlightedHtml } = useHighlightedCodeHtml(content, getCodeLanguage(filePath));
|
|
4839
4928
|
if (!content.trim()) {
|
|
4840
|
-
return /* @__PURE__ */
|
|
4929
|
+
return /* @__PURE__ */ jsx15(
|
|
4841
4930
|
"pre",
|
|
4842
4931
|
{
|
|
4843
4932
|
className: cn(
|
|
@@ -4845,11 +4934,11 @@ function CodePreview({
|
|
|
4845
4934
|
"bg-[hsl(var(--muted))]/35 p-3 font-mono text-[11px] text-[hsl(var(--muted-foreground))]",
|
|
4846
4935
|
className
|
|
4847
4936
|
),
|
|
4848
|
-
children: /* @__PURE__ */
|
|
4937
|
+
children: /* @__PURE__ */ jsx15("code", { children: emptyLabel })
|
|
4849
4938
|
}
|
|
4850
4939
|
);
|
|
4851
4940
|
}
|
|
4852
|
-
return /* @__PURE__ */
|
|
4941
|
+
return /* @__PURE__ */ jsx15(
|
|
4853
4942
|
"pre",
|
|
4854
4943
|
{
|
|
4855
4944
|
className: cn(
|
|
@@ -4857,19 +4946,19 @@ function CodePreview({
|
|
|
4857
4946
|
"bg-[hsl(var(--muted))]/35 p-3 text-[11px]",
|
|
4858
4947
|
className
|
|
4859
4948
|
),
|
|
4860
|
-
children: highlightedHtml ? /* @__PURE__ */
|
|
4949
|
+
children: highlightedHtml ? /* @__PURE__ */ jsx15(
|
|
4861
4950
|
"code",
|
|
4862
4951
|
{
|
|
4863
4952
|
className: "font-mono",
|
|
4864
4953
|
dangerouslySetInnerHTML: { __html: highlightedHtml }
|
|
4865
4954
|
}
|
|
4866
|
-
) : /* @__PURE__ */
|
|
4955
|
+
) : /* @__PURE__ */ jsx15("code", { className: "whitespace-pre-wrap break-words font-mono text-[hsl(var(--foreground))]", children: content })
|
|
4867
4956
|
}
|
|
4868
4957
|
);
|
|
4869
4958
|
}
|
|
4870
4959
|
|
|
4871
4960
|
// src/react/components/chat/tool-renderers/BashRenderer.tsx
|
|
4872
|
-
import { jsx as
|
|
4961
|
+
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4873
4962
|
function pickOutputField(data) {
|
|
4874
4963
|
if (!data) return null;
|
|
4875
4964
|
for (const key of ["output", "stdout", "stderr"]) {
|
|
@@ -4879,7 +4968,7 @@ function pickOutputField(data) {
|
|
|
4879
4968
|
return null;
|
|
4880
4969
|
}
|
|
4881
4970
|
function MetaPill({ label }) {
|
|
4882
|
-
return /* @__PURE__ */
|
|
4971
|
+
return /* @__PURE__ */ jsx16("span", { className: "rounded-full border border-border bg-muted px-2 py-0.5 text-[10px] text-secondary-foreground", children: label });
|
|
4883
4972
|
}
|
|
4884
4973
|
function BashRenderer({ toolCall }) {
|
|
4885
4974
|
const argsValue = parseJsonValue(toolCall.arguments);
|
|
@@ -4902,16 +4991,16 @@ function BashRenderer({ toolCall }) {
|
|
|
4902
4991
|
const rawFallbackOutput = result === null && typeof resultStr === "string" && resultStr.trim().length > 0 ? resultStr : null;
|
|
4903
4992
|
const output = structuredOutput !== null ? structuredOutput : errorMessage ?? rawFallbackOutput ?? (normalizedName === "BgBash" ? "" : null);
|
|
4904
4993
|
const hasFailure = toolCall.status === "error" || timedOut || exitCode !== null && exitCode !== 0;
|
|
4905
|
-
return /* @__PURE__ */
|
|
4906
|
-
(description || cwd) && /* @__PURE__ */
|
|
4907
|
-
description ? /* @__PURE__ */
|
|
4908
|
-
cwd ? /* @__PURE__ */
|
|
4994
|
+
return /* @__PURE__ */ jsxs12("div", { className: "space-y-3", children: [
|
|
4995
|
+
(description || cwd) && /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
4996
|
+
description ? /* @__PURE__ */ jsx16("span", { children: description }) : null,
|
|
4997
|
+
cwd ? /* @__PURE__ */ jsx16("span", { className: "rounded-full bg-[hsl(var(--muted))] px-2 py-0.5 font-mono", children: cwd }) : null
|
|
4909
4998
|
] }),
|
|
4910
|
-
/* @__PURE__ */
|
|
4911
|
-
/* @__PURE__ */
|
|
4912
|
-
/* @__PURE__ */
|
|
4999
|
+
/* @__PURE__ */ jsxs12("div", { className: "overflow-hidden rounded-lg border border-border bg-card", children: [
|
|
5000
|
+
/* @__PURE__ */ jsx16("div", { className: "border-b border-border px-3 py-2 text-[10px] uppercase tracking-[0.16em] text-muted-foreground", children: "\u547D\u4EE4" }),
|
|
5001
|
+
/* @__PURE__ */ jsx16("pre", { className: "overflow-x-auto px-3 py-3 font-mono text-[11px] leading-5 text-foreground", children: /* @__PURE__ */ jsx16("code", { children: `$ ${command || "\uFF08\u672A\u63D0\u4F9B\u547D\u4EE4\uFF09"}` }) })
|
|
4913
5002
|
] }),
|
|
4914
|
-
/* @__PURE__ */
|
|
5003
|
+
/* @__PURE__ */ jsxs12(
|
|
4915
5004
|
"div",
|
|
4916
5005
|
{
|
|
4917
5006
|
className: cn(
|
|
@@ -4919,26 +5008,26 @@ function BashRenderer({ toolCall }) {
|
|
|
4919
5008
|
hasFailure ? "border-red-500/50" : "border-border"
|
|
4920
5009
|
),
|
|
4921
5010
|
children: [
|
|
4922
|
-
/* @__PURE__ */
|
|
4923
|
-
/* @__PURE__ */
|
|
4924
|
-
/* @__PURE__ */
|
|
4925
|
-
taskId ? /* @__PURE__ */
|
|
4926
|
-
exitCode !== null ? /* @__PURE__ */
|
|
4927
|
-
timedOut ? /* @__PURE__ */
|
|
4928
|
-
truncated ? /* @__PURE__ */
|
|
4929
|
-
normalizedName === "BgBash" && !taskId ? /* @__PURE__ */
|
|
5011
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center justify-between gap-2 border-b border-border px-3 py-2", children: [
|
|
5012
|
+
/* @__PURE__ */ jsx16("div", { className: "text-[10px] uppercase tracking-[0.16em] text-muted-foreground", children: "\u8F93\u51FA" }),
|
|
5013
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
5014
|
+
taskId ? /* @__PURE__ */ jsx16(MetaPill, { label: `\u4EFB\u52A1 ${taskId}` }) : null,
|
|
5015
|
+
exitCode !== null ? /* @__PURE__ */ jsx16(MetaPill, { label: `\u9000\u51FA\u7801 ${exitCode}` }) : null,
|
|
5016
|
+
timedOut ? /* @__PURE__ */ jsx16(MetaPill, { label: "\u5DF2\u8D85\u65F6" }) : null,
|
|
5017
|
+
truncated ? /* @__PURE__ */ jsx16(MetaPill, { label: "\u8F93\u51FA\u5DF2\u622A\u65AD" }) : null,
|
|
5018
|
+
normalizedName === "BgBash" && !taskId ? /* @__PURE__ */ jsx16(MetaPill, { label: "\u540E\u53F0\u4EFB\u52A1" }) : null
|
|
4930
5019
|
] })
|
|
4931
5020
|
] }),
|
|
4932
|
-
/* @__PURE__ */
|
|
5021
|
+
/* @__PURE__ */ jsx16("pre", { className: "max-h-[280px] overflow-auto px-3 py-3 font-mono text-[11px] leading-5 text-foreground", children: /* @__PURE__ */ jsx16("code", { className: "whitespace-pre-wrap break-words", children: output !== null && output.trim().length > 0 ? output : normalizedName === "BgBash" ? "\u4EFB\u52A1\u5DF2\u8FDB\u5165\u540E\u53F0\u6267\u884C\uFF0C\u8F93\u51FA\u4F1A\u5728\u540E\u53F0\u4EFB\u52A1\u9762\u677F\u4E2D\u7EE7\u7EED\u66F4\u65B0\u3002" : output !== null && output.trim().length === 0 && hasFailure ? "\u547D\u4EE4\u5DF2\u7ED3\u675F\uFF0C\u4F46\u672A\u6355\u83B7\u5230\u7EC8\u7AEF\u8F93\u51FA\uFF08\u8BF7\u67E5\u770B\u9000\u51FA\u7801\uFF09\u3002" : "\u547D\u4EE4\u672A\u8FD4\u56DE\u8F93\u51FA\u3002" }) })
|
|
4933
5022
|
]
|
|
4934
5023
|
}
|
|
4935
5024
|
),
|
|
4936
|
-
cwdResetNote ? /* @__PURE__ */
|
|
5025
|
+
cwdResetNote ? /* @__PURE__ */ jsx16("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/35 px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: cwdResetNote }) : null
|
|
4937
5026
|
] });
|
|
4938
5027
|
}
|
|
4939
5028
|
|
|
4940
5029
|
// src/react/components/chat/tool-renderers/FileEditRenderer.tsx
|
|
4941
|
-
import { jsx as
|
|
5030
|
+
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4942
5031
|
var MAX_DIFF_LINES = 200;
|
|
4943
5032
|
function computeDiff(oldText, newText) {
|
|
4944
5033
|
const oldLines = oldText.split("\n");
|
|
@@ -5053,21 +5142,21 @@ function FileEditRenderer({ toolCall }) {
|
|
|
5053
5142
|
const diffLines = normalizedName === "Write" ? buildWritePreview(writeContent) : buildEditPreview(args);
|
|
5054
5143
|
const resultStr = typeof toolCall.result === "string" ? toolCall.result : null;
|
|
5055
5144
|
const summaryText = resultStr?.trim() && !errorMessage ? resultStr.trim() : null;
|
|
5056
|
-
return /* @__PURE__ */
|
|
5057
|
-
/* @__PURE__ */
|
|
5058
|
-
/* @__PURE__ */
|
|
5059
|
-
/* @__PURE__ */
|
|
5060
|
-
/* @__PURE__ */
|
|
5145
|
+
return /* @__PURE__ */ jsxs13("div", { className: "space-y-3", children: [
|
|
5146
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-start justify-between gap-3", children: [
|
|
5147
|
+
/* @__PURE__ */ jsxs13("div", { className: "min-w-0", children: [
|
|
5148
|
+
/* @__PURE__ */ jsx17("div", { className: "text-[10px] uppercase tracking-[0.16em] text-[hsl(var(--muted-foreground))]", children: normalizedName === "Write" ? "\u5199\u5165\u6587\u4EF6" : "\u7F16\u8F91\u6587\u4EF6" }),
|
|
5149
|
+
/* @__PURE__ */ jsx17("div", { className: "truncate font-mono text-[11px] text-[hsl(var(--foreground))]", children: filePath ?? fileName })
|
|
5061
5150
|
] }),
|
|
5062
|
-
checksum ? /* @__PURE__ */
|
|
5151
|
+
checksum ? /* @__PURE__ */ jsx17("span", { className: "rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--muted))] px-2 py-0.5 font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: checksum }) : null
|
|
5063
5152
|
] }),
|
|
5064
|
-
description ? /* @__PURE__ */
|
|
5065
|
-
errorMessage ? /* @__PURE__ */
|
|
5066
|
-
/* @__PURE__ */
|
|
5067
|
-
/* @__PURE__ */
|
|
5068
|
-
/* @__PURE__ */
|
|
5153
|
+
description ? /* @__PURE__ */ jsx17("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/35 px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: description }) : null,
|
|
5154
|
+
errorMessage ? /* @__PURE__ */ jsx17("div", { className: "rounded-lg border border-red-500/30 bg-red-500/8 px-3 py-2 text-[11px] text-red-300", children: errorMessage }) : null,
|
|
5155
|
+
/* @__PURE__ */ jsxs13("div", { className: "overflow-hidden rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20", children: [
|
|
5156
|
+
/* @__PURE__ */ jsx17("div", { className: "border-b border-[hsl(var(--border))] px-3 py-2 text-[10px] uppercase tracking-[0.16em] text-[hsl(var(--muted-foreground))]", children: normalizedName === "Write" ? "\u5185\u5BB9\u9884\u89C8" : "\u53D8\u66F4\u9884\u89C8" }),
|
|
5157
|
+
/* @__PURE__ */ jsx17("pre", { className: "max-h-[320px] overflow-auto p-0 font-mono text-[11px] leading-5", children: diffLines.length > 0 ? diffLines.map((line, index) => {
|
|
5069
5158
|
const prefix = line.type === "added" ? "+ " : line.type === "removed" ? "- " : " ";
|
|
5070
|
-
return /* @__PURE__ */
|
|
5159
|
+
return /* @__PURE__ */ jsxs13(
|
|
5071
5160
|
"div",
|
|
5072
5161
|
{
|
|
5073
5162
|
className: cn(
|
|
@@ -5077,9 +5166,9 @@ function FileEditRenderer({ toolCall }) {
|
|
|
5077
5166
|
line.type === "unchanged" && "text-[hsl(var(--foreground))]"
|
|
5078
5167
|
),
|
|
5079
5168
|
children: [
|
|
5080
|
-
/* @__PURE__ */
|
|
5081
|
-
/* @__PURE__ */
|
|
5082
|
-
/* @__PURE__ */
|
|
5169
|
+
/* @__PURE__ */ jsx17("span", { className: "select-none py-0.5 text-right text-[10px] text-[hsl(var(--muted-foreground))]", children: line.oldLine ?? "" }),
|
|
5170
|
+
/* @__PURE__ */ jsx17("span", { className: "select-none py-0.5 text-right text-[10px] text-[hsl(var(--muted-foreground))]", children: line.newLine ?? "" }),
|
|
5171
|
+
/* @__PURE__ */ jsxs13("span", { className: "min-w-0 whitespace-pre-wrap break-words py-0.5", children: [
|
|
5083
5172
|
prefix,
|
|
5084
5173
|
line.value
|
|
5085
5174
|
] })
|
|
@@ -5087,9 +5176,9 @@ function FileEditRenderer({ toolCall }) {
|
|
|
5087
5176
|
},
|
|
5088
5177
|
`${line.type}-${line.oldLine}-${line.newLine}-${index}`
|
|
5089
5178
|
);
|
|
5090
|
-
}) : /* @__PURE__ */
|
|
5179
|
+
}) : /* @__PURE__ */ jsx17("div", { className: "px-3 py-4 text-[11px] text-[hsl(var(--muted-foreground))]", children: "\u672A\u68C0\u6D4B\u5230\u53EF\u9884\u89C8\u7684\u53D8\u66F4\u3002" }) })
|
|
5091
5180
|
] }),
|
|
5092
|
-
summaryText ? /* @__PURE__ */
|
|
5181
|
+
summaryText ? /* @__PURE__ */ jsx17("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/35 px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: summaryText }) : null
|
|
5093
5182
|
] });
|
|
5094
5183
|
}
|
|
5095
5184
|
|
|
@@ -5100,7 +5189,7 @@ import { useState as useState13 } from "react";
|
|
|
5100
5189
|
import { ChevronLeft, ChevronRight as ChevronRight2, Download as Download2, ExternalLink, Minus, Plus as Plus2, RotateCcw as RotateCcw2, X as X3 } from "lucide-react";
|
|
5101
5190
|
import { useCallback as useCallback10, useEffect as useEffect11, useRef as useRef10, useState as useState12 } from "react";
|
|
5102
5191
|
import { createPortal as createPortal3 } from "react-dom";
|
|
5103
|
-
import { Fragment as Fragment4, jsx as
|
|
5192
|
+
import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5104
5193
|
function ImageLightbox({ open, onOpenChange, images, initialIndex = 0 }) {
|
|
5105
5194
|
const [currentIndex, setCurrentIndex] = useState12(initialIndex);
|
|
5106
5195
|
const [scale, setScale] = useState12(1);
|
|
@@ -5210,22 +5299,22 @@ function ImageLightbox({ open, onOpenChange, images, initialIndex = 0 }) {
|
|
|
5210
5299
|
if (images.length === 0) {
|
|
5211
5300
|
return createPortal3(
|
|
5212
5301
|
// biome-ignore lint/a11y/useKeyWithClickEvents: ESC handler is registered via useEffect
|
|
5213
|
-
/* @__PURE__ */
|
|
5302
|
+
/* @__PURE__ */ jsxs14(
|
|
5214
5303
|
"div",
|
|
5215
5304
|
{
|
|
5216
5305
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/80",
|
|
5217
5306
|
onClick: close,
|
|
5218
5307
|
children: [
|
|
5219
|
-
/* @__PURE__ */
|
|
5308
|
+
/* @__PURE__ */ jsx18(
|
|
5220
5309
|
"button",
|
|
5221
5310
|
{
|
|
5222
5311
|
type: "button",
|
|
5223
5312
|
onClick: close,
|
|
5224
5313
|
className: "absolute right-4 top-4 z-10 rounded-full bg-black/50 p-2 text-white/80 transition-colors hover:bg-black/70 hover:text-white",
|
|
5225
|
-
children: /* @__PURE__ */
|
|
5314
|
+
children: /* @__PURE__ */ jsx18(X3, { size: 20 })
|
|
5226
5315
|
}
|
|
5227
5316
|
),
|
|
5228
|
-
/* @__PURE__ */
|
|
5317
|
+
/* @__PURE__ */ jsx18("span", { className: "text-sm text-white/60", children: "\u52A0\u8F7D\u4E2D..." })
|
|
5229
5318
|
]
|
|
5230
5319
|
}
|
|
5231
5320
|
),
|
|
@@ -5236,46 +5325,46 @@ function ImageLightbox({ open, onOpenChange, images, initialIndex = 0 }) {
|
|
|
5236
5325
|
const showNav = images.length > 1;
|
|
5237
5326
|
return createPortal3(
|
|
5238
5327
|
// biome-ignore lint/a11y/useKeyWithClickEvents: ESC handler is registered via useEffect
|
|
5239
|
-
/* @__PURE__ */
|
|
5240
|
-
/* @__PURE__ */
|
|
5328
|
+
/* @__PURE__ */ jsxs14("div", { className: "fixed inset-0 z-50 bg-black/80", onClick: handleAreaClick, children: [
|
|
5329
|
+
/* @__PURE__ */ jsxs14(
|
|
5241
5330
|
"div",
|
|
5242
5331
|
{
|
|
5243
5332
|
className: "absolute right-4 top-4 z-10 flex items-center gap-1.5",
|
|
5244
5333
|
onClick: (e) => e.stopPropagation(),
|
|
5245
5334
|
children: [
|
|
5246
|
-
/* @__PURE__ */
|
|
5335
|
+
/* @__PURE__ */ jsx18(
|
|
5247
5336
|
"button",
|
|
5248
5337
|
{
|
|
5249
5338
|
type: "button",
|
|
5250
5339
|
onClick: handleDownload,
|
|
5251
5340
|
title: "\u4E0B\u8F7D\u56FE\u7247",
|
|
5252
5341
|
className: "rounded-full bg-black/50 p-2 text-white/80 transition-colors hover:bg-black/70 hover:text-white",
|
|
5253
|
-
children: /* @__PURE__ */
|
|
5342
|
+
children: /* @__PURE__ */ jsx18(Download2, { size: 18 })
|
|
5254
5343
|
}
|
|
5255
5344
|
),
|
|
5256
|
-
/* @__PURE__ */
|
|
5345
|
+
/* @__PURE__ */ jsx18(
|
|
5257
5346
|
"button",
|
|
5258
5347
|
{
|
|
5259
5348
|
type: "button",
|
|
5260
5349
|
onClick: handleOpenInNewTab,
|
|
5261
5350
|
title: "\u65B0\u6807\u7B7E\u9875\u6253\u5F00",
|
|
5262
5351
|
className: "rounded-full bg-black/50 p-2 text-white/80 transition-colors hover:bg-black/70 hover:text-white",
|
|
5263
|
-
children: /* @__PURE__ */
|
|
5352
|
+
children: /* @__PURE__ */ jsx18(ExternalLink, { size: 18 })
|
|
5264
5353
|
}
|
|
5265
5354
|
),
|
|
5266
|
-
/* @__PURE__ */
|
|
5355
|
+
/* @__PURE__ */ jsx18(
|
|
5267
5356
|
"button",
|
|
5268
5357
|
{
|
|
5269
5358
|
type: "button",
|
|
5270
5359
|
onClick: close,
|
|
5271
5360
|
className: "rounded-full bg-black/50 p-2 text-white/80 transition-colors hover:bg-black/70 hover:text-white",
|
|
5272
|
-
children: /* @__PURE__ */
|
|
5361
|
+
children: /* @__PURE__ */ jsx18(X3, { size: 20 })
|
|
5273
5362
|
}
|
|
5274
5363
|
)
|
|
5275
5364
|
]
|
|
5276
5365
|
}
|
|
5277
5366
|
),
|
|
5278
|
-
showNav && currentIndex > 0 && /* @__PURE__ */
|
|
5367
|
+
showNav && currentIndex > 0 && /* @__PURE__ */ jsx18(
|
|
5279
5368
|
"button",
|
|
5280
5369
|
{
|
|
5281
5370
|
type: "button",
|
|
@@ -5284,10 +5373,10 @@ function ImageLightbox({ open, onOpenChange, images, initialIndex = 0 }) {
|
|
|
5284
5373
|
goPrev();
|
|
5285
5374
|
},
|
|
5286
5375
|
className: "absolute left-4 top-1/2 z-10 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white/80 transition-colors hover:bg-black/70 hover:text-white",
|
|
5287
|
-
children: /* @__PURE__ */
|
|
5376
|
+
children: /* @__PURE__ */ jsx18(ChevronLeft, { size: 24 })
|
|
5288
5377
|
}
|
|
5289
5378
|
),
|
|
5290
|
-
showNav && currentIndex < images.length - 1 && /* @__PURE__ */
|
|
5379
|
+
showNav && currentIndex < images.length - 1 && /* @__PURE__ */ jsx18(
|
|
5291
5380
|
"button",
|
|
5292
5381
|
{
|
|
5293
5382
|
type: "button",
|
|
@@ -5296,51 +5385,51 @@ function ImageLightbox({ open, onOpenChange, images, initialIndex = 0 }) {
|
|
|
5296
5385
|
goNext();
|
|
5297
5386
|
},
|
|
5298
5387
|
className: "absolute right-4 top-1/2 z-10 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white/80 transition-colors hover:bg-black/70 hover:text-white",
|
|
5299
|
-
children: /* @__PURE__ */
|
|
5388
|
+
children: /* @__PURE__ */ jsx18(ChevronRight2, { size: 24 })
|
|
5300
5389
|
}
|
|
5301
5390
|
),
|
|
5302
|
-
/* @__PURE__ */
|
|
5303
|
-
/* @__PURE__ */
|
|
5391
|
+
/* @__PURE__ */ jsxs14("div", { className: "absolute bottom-6 left-1/2 z-10 flex -translate-x-1/2 items-center gap-1 rounded-full bg-black/50 px-2 py-1", children: [
|
|
5392
|
+
/* @__PURE__ */ jsx18(
|
|
5304
5393
|
"button",
|
|
5305
5394
|
{
|
|
5306
5395
|
type: "button",
|
|
5307
5396
|
onClick: zoomOut,
|
|
5308
5397
|
className: "rounded-full p-1.5 text-white/80 transition-colors hover:bg-white/10 hover:text-white",
|
|
5309
|
-
children: /* @__PURE__ */
|
|
5398
|
+
children: /* @__PURE__ */ jsx18(Minus, { size: 16 })
|
|
5310
5399
|
}
|
|
5311
5400
|
),
|
|
5312
|
-
/* @__PURE__ */
|
|
5401
|
+
/* @__PURE__ */ jsxs14("span", { className: "min-w-[3rem] text-center text-xs text-white/80", children: [
|
|
5313
5402
|
Math.round(scale * 100),
|
|
5314
5403
|
"%"
|
|
5315
5404
|
] }),
|
|
5316
|
-
/* @__PURE__ */
|
|
5405
|
+
/* @__PURE__ */ jsx18(
|
|
5317
5406
|
"button",
|
|
5318
5407
|
{
|
|
5319
5408
|
type: "button",
|
|
5320
5409
|
onClick: zoomIn,
|
|
5321
5410
|
className: "rounded-full p-1.5 text-white/80 transition-colors hover:bg-white/10 hover:text-white",
|
|
5322
|
-
children: /* @__PURE__ */
|
|
5411
|
+
children: /* @__PURE__ */ jsx18(Plus2, { size: 16 })
|
|
5323
5412
|
}
|
|
5324
5413
|
),
|
|
5325
|
-
/* @__PURE__ */
|
|
5414
|
+
/* @__PURE__ */ jsx18(
|
|
5326
5415
|
"button",
|
|
5327
5416
|
{
|
|
5328
5417
|
type: "button",
|
|
5329
5418
|
onClick: reset,
|
|
5330
5419
|
className: "rounded-full p-1.5 text-white/80 transition-colors hover:bg-white/10 hover:text-white",
|
|
5331
|
-
children: /* @__PURE__ */
|
|
5420
|
+
children: /* @__PURE__ */ jsx18(RotateCcw2, { size: 16 })
|
|
5332
5421
|
}
|
|
5333
5422
|
),
|
|
5334
|
-
showNav && /* @__PURE__ */
|
|
5335
|
-
/* @__PURE__ */
|
|
5336
|
-
/* @__PURE__ */
|
|
5423
|
+
showNav && /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
5424
|
+
/* @__PURE__ */ jsx18("div", { className: "mx-1 h-4 w-px bg-white/20" }),
|
|
5425
|
+
/* @__PURE__ */ jsxs14("span", { className: "min-w-[3rem] text-center text-xs text-white/80", children: [
|
|
5337
5426
|
currentIndex + 1,
|
|
5338
5427
|
" / ",
|
|
5339
5428
|
images.length
|
|
5340
5429
|
] })
|
|
5341
5430
|
] })
|
|
5342
5431
|
] }),
|
|
5343
|
-
/* @__PURE__ */
|
|
5432
|
+
/* @__PURE__ */ jsx18(
|
|
5344
5433
|
"div",
|
|
5345
5434
|
{
|
|
5346
5435
|
className: "flex h-full w-full items-center justify-center overflow-hidden p-12",
|
|
@@ -5351,7 +5440,7 @@ function ImageLightbox({ open, onOpenChange, images, initialIndex = 0 }) {
|
|
|
5351
5440
|
onMouseUp: handleMouseUp,
|
|
5352
5441
|
onMouseLeave: handleMouseUp,
|
|
5353
5442
|
onDoubleClick: handleDoubleClick,
|
|
5354
|
-
children: /* @__PURE__ */
|
|
5443
|
+
children: /* @__PURE__ */ jsx18(
|
|
5355
5444
|
"img",
|
|
5356
5445
|
{
|
|
5357
5446
|
ref: imgRef,
|
|
@@ -5373,7 +5462,7 @@ function ImageLightbox({ open, onOpenChange, images, initialIndex = 0 }) {
|
|
|
5373
5462
|
}
|
|
5374
5463
|
|
|
5375
5464
|
// src/react/components/chat/tool-renderers/FileReadRenderer.tsx
|
|
5376
|
-
import { jsx as
|
|
5465
|
+
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5377
5466
|
var NUMBERED_LINE_RE = /^(\s*\d+)\t([\s\S]*)$/;
|
|
5378
5467
|
function parseReadResult(result) {
|
|
5379
5468
|
if (!result) {
|
|
@@ -5433,28 +5522,28 @@ function FileReadRenderer({ toolCall }) {
|
|
|
5433
5522
|
const resolvedStartLine = startLine ?? (lineCount > 0 ? fallbackStart : null);
|
|
5434
5523
|
const resolvedEndLine = endLine ?? (resolvedStartLine !== null && lineCount > 0 ? resolvedStartLine + lineCount - 1 : null);
|
|
5435
5524
|
const lineRange = formatLineRange(resolvedStartLine, resolvedEndLine);
|
|
5436
|
-
return /* @__PURE__ */
|
|
5437
|
-
/* @__PURE__ */
|
|
5438
|
-
/* @__PURE__ */
|
|
5439
|
-
/* @__PURE__ */
|
|
5440
|
-
filePath ? /* @__PURE__ */
|
|
5525
|
+
return /* @__PURE__ */ jsxs15("div", { className: "space-y-3", children: [
|
|
5526
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-start justify-between gap-3", children: [
|
|
5527
|
+
/* @__PURE__ */ jsxs15("div", { className: "min-w-0", children: [
|
|
5528
|
+
/* @__PURE__ */ jsx19("div", { className: "truncate font-mono text-[11px] text-[hsl(var(--foreground))]", children: fileName }),
|
|
5529
|
+
filePath ? /* @__PURE__ */ jsx19("div", { className: "truncate text-[10px] text-[hsl(var(--muted-foreground))]", children: filePath }) : null
|
|
5441
5530
|
] }),
|
|
5442
|
-
/* @__PURE__ */
|
|
5443
|
-
lineRange ? /* @__PURE__ */
|
|
5444
|
-
checksum ? /* @__PURE__ */
|
|
5531
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center justify-end gap-1.5", children: [
|
|
5532
|
+
lineRange ? /* @__PURE__ */ jsx19("span", { className: "rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--muted))] px-2 py-0.5 text-[10px] text-[hsl(var(--muted-foreground))]", children: lineRange }) : null,
|
|
5533
|
+
checksum ? /* @__PURE__ */ jsx19("span", { className: "rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--muted))] px-2 py-0.5 font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: checksum }) : null
|
|
5445
5534
|
] })
|
|
5446
5535
|
] }),
|
|
5447
|
-
description ? /* @__PURE__ */
|
|
5448
|
-
errorMessage ? /* @__PURE__ */
|
|
5449
|
-
isImageResult ? /* @__PURE__ */
|
|
5450
|
-
imageUrls.map((url, idx) => /* @__PURE__ */
|
|
5536
|
+
description ? /* @__PURE__ */ jsx19("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/35 px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: description }) : null,
|
|
5537
|
+
errorMessage ? /* @__PURE__ */ jsx19("div", { className: "rounded-lg border border-red-500/30 bg-red-500/8 px-3 py-2 text-[11px] text-red-300", children: errorMessage }) : null,
|
|
5538
|
+
isImageResult ? /* @__PURE__ */ jsxs15("div", { className: "grid gap-2", children: [
|
|
5539
|
+
imageUrls.map((url, idx) => /* @__PURE__ */ jsx19(
|
|
5451
5540
|
"button",
|
|
5452
5541
|
{
|
|
5453
5542
|
type: "button",
|
|
5454
5543
|
onClick: () => setLightboxIndex(idx),
|
|
5455
5544
|
className: "cursor-zoom-in",
|
|
5456
5545
|
title: "\u67E5\u770B\u5927\u56FE",
|
|
5457
|
-
children: /* @__PURE__ */
|
|
5546
|
+
children: /* @__PURE__ */ jsx19(
|
|
5458
5547
|
"img",
|
|
5459
5548
|
{
|
|
5460
5549
|
src: url,
|
|
@@ -5465,7 +5554,7 @@ function FileReadRenderer({ toolCall }) {
|
|
|
5465
5554
|
},
|
|
5466
5555
|
url.slice(0, 64)
|
|
5467
5556
|
)),
|
|
5468
|
-
/* @__PURE__ */
|
|
5557
|
+
/* @__PURE__ */ jsx19(
|
|
5469
5558
|
ImageLightbox,
|
|
5470
5559
|
{
|
|
5471
5560
|
open: lightboxIndex != null,
|
|
@@ -5476,15 +5565,15 @@ function FileReadRenderer({ toolCall }) {
|
|
|
5476
5565
|
initialIndex: lightboxIndex ?? 0
|
|
5477
5566
|
}
|
|
5478
5567
|
),
|
|
5479
|
-
content ? /* @__PURE__ */
|
|
5480
|
-
] }) : !errorMessage ? /* @__PURE__ */
|
|
5481
|
-
note ? /* @__PURE__ */
|
|
5568
|
+
content ? /* @__PURE__ */ jsx19("div", { className: "text-[11px] text-[hsl(var(--muted-foreground))]", children: content }) : null
|
|
5569
|
+
] }) : !errorMessage ? /* @__PURE__ */ jsx19(CodePreview, { content, filePath, className: "max-h-[360px]" }) : null,
|
|
5570
|
+
note ? /* @__PURE__ */ jsx19("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/35 px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: note }) : null
|
|
5482
5571
|
] });
|
|
5483
5572
|
}
|
|
5484
5573
|
|
|
5485
5574
|
// src/react/components/chat/tool-renderers/SearchRenderer.tsx
|
|
5486
5575
|
import { ExternalLink as ExternalLink2, FileText as FileText3, Folder as Folder2, Globe2 } from "lucide-react";
|
|
5487
|
-
import { jsx as
|
|
5576
|
+
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5488
5577
|
function toRecordArray(value) {
|
|
5489
5578
|
return Array.isArray(value) ? value.filter(isPlainObject) : [];
|
|
5490
5579
|
}
|
|
@@ -5546,7 +5635,7 @@ function parseWebFetchResult(result) {
|
|
|
5546
5635
|
};
|
|
5547
5636
|
}
|
|
5548
5637
|
function renderEmptyState(label) {
|
|
5549
|
-
return /* @__PURE__ */
|
|
5638
|
+
return /* @__PURE__ */ jsx20("div", { className: "rounded-lg border border-dashed border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20 px-3 py-4 text-[11px] text-[hsl(var(--muted-foreground))]", children: label });
|
|
5550
5639
|
}
|
|
5551
5640
|
function SearchRenderer({ toolCall }) {
|
|
5552
5641
|
const normalizedName = formatToolName(toolCall.name);
|
|
@@ -5555,26 +5644,26 @@ function SearchRenderer({ toolCall }) {
|
|
|
5555
5644
|
const resultStr = getResultText(toolCall.result);
|
|
5556
5645
|
const errorMessage = extractErrorMessage(resultStr);
|
|
5557
5646
|
if (errorMessage) {
|
|
5558
|
-
return /* @__PURE__ */
|
|
5647
|
+
return /* @__PURE__ */ jsx20("div", { className: "rounded-lg border border-red-500/30 bg-red-500/8 px-3 py-2 text-[11px] text-red-300", children: errorMessage });
|
|
5559
5648
|
}
|
|
5560
5649
|
if (normalizedName === "Ls" || normalizedName === "Glob") {
|
|
5561
5650
|
const items = parseDirectoryItems(resultStr);
|
|
5562
5651
|
const path = getStringValue(args, "path");
|
|
5563
|
-
return /* @__PURE__ */
|
|
5564
|
-
path ? /* @__PURE__ */
|
|
5652
|
+
return /* @__PURE__ */ jsxs16("div", { className: "space-y-3", children: [
|
|
5653
|
+
path ? /* @__PURE__ */ jsxs16("div", { className: "text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
5565
5654
|
"\u76EE\u5F55\uFF1A",
|
|
5566
5655
|
path
|
|
5567
5656
|
] }) : null,
|
|
5568
|
-
items.length > 0 ? /* @__PURE__ */
|
|
5657
|
+
items.length > 0 ? /* @__PURE__ */ jsx20("div", { className: "grid gap-2", children: items.map((item) => /* @__PURE__ */ jsxs16(
|
|
5569
5658
|
"div",
|
|
5570
5659
|
{
|
|
5571
5660
|
className: "flex items-center justify-between gap-3 rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20 px-3 py-2",
|
|
5572
5661
|
children: [
|
|
5573
|
-
/* @__PURE__ */
|
|
5574
|
-
item.isDir ? /* @__PURE__ */
|
|
5575
|
-
/* @__PURE__ */
|
|
5662
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
5663
|
+
item.isDir ? /* @__PURE__ */ jsx20(Folder2, { size: 14, className: "shrink-0 text-blue-300" }) : /* @__PURE__ */ jsx20(FileText3, { size: 14, className: "shrink-0 text-[hsl(var(--muted-foreground))]" }),
|
|
5664
|
+
/* @__PURE__ */ jsx20("span", { className: "truncate font-mono text-[11px] text-[hsl(var(--foreground))]", children: item.name })
|
|
5576
5665
|
] }),
|
|
5577
|
-
/* @__PURE__ */
|
|
5666
|
+
/* @__PURE__ */ jsx20("span", { className: "shrink-0 text-[10px] text-[hsl(var(--muted-foreground))]", children: item.isDir ? "\u76EE\u5F55" : formatBytes(item.size) ?? "\u6587\u4EF6" })
|
|
5578
5667
|
]
|
|
5579
5668
|
},
|
|
5580
5669
|
`${item.name}-${item.size}-${item.isDir}`
|
|
@@ -5584,28 +5673,28 @@ function SearchRenderer({ toolCall }) {
|
|
|
5584
5673
|
if (normalizedName === "Grep") {
|
|
5585
5674
|
const { matches, searchPath } = parseGrepResult(resultStr);
|
|
5586
5675
|
const pattern = getStringValue(args, "pattern");
|
|
5587
|
-
return /* @__PURE__ */
|
|
5588
|
-
/* @__PURE__ */
|
|
5589
|
-
pattern ? /* @__PURE__ */
|
|
5590
|
-
searchPath ? /* @__PURE__ */
|
|
5676
|
+
return /* @__PURE__ */ jsxs16("div", { className: "space-y-3", children: [
|
|
5677
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
5678
|
+
pattern ? /* @__PURE__ */ jsx20("span", { className: "rounded-full bg-[hsl(var(--muted))] px-2 py-0.5 font-mono", children: pattern }) : null,
|
|
5679
|
+
searchPath ? /* @__PURE__ */ jsxs16("span", { children: [
|
|
5591
5680
|
"\u8303\u56F4\uFF1A",
|
|
5592
5681
|
searchPath
|
|
5593
5682
|
] }) : null
|
|
5594
5683
|
] }),
|
|
5595
|
-
matches.length > 0 ? /* @__PURE__ */
|
|
5684
|
+
matches.length > 0 ? /* @__PURE__ */ jsx20("div", { className: "grid gap-2", children: matches.map((match) => /* @__PURE__ */ jsxs16(
|
|
5596
5685
|
"div",
|
|
5597
5686
|
{
|
|
5598
5687
|
className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20 px-3 py-2",
|
|
5599
5688
|
children: [
|
|
5600
|
-
/* @__PURE__ */
|
|
5601
|
-
/* @__PURE__ */
|
|
5602
|
-
match.lineNumber !== null ? /* @__PURE__ */
|
|
5689
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center justify-between gap-3", children: [
|
|
5690
|
+
/* @__PURE__ */ jsx20("span", { className: "truncate font-mono text-[11px] text-[hsl(var(--foreground))]", children: match.path }),
|
|
5691
|
+
match.lineNumber !== null ? /* @__PURE__ */ jsxs16("span", { className: "shrink-0 text-[10px] text-[hsl(var(--muted-foreground))]", children: [
|
|
5603
5692
|
"\u7B2C ",
|
|
5604
5693
|
match.lineNumber,
|
|
5605
5694
|
" \u884C"
|
|
5606
5695
|
] }) : null
|
|
5607
5696
|
] }),
|
|
5608
|
-
/* @__PURE__ */
|
|
5697
|
+
/* @__PURE__ */ jsx20("pre", { className: "mt-2 overflow-x-auto whitespace-pre-wrap font-mono text-[11px] text-[hsl(var(--muted-foreground))]", children: /* @__PURE__ */ jsx20("code", { children: match.line }) })
|
|
5609
5698
|
]
|
|
5610
5699
|
},
|
|
5611
5700
|
`${match.path}-${match.lineNumber}-${match.line}`
|
|
@@ -5614,16 +5703,16 @@ function SearchRenderer({ toolCall }) {
|
|
|
5614
5703
|
}
|
|
5615
5704
|
const { results, summary } = normalizedName === "WebFetch" ? parseWebFetchResult(resultStr) : { results: parseWebResults(resultStr), summary: null };
|
|
5616
5705
|
const query = getStringValue(args, "query");
|
|
5617
|
-
return /* @__PURE__ */
|
|
5618
|
-
query ? /* @__PURE__ */
|
|
5706
|
+
return /* @__PURE__ */ jsxs16("div", { className: "space-y-3", children: [
|
|
5707
|
+
query ? /* @__PURE__ */ jsxs16("div", { className: "text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
5619
5708
|
"\u67E5\u8BE2\uFF1A",
|
|
5620
5709
|
query
|
|
5621
5710
|
] }) : null,
|
|
5622
|
-
summary ? /* @__PURE__ */
|
|
5623
|
-
/* @__PURE__ */
|
|
5624
|
-
/* @__PURE__ */
|
|
5711
|
+
summary ? /* @__PURE__ */ jsxs16("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20 px-3 py-3", children: [
|
|
5712
|
+
/* @__PURE__ */ jsx20("div", { className: "mb-2 text-[10px] uppercase tracking-[0.16em] text-[hsl(var(--muted-foreground))]", children: "\u6458\u8981" }),
|
|
5713
|
+
/* @__PURE__ */ jsx20("p", { className: "whitespace-pre-wrap text-[11px] leading-5 text-[hsl(var(--foreground))]", children: summary })
|
|
5625
5714
|
] }) : null,
|
|
5626
|
-
results.length > 0 ? /* @__PURE__ */
|
|
5715
|
+
results.length > 0 ? /* @__PURE__ */ jsx20("div", { className: "grid gap-2", children: results.map((item, index) => /* @__PURE__ */ jsx20(
|
|
5627
5716
|
"a",
|
|
5628
5717
|
{
|
|
5629
5718
|
href: item.url ?? void 0,
|
|
@@ -5633,12 +5722,12 @@ function SearchRenderer({ toolCall }) {
|
|
|
5633
5722
|
"rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20 px-3 py-3 transition-colors",
|
|
5634
5723
|
item.url && "hover:border-[hsl(var(--ring))] hover:bg-[hsl(var(--muted))]/35"
|
|
5635
5724
|
),
|
|
5636
|
-
children: /* @__PURE__ */
|
|
5637
|
-
/* @__PURE__ */
|
|
5638
|
-
/* @__PURE__ */
|
|
5639
|
-
/* @__PURE__ */
|
|
5640
|
-
/* @__PURE__ */
|
|
5641
|
-
item.url ? /* @__PURE__ */
|
|
5725
|
+
children: /* @__PURE__ */ jsxs16("div", { className: "flex items-start gap-3", children: [
|
|
5726
|
+
/* @__PURE__ */ jsx20(Globe2, { size: 15, className: "mt-0.5 shrink-0 text-blue-300" }),
|
|
5727
|
+
/* @__PURE__ */ jsxs16("div", { className: "min-w-0 flex-1", children: [
|
|
5728
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-start justify-between gap-3", children: [
|
|
5729
|
+
/* @__PURE__ */ jsx20("span", { className: "line-clamp-2 text-[11px] font-medium text-[hsl(var(--foreground))]", children: item.title ?? item.url ?? "\u672A\u547D\u540D\u7ED3\u679C" }),
|
|
5730
|
+
item.url ? /* @__PURE__ */ jsx20(
|
|
5642
5731
|
ExternalLink2,
|
|
5643
5732
|
{
|
|
5644
5733
|
size: 12,
|
|
@@ -5646,8 +5735,8 @@ function SearchRenderer({ toolCall }) {
|
|
|
5646
5735
|
}
|
|
5647
5736
|
) : null
|
|
5648
5737
|
] }),
|
|
5649
|
-
item.url ? /* @__PURE__ */
|
|
5650
|
-
item.description ? /* @__PURE__ */
|
|
5738
|
+
item.url ? /* @__PURE__ */ jsx20("div", { className: "mt-1 truncate font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: item.url }) : null,
|
|
5739
|
+
item.description ? /* @__PURE__ */ jsx20("p", { className: "mt-2 line-clamp-3 text-[11px] leading-5 text-[hsl(var(--muted-foreground))]", children: item.description }) : null
|
|
5651
5740
|
] })
|
|
5652
5741
|
] })
|
|
5653
5742
|
},
|
|
@@ -5658,7 +5747,7 @@ function SearchRenderer({ toolCall }) {
|
|
|
5658
5747
|
|
|
5659
5748
|
// src/react/components/chat/tool-renderers/SubmitResultRenderer.tsx
|
|
5660
5749
|
import { CheckCircle2, CircleAlert } from "lucide-react";
|
|
5661
|
-
import { jsx as
|
|
5750
|
+
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5662
5751
|
function extractText(value, key) {
|
|
5663
5752
|
if (!isPlainObject(value)) return null;
|
|
5664
5753
|
const field = value[key];
|
|
@@ -5679,25 +5768,25 @@ function SubmitResultRenderer({ toolCall }) {
|
|
|
5679
5768
|
const { description, result, error, status } = parsePayload(toolCall);
|
|
5680
5769
|
const isError = toolCall.status === "error" || Boolean(error);
|
|
5681
5770
|
const Icon = isError ? CircleAlert : CheckCircle2;
|
|
5682
|
-
return /* @__PURE__ */
|
|
5683
|
-
/* @__PURE__ */
|
|
5684
|
-
/* @__PURE__ */
|
|
5685
|
-
/* @__PURE__ */
|
|
5686
|
-
/* @__PURE__ */
|
|
5687
|
-
description ? /* @__PURE__ */
|
|
5688
|
-
status ? /* @__PURE__ */
|
|
5771
|
+
return /* @__PURE__ */ jsxs17("div", { className: "overflow-hidden rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] shadow-sm", children: [
|
|
5772
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-3 border-b border-[hsl(var(--border))] bg-[hsl(var(--muted))]/25 px-4 py-3", children: [
|
|
5773
|
+
/* @__PURE__ */ jsx21("div", { className: isError ? "text-red-500" : "text-emerald-500", children: /* @__PURE__ */ jsx21(Icon, { size: 18 }) }),
|
|
5774
|
+
/* @__PURE__ */ jsxs17("div", { className: "min-w-0 flex-1", children: [
|
|
5775
|
+
/* @__PURE__ */ jsx21("div", { className: "font-medium text-[hsl(var(--foreground))]", children: description || (isError ? "\u4EFB\u52A1\u6267\u884C\u5931\u8D25" : "\u4EFB\u52A1\u7ED3\u679C\u5DF2\u63D0\u4EA4") }),
|
|
5776
|
+
description ? /* @__PURE__ */ jsx21("div", { className: "mt-0.5 text-xs text-[hsl(var(--muted-foreground))]", children: isError ? "\u4EFB\u52A1\u6267\u884C\u5931\u8D25" : "\u4EFB\u52A1\u7ED3\u679C\u5DF2\u63D0\u4EA4" }) : null,
|
|
5777
|
+
status ? /* @__PURE__ */ jsxs17("div", { className: "mt-0.5 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
5689
5778
|
"\u72B6\u6001\uFF1A",
|
|
5690
5779
|
status
|
|
5691
5780
|
] }) : null
|
|
5692
5781
|
] })
|
|
5693
5782
|
] }),
|
|
5694
|
-
/* @__PURE__ */
|
|
5695
|
-
result ? /* @__PURE__ */
|
|
5696
|
-
error ? /* @__PURE__ */
|
|
5697
|
-
/* @__PURE__ */
|
|
5698
|
-
/* @__PURE__ */
|
|
5783
|
+
/* @__PURE__ */ jsxs17("div", { className: "space-y-3 px-4 py-4 text-sm leading-6 text-[hsl(var(--foreground))]", children: [
|
|
5784
|
+
result ? /* @__PURE__ */ jsx21("p", { className: "whitespace-pre-wrap", children: result }) : null,
|
|
5785
|
+
error ? /* @__PURE__ */ jsxs17("div", { className: "rounded-xl border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-200", children: [
|
|
5786
|
+
/* @__PURE__ */ jsx21("div", { className: "mb-1 font-medium", children: "\u9519\u8BEF\u4FE1\u606F" }),
|
|
5787
|
+
/* @__PURE__ */ jsx21("div", { className: "whitespace-pre-wrap", children: error })
|
|
5699
5788
|
] }) : null,
|
|
5700
|
-
!result && !error ? /* @__PURE__ */
|
|
5789
|
+
!result && !error ? /* @__PURE__ */ jsx21("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u667A\u80FD\u4F53\u5DF2\u7ED3\u675F\u672C\u8F6E\u4EFB\u52A1\u3002" }) : null
|
|
5701
5790
|
] })
|
|
5702
5791
|
] });
|
|
5703
5792
|
}
|
|
@@ -5721,7 +5810,7 @@ function getRenderer(toolName) {
|
|
|
5721
5810
|
}
|
|
5722
5811
|
|
|
5723
5812
|
// src/react/components/chat/ToolCallBlock.tsx
|
|
5724
|
-
import { Fragment as Fragment5, jsx as
|
|
5813
|
+
import { Fragment as Fragment5, jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5725
5814
|
function FilePathLink({ filePath, sessionId }) {
|
|
5726
5815
|
const activeSessionId = useSessionStore((s) => s.activeSessionId);
|
|
5727
5816
|
const pushArtifact = useUiStore((s) => s.pushArtifact);
|
|
@@ -5739,14 +5828,14 @@ function FilePathLink({ filePath, sessionId }) {
|
|
|
5739
5828
|
} catch {
|
|
5740
5829
|
}
|
|
5741
5830
|
};
|
|
5742
|
-
return /* @__PURE__ */
|
|
5831
|
+
return /* @__PURE__ */ jsx22(
|
|
5743
5832
|
"button",
|
|
5744
5833
|
{
|
|
5745
5834
|
type: "button",
|
|
5746
5835
|
onClick: handleClick,
|
|
5747
5836
|
className: "flex min-w-0 items-center gap-1 text-blue-400 hover:text-blue-300 hover:underline cursor-pointer font-mono",
|
|
5748
5837
|
title: `\u9884\u89C8 ${filePath}`,
|
|
5749
|
-
children: /* @__PURE__ */
|
|
5838
|
+
children: /* @__PURE__ */ jsx22("span", { className: "truncate", children: fileName })
|
|
5750
5839
|
}
|
|
5751
5840
|
);
|
|
5752
5841
|
}
|
|
@@ -5789,7 +5878,7 @@ function ToolCallBlock({
|
|
|
5789
5878
|
const canAnswer = toolCall.status === "awaiting_answer" && Boolean(resolvedOnAnswer) && Boolean(resolvedSessionStatus);
|
|
5790
5879
|
const shouldRenderQuestion = Boolean(askData) && (canAnswer || resolvedAnswered || toolCall.status === "done");
|
|
5791
5880
|
if (askData && shouldRenderQuestion) {
|
|
5792
|
-
const questionBlock = /* @__PURE__ */
|
|
5881
|
+
const questionBlock = /* @__PURE__ */ jsx22(
|
|
5793
5882
|
AskUserQuestionBlock,
|
|
5794
5883
|
{
|
|
5795
5884
|
data: askData,
|
|
@@ -5803,9 +5892,9 @@ function ToolCallBlock({
|
|
|
5803
5892
|
if (!reasoning) {
|
|
5804
5893
|
return questionBlock;
|
|
5805
5894
|
}
|
|
5806
|
-
return /* @__PURE__ */
|
|
5895
|
+
return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-1", children: [
|
|
5807
5896
|
questionBlock,
|
|
5808
|
-
/* @__PURE__ */
|
|
5897
|
+
/* @__PURE__ */ jsx22("div", { className: "ml-4", children: /* @__PURE__ */ jsx22(ThinkingBadge, { reasoning, variant: "block" }) })
|
|
5809
5898
|
] });
|
|
5810
5899
|
}
|
|
5811
5900
|
}
|
|
@@ -5816,11 +5905,11 @@ function ToolCallBlock({
|
|
|
5816
5905
|
const borderWidthClass = level === 2 ? "border-l-[2px]" : "border-l-[3px]";
|
|
5817
5906
|
const indentClass = level === 2 ? "ml-3" : "ml-4";
|
|
5818
5907
|
const toneClass = tone === "red" ? "border-l-[hsl(var(--muted-foreground)/0.5)]" : tone === "amber" ? "border-l-amber-400" : tone === "blue" ? "border-l-blue-500" : "border-l-[hsl(var(--primary))]";
|
|
5819
|
-
const statusIcon = toolCall.status === "pending" ? /* @__PURE__ */
|
|
5908
|
+
const statusIcon = toolCall.status === "pending" ? /* @__PURE__ */ jsx22(Loader23, { size: 11, className: "animate-spin" }) : toolCall.status === "awaiting_answer" ? /* @__PURE__ */ jsx22(MessageSquareMore, { size: 11 }) : toolCall.status === "cancelled" || toolCall.status === "error" ? /* @__PURE__ */ jsx22(X4, { size: 11 }) : /* @__PURE__ */ jsx22(Check2, { size: 11 });
|
|
5820
5909
|
const statusTextClass = tone === "red" ? "text-[hsl(var(--muted-foreground))]" : tone === "amber" ? "text-amber-300" : tone === "blue" ? "text-blue-300" : "text-[hsl(var(--primary))]";
|
|
5821
|
-
return /* @__PURE__ */
|
|
5822
|
-
/* @__PURE__ */
|
|
5823
|
-
/* @__PURE__ */
|
|
5910
|
+
return /* @__PURE__ */ jsxs18("div", { className: cn(indentClass, "text-xs", customization?.classNames?.toolCall), children: [
|
|
5911
|
+
/* @__PURE__ */ jsxs18("div", { className: cn(borderWidthClass, toneClass, "flex items-center gap-2 px-3 py-2"), children: [
|
|
5912
|
+
/* @__PURE__ */ jsxs18(
|
|
5824
5913
|
"button",
|
|
5825
5914
|
{
|
|
5826
5915
|
type: "button",
|
|
@@ -5828,7 +5917,7 @@ function ToolCallBlock({
|
|
|
5828
5917
|
className: "flex min-w-0 flex-1 items-center gap-2 text-left transition-colors hover:bg-white/3 focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
5829
5918
|
"aria-expanded": expanded,
|
|
5830
5919
|
children: [
|
|
5831
|
-
/* @__PURE__ */
|
|
5920
|
+
/* @__PURE__ */ jsx22(
|
|
5832
5921
|
ChevronRight3,
|
|
5833
5922
|
{
|
|
5834
5923
|
size: 11,
|
|
@@ -5838,21 +5927,21 @@ function ToolCallBlock({
|
|
|
5838
5927
|
)
|
|
5839
5928
|
}
|
|
5840
5929
|
),
|
|
5841
|
-
/* @__PURE__ */
|
|
5930
|
+
/* @__PURE__ */ jsxs18("span", { className: cn("flex shrink-0 items-center gap-1 text-[10px]", statusTextClass), children: [
|
|
5842
5931
|
statusIcon,
|
|
5843
|
-
/* @__PURE__ */
|
|
5932
|
+
/* @__PURE__ */ jsx22("span", { children: getToolStatusLabel(toolCall.status) })
|
|
5844
5933
|
] }),
|
|
5845
|
-
/* @__PURE__ */
|
|
5934
|
+
/* @__PURE__ */ jsxs18("span", { className: "min-w-0 flex-1 truncate font-medium text-[hsl(var(--foreground))]", children: [
|
|
5846
5935
|
displayName,
|
|
5847
5936
|
toolCall.status === "error" ? "\uFF08\u5F85\u91CD\u8BD5\uFF09" : ""
|
|
5848
5937
|
] })
|
|
5849
5938
|
]
|
|
5850
5939
|
}
|
|
5851
5940
|
),
|
|
5852
|
-
filePath && /* @__PURE__ */
|
|
5853
|
-
reasoning ? /* @__PURE__ */
|
|
5854
|
-
typeof toolCall.duration_ms === "number" && toolCall.duration_ms > 0 && /* @__PURE__ */
|
|
5855
|
-
uiMeta?.target === "preview" && resolvedSessionId && !isInternalStatusPreview(uiMeta) ? /* @__PURE__ */
|
|
5941
|
+
filePath && /* @__PURE__ */ jsx22("span", { className: "flex min-w-0 max-w-[50%] text-[hsl(var(--muted-foreground))]", children: /* @__PURE__ */ jsx22(FilePathLink, { filePath, sessionId: resolvedSessionId }) }),
|
|
5942
|
+
reasoning ? /* @__PURE__ */ jsx22(ThinkingBadge, { reasoning, variant: "block" }) : null,
|
|
5943
|
+
typeof toolCall.duration_ms === "number" && toolCall.duration_ms > 0 && /* @__PURE__ */ jsx22("span", { className: "shrink-0 font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: formatToolDuration(toolCall.duration_ms) }),
|
|
5944
|
+
uiMeta?.target === "preview" && resolvedSessionId && !isInternalStatusPreview(uiMeta) ? /* @__PURE__ */ jsxs18(
|
|
5856
5945
|
"button",
|
|
5857
5946
|
{
|
|
5858
5947
|
type: "button",
|
|
@@ -5870,20 +5959,20 @@ function ToolCallBlock({
|
|
|
5870
5959
|
className: "inline-flex shrink-0 items-center gap-1 text-blue-400 hover:text-blue-300 hover:underline cursor-pointer",
|
|
5871
5960
|
title: `\u6253\u5F00 ${uiMeta.title ?? displayName}`,
|
|
5872
5961
|
children: [
|
|
5873
|
-
/* @__PURE__ */
|
|
5874
|
-
/* @__PURE__ */
|
|
5962
|
+
/* @__PURE__ */ jsx22(PanelRightOpen, { size: 11 }),
|
|
5963
|
+
/* @__PURE__ */ jsx22("span", { children: uiMeta.title ?? displayName })
|
|
5875
5964
|
]
|
|
5876
5965
|
}
|
|
5877
5966
|
) : null
|
|
5878
5967
|
] }),
|
|
5879
|
-
expanded && /* @__PURE__ */
|
|
5880
|
-
/* @__PURE__ */
|
|
5881
|
-
/* @__PURE__ */
|
|
5882
|
-
/* @__PURE__ */
|
|
5883
|
-
/* @__PURE__ */
|
|
5884
|
-
toolCall.result != null && /* @__PURE__ */
|
|
5885
|
-
/* @__PURE__ */
|
|
5886
|
-
/* @__PURE__ */
|
|
5968
|
+
expanded && /* @__PURE__ */ jsx22("div", { className: "ml-4 mt-1 rounded-xl bg-[hsl(var(--card))] px-3 py-3", children: Renderer ? /* @__PURE__ */ jsx22(Renderer, { toolCall, sessionId: resolvedSessionId }) : /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
5969
|
+
/* @__PURE__ */ jsx22("div", { className: "mb-1 text-[10px] uppercase tracking-wider text-[hsl(var(--muted-foreground))]", children: "\u5DE5\u5177" }),
|
|
5970
|
+
/* @__PURE__ */ jsx22("div", { className: "mb-3 font-mono text-[11px] text-[hsl(var(--foreground))]", children: normalizedName }),
|
|
5971
|
+
/* @__PURE__ */ jsx22("div", { className: "mb-1 text-[10px] uppercase tracking-wider text-[hsl(var(--muted-foreground))]", children: "\u53C2\u6570" }),
|
|
5972
|
+
/* @__PURE__ */ jsx22("pre", { className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-[hsl(var(--muted))] p-2 font-mono text-[11px] text-[hsl(var(--foreground))]", children: formatArgs(toolCall.arguments) }),
|
|
5973
|
+
toolCall.result != null && /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
5974
|
+
/* @__PURE__ */ jsx22("div", { className: "mb-1 mt-3 text-[10px] uppercase tracking-wider text-[hsl(var(--muted-foreground))]", children: "\u7ED3\u679C" }),
|
|
5975
|
+
/* @__PURE__ */ jsx22(
|
|
5887
5976
|
"pre",
|
|
5888
5977
|
{
|
|
5889
5978
|
className: cn(
|
|
@@ -6075,7 +6164,7 @@ import { Download as Download3, X as X5 } from "lucide-react";
|
|
|
6075
6164
|
import { useEffect as useEffect12 } from "react";
|
|
6076
6165
|
import { createPortal as createPortal4 } from "react-dom";
|
|
6077
6166
|
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
6078
|
-
import { jsx as
|
|
6167
|
+
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6079
6168
|
function AttachmentPreviewDialog({ open, onOpenChange, filename, url, mode }) {
|
|
6080
6169
|
useEffect12(() => {
|
|
6081
6170
|
if (!open) return;
|
|
@@ -6103,7 +6192,7 @@ function AttachmentPreviewDialog({ open, onOpenChange, filename, url, mode }) {
|
|
|
6103
6192
|
staleTime: 6e4
|
|
6104
6193
|
});
|
|
6105
6194
|
if (!open) return null;
|
|
6106
|
-
const body = /* @__PURE__ */
|
|
6195
|
+
const body = /* @__PURE__ */ jsx23(
|
|
6107
6196
|
"div",
|
|
6108
6197
|
{
|
|
6109
6198
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",
|
|
@@ -6114,17 +6203,17 @@ function AttachmentPreviewDialog({ open, onOpenChange, filename, url, mode }) {
|
|
|
6114
6203
|
role: "dialog",
|
|
6115
6204
|
"aria-modal": "true",
|
|
6116
6205
|
"aria-labelledby": "attachment-preview-title",
|
|
6117
|
-
children: /* @__PURE__ */
|
|
6206
|
+
children: /* @__PURE__ */ jsxs19(
|
|
6118
6207
|
"div",
|
|
6119
6208
|
{
|
|
6120
6209
|
className: "max-h-[90vh] w-full max-w-3xl overflow-hidden rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--background))] shadow-2xl",
|
|
6121
6210
|
onClick: (e) => e.stopPropagation(),
|
|
6122
6211
|
onKeyDown: (e) => e.stopPropagation(),
|
|
6123
6212
|
children: [
|
|
6124
|
-
/* @__PURE__ */
|
|
6125
|
-
/* @__PURE__ */
|
|
6126
|
-
/* @__PURE__ */
|
|
6127
|
-
url && /* @__PURE__ */
|
|
6213
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between border-b border-[hsl(var(--border))] px-4 py-3", children: [
|
|
6214
|
+
/* @__PURE__ */ jsx23("h3", { id: "attachment-preview-title", className: "truncate text-sm font-semibold text-[hsl(var(--foreground))]", children: filename }),
|
|
6215
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-1", children: [
|
|
6216
|
+
url && /* @__PURE__ */ jsx23(
|
|
6128
6217
|
"a",
|
|
6129
6218
|
{
|
|
6130
6219
|
href: url,
|
|
@@ -6133,22 +6222,22 @@ function AttachmentPreviewDialog({ open, onOpenChange, filename, url, mode }) {
|
|
|
6133
6222
|
rel: "noopener noreferrer",
|
|
6134
6223
|
title: "\u4E0B\u8F7D",
|
|
6135
6224
|
className: "flex h-7 w-7 items-center justify-center rounded-md text-[hsl(var(--muted-foreground))] transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]",
|
|
6136
|
-
children: /* @__PURE__ */
|
|
6225
|
+
children: /* @__PURE__ */ jsx23(Download3, { size: 14 })
|
|
6137
6226
|
}
|
|
6138
6227
|
),
|
|
6139
|
-
/* @__PURE__ */
|
|
6228
|
+
/* @__PURE__ */ jsx23(
|
|
6140
6229
|
"button",
|
|
6141
6230
|
{
|
|
6142
6231
|
type: "button",
|
|
6143
6232
|
onClick: () => onOpenChange(false),
|
|
6144
6233
|
title: "\u5173\u95ED",
|
|
6145
6234
|
className: "flex h-7 w-7 items-center justify-center rounded-md text-[hsl(var(--muted-foreground))] transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]",
|
|
6146
|
-
children: /* @__PURE__ */
|
|
6235
|
+
children: /* @__PURE__ */ jsx23(X5, { size: 14 })
|
|
6147
6236
|
}
|
|
6148
6237
|
)
|
|
6149
6238
|
] })
|
|
6150
6239
|
] }),
|
|
6151
|
-
/* @__PURE__ */
|
|
6240
|
+
/* @__PURE__ */ jsx23("div", { className: "max-h-[calc(90vh-56px)] overflow-auto px-4 py-3 text-sm text-[hsl(var(--foreground))]", children: renderContent({ mode, url, content, error }) })
|
|
6152
6241
|
]
|
|
6153
6242
|
}
|
|
6154
6243
|
)
|
|
@@ -6163,43 +6252,43 @@ function renderContent({
|
|
|
6163
6252
|
error
|
|
6164
6253
|
}) {
|
|
6165
6254
|
if (!url) {
|
|
6166
|
-
return /* @__PURE__ */
|
|
6255
|
+
return /* @__PURE__ */ jsx23("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u6B64\u9644\u4EF6\u6682\u65E0\u53EF\u7528\u9884\u89C8\u5730\u5740\u3002" });
|
|
6167
6256
|
}
|
|
6168
6257
|
if (mode === "default") {
|
|
6169
|
-
return /* @__PURE__ */
|
|
6258
|
+
return /* @__PURE__ */ jsxs19("p", { className: "text-[hsl(var(--muted-foreground))]", children: [
|
|
6170
6259
|
"\u6B64\u7C7B\u578B\u6682\u4E0D\u652F\u6301\u5185\u5D4C\u9884\u89C8\u3002\u8BF7\u70B9\u51FB\u53F3\u4E0A\u89D2",
|
|
6171
|
-
/* @__PURE__ */
|
|
6260
|
+
/* @__PURE__ */ jsx23("span", { className: "mx-1 font-medium text-[hsl(var(--foreground))]", children: "\u4E0B\u8F7D" }),
|
|
6172
6261
|
"\u6309\u94AE\u67E5\u770B\u3002"
|
|
6173
6262
|
] });
|
|
6174
6263
|
}
|
|
6175
6264
|
if (error) {
|
|
6176
|
-
return /* @__PURE__ */
|
|
6265
|
+
return /* @__PURE__ */ jsxs19("p", { className: "text-[hsl(var(--destructive))]", children: [
|
|
6177
6266
|
"\u52A0\u8F7D\u5931\u8D25\uFF1A",
|
|
6178
6267
|
String(error?.message ?? error)
|
|
6179
6268
|
] });
|
|
6180
6269
|
}
|
|
6181
6270
|
if (content == null) {
|
|
6182
|
-
return /* @__PURE__ */
|
|
6271
|
+
return /* @__PURE__ */ jsx23("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u52A0\u8F7D\u4E2D\u2026" });
|
|
6183
6272
|
}
|
|
6184
6273
|
if (mode === "markdown") {
|
|
6185
|
-
return /* @__PURE__ */
|
|
6274
|
+
return /* @__PURE__ */ jsx23(MarkdownContent, { className: "prose prose-sm prose-invert max-w-none", children: content });
|
|
6186
6275
|
}
|
|
6187
|
-
return /* @__PURE__ */
|
|
6276
|
+
return /* @__PURE__ */ jsx23("pre", { className: "whitespace-pre-wrap font-mono text-xs leading-relaxed", children: content });
|
|
6188
6277
|
}
|
|
6189
6278
|
|
|
6190
6279
|
// src/react/components/chat/MessageContextPills.tsx
|
|
6191
6280
|
import { Bookmark } from "lucide-react";
|
|
6192
|
-
import { jsx as
|
|
6281
|
+
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
6193
6282
|
function MessageContextPills({ contexts }) {
|
|
6194
6283
|
if (contexts.length === 0) return null;
|
|
6195
|
-
return /* @__PURE__ */
|
|
6284
|
+
return /* @__PURE__ */ jsx24("div", { className: "flex flex-wrap gap-1.5", children: contexts.map((ctx, index) => /* @__PURE__ */ jsxs20(
|
|
6196
6285
|
"div",
|
|
6197
6286
|
{
|
|
6198
6287
|
className: "flex shrink-0 items-center gap-1.5 rounded-full border border-[hsl(var(--primary)/0.25)] bg-[hsl(var(--primary)/0.1)] px-2.5 py-1 text-[11px] text-[hsl(var(--primary)/0.85)]",
|
|
6199
6288
|
title: ctx.content,
|
|
6200
6289
|
children: [
|
|
6201
|
-
/* @__PURE__ */
|
|
6202
|
-
/* @__PURE__ */
|
|
6290
|
+
/* @__PURE__ */ jsx24(Bookmark, { size: 12, className: "shrink-0 text-[hsl(var(--primary)/0.65)]" }),
|
|
6291
|
+
/* @__PURE__ */ jsx24("span", { className: "max-w-56 truncate", children: ctx.label })
|
|
6203
6292
|
]
|
|
6204
6293
|
},
|
|
6205
6294
|
`${ctx.label}:${index}`
|
|
@@ -6208,7 +6297,7 @@ function MessageContextPills({ contexts }) {
|
|
|
6208
6297
|
|
|
6209
6298
|
// src/react/components/chat/MessageFileAttachmentList.tsx
|
|
6210
6299
|
import { Archive as Archive2, File as File3, FileCode2 as FileCode22, FileText as FileText4, Film as Film2, Music as Music2 } from "lucide-react";
|
|
6211
|
-
import { Fragment as Fragment6, jsx as
|
|
6300
|
+
import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6212
6301
|
function getFileIcon(fileName) {
|
|
6213
6302
|
const lowerName = fileName.toLowerCase();
|
|
6214
6303
|
if (/\.(zip|rar|7z|tar|gz|bz2|xz)$/.test(lowerName)) {
|
|
@@ -6237,15 +6326,15 @@ function MessageFileAttachmentList({
|
|
|
6237
6326
|
return null;
|
|
6238
6327
|
}
|
|
6239
6328
|
const pillClass = "flex shrink-0 items-center gap-1.5 rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-2.5 py-1 text-[11px] text-[hsl(var(--foreground))]";
|
|
6240
|
-
return /* @__PURE__ */
|
|
6329
|
+
return /* @__PURE__ */ jsx25("div", { className: cn("flex flex-wrap gap-1.5", className), children: files.map((file) => {
|
|
6241
6330
|
const Icon = getFileIcon(file.name);
|
|
6242
6331
|
const key = `${file.name}-${file.data.slice(0, 32)}`;
|
|
6243
|
-
const content = /* @__PURE__ */
|
|
6244
|
-
/* @__PURE__ */
|
|
6245
|
-
/* @__PURE__ */
|
|
6332
|
+
const content = /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
6333
|
+
/* @__PURE__ */ jsx25(Icon, { size: 12, className: "shrink-0 text-[hsl(var(--muted-foreground))]" }),
|
|
6334
|
+
/* @__PURE__ */ jsx25("span", { className: "max-w-32 truncate", children: file.name })
|
|
6246
6335
|
] });
|
|
6247
6336
|
if (onPreview) {
|
|
6248
|
-
return /* @__PURE__ */
|
|
6337
|
+
return /* @__PURE__ */ jsx25(
|
|
6249
6338
|
"button",
|
|
6250
6339
|
{
|
|
6251
6340
|
type: "button",
|
|
@@ -6257,14 +6346,14 @@ function MessageFileAttachmentList({
|
|
|
6257
6346
|
key
|
|
6258
6347
|
);
|
|
6259
6348
|
}
|
|
6260
|
-
return /* @__PURE__ */
|
|
6349
|
+
return /* @__PURE__ */ jsx25("div", { className: pillClass, title: file.name, children: content }, key);
|
|
6261
6350
|
}) });
|
|
6262
6351
|
}
|
|
6263
6352
|
|
|
6264
6353
|
// src/react/components/chat/MessageActions.tsx
|
|
6265
6354
|
import { Check as Check3, Copy } from "lucide-react";
|
|
6266
6355
|
import { useState as useState15 } from "react";
|
|
6267
|
-
import { jsx as
|
|
6356
|
+
import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6268
6357
|
function MessageActions({ content, className }) {
|
|
6269
6358
|
const [copied, setCopied] = useState15(false);
|
|
6270
6359
|
const handleCopy = async () => {
|
|
@@ -6274,7 +6363,7 @@ function MessageActions({ content, className }) {
|
|
|
6274
6363
|
setTimeout(() => setCopied(false), 2e3);
|
|
6275
6364
|
}
|
|
6276
6365
|
};
|
|
6277
|
-
return /* @__PURE__ */
|
|
6366
|
+
return /* @__PURE__ */ jsx26("div", { className: cn("flex items-center gap-1 mt-1.5", className), children: /* @__PURE__ */ jsxs22(
|
|
6278
6367
|
"button",
|
|
6279
6368
|
{
|
|
6280
6369
|
type: "button",
|
|
@@ -6284,8 +6373,8 @@ function MessageActions({ content, className }) {
|
|
|
6284
6373
|
copied ? "text-[hsl(var(--primary))]" : "text-[hsl(var(--muted-foreground))] hover:text-[hsl(var(--foreground))] hover:bg-[hsl(var(--accent))]"
|
|
6285
6374
|
),
|
|
6286
6375
|
children: [
|
|
6287
|
-
copied ? /* @__PURE__ */
|
|
6288
|
-
/* @__PURE__ */
|
|
6376
|
+
copied ? /* @__PURE__ */ jsx26(Check3, { size: 12 }) : /* @__PURE__ */ jsx26(Copy, { size: 12 }),
|
|
6377
|
+
/* @__PURE__ */ jsx26("span", { children: copied ? "\u5DF2\u590D\u5236" : "\u590D\u5236" })
|
|
6289
6378
|
]
|
|
6290
6379
|
}
|
|
6291
6380
|
) });
|
|
@@ -6293,7 +6382,7 @@ function MessageActions({ content, className }) {
|
|
|
6293
6382
|
|
|
6294
6383
|
// src/react/components/chat/TextAttachmentPills.tsx
|
|
6295
6384
|
import { Archive as Archive3, File as File4, FileCode2 as FileCode23, FileText as FileText5, Film as Film3, Music as Music3, FileSpreadsheet, Image } from "lucide-react";
|
|
6296
|
-
import { Fragment as Fragment7, jsx as
|
|
6385
|
+
import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6297
6386
|
function getFileIcon2(fileName) {
|
|
6298
6387
|
const lower2 = fileName.toLowerCase();
|
|
6299
6388
|
if (/\.(zip|rar|7z|tar|gz)$/.test(lower2)) return Archive3;
|
|
@@ -6308,15 +6397,15 @@ function getFileIcon2(fileName) {
|
|
|
6308
6397
|
function TextAttachmentPills({ attachments, onPreview }) {
|
|
6309
6398
|
if (attachments.length === 0) return null;
|
|
6310
6399
|
const pillClass = "flex shrink-0 items-center gap-1.5 rounded-full border border-[hsl(var(--primary)/0.2)] bg-[hsl(var(--primary)/0.08)] px-2.5 py-1 text-[11px] text-[hsl(var(--primary)/0.8)]";
|
|
6311
|
-
return /* @__PURE__ */
|
|
6400
|
+
return /* @__PURE__ */ jsx27("div", { className: "flex flex-wrap gap-1.5", children: attachments.map((att, index) => {
|
|
6312
6401
|
const Icon = getFileIcon2(att.name);
|
|
6313
6402
|
const key = `${att.uploadedPath ?? att.name}:${att.name}:${index}`;
|
|
6314
|
-
const content = /* @__PURE__ */
|
|
6315
|
-
/* @__PURE__ */
|
|
6316
|
-
/* @__PURE__ */
|
|
6403
|
+
const content = /* @__PURE__ */ jsxs23(Fragment7, { children: [
|
|
6404
|
+
/* @__PURE__ */ jsx27(Icon, { size: 12, className: "shrink-0 text-[hsl(var(--primary)/0.6)]" }),
|
|
6405
|
+
/* @__PURE__ */ jsx27("span", { className: "max-w-40 truncate", children: att.name })
|
|
6317
6406
|
] });
|
|
6318
6407
|
if (onPreview) {
|
|
6319
|
-
return /* @__PURE__ */
|
|
6408
|
+
return /* @__PURE__ */ jsx27(
|
|
6320
6409
|
"button",
|
|
6321
6410
|
{
|
|
6322
6411
|
type: "button",
|
|
@@ -6328,7 +6417,7 @@ function TextAttachmentPills({ attachments, onPreview }) {
|
|
|
6328
6417
|
key
|
|
6329
6418
|
);
|
|
6330
6419
|
}
|
|
6331
|
-
return /* @__PURE__ */
|
|
6420
|
+
return /* @__PURE__ */ jsx27("div", { className: pillClass, title: att.name, children: content }, key);
|
|
6332
6421
|
}) });
|
|
6333
6422
|
}
|
|
6334
6423
|
|
|
@@ -6337,34 +6426,34 @@ import { RefreshCcw } from "lucide-react";
|
|
|
6337
6426
|
|
|
6338
6427
|
// src/react/components/chat/whatif-quote-context.tsx
|
|
6339
6428
|
import { createContext as createContext3, useContext as useContext3, useMemo as useMemo14 } from "react";
|
|
6340
|
-
import { jsx as
|
|
6429
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
6341
6430
|
var WhatIfQuoteContext = createContext3({});
|
|
6342
6431
|
function WhatIfQuoteProvider({
|
|
6343
6432
|
onJumpToStep,
|
|
6344
6433
|
children
|
|
6345
6434
|
}) {
|
|
6346
6435
|
const value = useMemo14(() => ({ onJumpToStep }), [onJumpToStep]);
|
|
6347
|
-
return /* @__PURE__ */
|
|
6436
|
+
return /* @__PURE__ */ jsx28(WhatIfQuoteContext.Provider, { value, children });
|
|
6348
6437
|
}
|
|
6349
6438
|
function useWhatIfQuoteContext() {
|
|
6350
6439
|
return useContext3(WhatIfQuoteContext);
|
|
6351
6440
|
}
|
|
6352
6441
|
|
|
6353
6442
|
// src/react/components/chat/WhatIfUserBubble.tsx
|
|
6354
|
-
import { jsx as
|
|
6443
|
+
import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6355
6444
|
function WhatIfUserBubble({ parsed, onQuoteClick }) {
|
|
6356
6445
|
const { onJumpToStep } = useWhatIfQuoteContext();
|
|
6357
6446
|
const handleQuoteClick = onQuoteClick ?? onJumpToStep;
|
|
6358
6447
|
const { fromStep, quotes, userText } = parsed;
|
|
6359
|
-
return /* @__PURE__ */
|
|
6360
|
-
/* @__PURE__ */
|
|
6361
|
-
/* @__PURE__ */
|
|
6362
|
-
/* @__PURE__ */
|
|
6448
|
+
return /* @__PURE__ */ jsxs24("div", { className: "flex flex-col items-end gap-2", children: [
|
|
6449
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-1.5 rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.5)] px-2.5 py-0.5 text-[10px] text-[hsl(var(--muted-foreground))]", children: [
|
|
6450
|
+
/* @__PURE__ */ jsx29(RefreshCcw, { size: 10 }),
|
|
6451
|
+
/* @__PURE__ */ jsx29("span", { children: fromStep != null ? `\u91CD\u8DD1\u81EA step ${fromStep}` : "\u91CD\u8DD1" })
|
|
6363
6452
|
] }),
|
|
6364
|
-
quotes.length > 0 && /* @__PURE__ */
|
|
6453
|
+
quotes.length > 0 && /* @__PURE__ */ jsx29("div", { className: "flex flex-wrap justify-end gap-1.5", children: quotes.map((q, i) => {
|
|
6365
6454
|
const clickable = q.stepNumber != null && !!handleQuoteClick;
|
|
6366
6455
|
const label = q.stepNumber != null ? `\u6B65\u9AA4${q.stepNumber} \xB7 ${q.label}` : q.label;
|
|
6367
|
-
return /* @__PURE__ */
|
|
6456
|
+
return /* @__PURE__ */ jsxs24(
|
|
6368
6457
|
"button",
|
|
6369
6458
|
{
|
|
6370
6459
|
type: "button",
|
|
@@ -6373,14 +6462,14 @@ function WhatIfUserBubble({ parsed, onQuoteClick }) {
|
|
|
6373
6462
|
className: "inline-flex items-center gap-1 rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-2.5 py-0.5 text-[11px] text-[hsl(var(--muted-foreground))] transition-colors hover:border-[hsl(var(--ring)/0.5)] hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))] disabled:cursor-default disabled:hover:border-[hsl(var(--border))] disabled:hover:bg-[hsl(var(--card))]",
|
|
6374
6463
|
title: clickable ? "\u8DF3\u8F6C\u5230\u5BF9\u5E94\u6B65\u9AA4\u5361\u7247" : void 0,
|
|
6375
6464
|
children: [
|
|
6376
|
-
/* @__PURE__ */
|
|
6377
|
-
/* @__PURE__ */
|
|
6465
|
+
/* @__PURE__ */ jsx29("span", { children: "\u21B3" }),
|
|
6466
|
+
/* @__PURE__ */ jsx29("span", { className: "max-w-[14rem] truncate", children: label })
|
|
6378
6467
|
]
|
|
6379
6468
|
},
|
|
6380
6469
|
`${q.stepNumber ?? "x"}-${i}`
|
|
6381
6470
|
);
|
|
6382
6471
|
}) }),
|
|
6383
|
-
userText && /* @__PURE__ */
|
|
6472
|
+
userText && /* @__PURE__ */ jsx29("div", { className: "rounded-2xl border border-[hsl(var(--user-msg-border))] bg-[hsl(var(--user-msg-bg))] px-4 py-2.5 text-sm leading-relaxed text-[hsl(var(--user-msg-fg))] shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]", children: /* @__PURE__ */ jsx29(
|
|
6384
6473
|
MarkdownContent,
|
|
6385
6474
|
{
|
|
6386
6475
|
className: "prose prose-sm prose-invert max-w-none [&_li>p]:inline [&_p]:mb-3 [&_p:last-child]:mb-0",
|
|
@@ -6392,7 +6481,7 @@ function WhatIfUserBubble({ parsed, onQuoteClick }) {
|
|
|
6392
6481
|
}
|
|
6393
6482
|
|
|
6394
6483
|
// src/react/components/chat/UserMessageBubble.tsx
|
|
6395
|
-
import { jsx as
|
|
6484
|
+
import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6396
6485
|
function isUserMessage(message) {
|
|
6397
6486
|
return message.role === "user";
|
|
6398
6487
|
}
|
|
@@ -6422,9 +6511,9 @@ function UserMessageBubble({ message, className }) {
|
|
|
6422
6511
|
const trimmedClean = cleanText.trim();
|
|
6423
6512
|
const whatifParsed = trimmedClean && imageParts.length === 0 && fileParts.length === 0 && textAttachments.length === 0 ? parseWhatIfPrompt(cleanText) : null;
|
|
6424
6513
|
if (whatifParsed) {
|
|
6425
|
-
return /* @__PURE__ */
|
|
6426
|
-
/* @__PURE__ */
|
|
6427
|
-
whatifParsed.userText && /* @__PURE__ */
|
|
6514
|
+
return /* @__PURE__ */ jsx30("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs25("div", { className: "group flex max-w-[72%] flex-col items-end gap-2", children: [
|
|
6515
|
+
/* @__PURE__ */ jsx30(WhatIfUserBubble, { parsed: whatifParsed }),
|
|
6516
|
+
whatifParsed.userText && /* @__PURE__ */ jsx30(
|
|
6428
6517
|
MessageActions,
|
|
6429
6518
|
{
|
|
6430
6519
|
content: whatifParsed.userText,
|
|
@@ -6496,16 +6585,16 @@ function UserMessageBubble({ message, className }) {
|
|
|
6496
6585
|
const mode = kind === "text" ? lower2.endsWith(".md") ? "markdown" : "text" : "default";
|
|
6497
6586
|
setPreview({ filename: attachment.name, url, mode });
|
|
6498
6587
|
};
|
|
6499
|
-
return /* @__PURE__ */
|
|
6500
|
-
(imageParts.length > 0 || imageTextAttachmentMeta.length > 0) && /* @__PURE__ */
|
|
6501
|
-
imageParts.map((part, idx) => /* @__PURE__ */
|
|
6588
|
+
return /* @__PURE__ */ jsx30("div", { className: cn("flex justify-end", className), children: /* @__PURE__ */ jsxs25("div", { className: "group flex max-w-[72%] flex-col items-end gap-3", children: [
|
|
6589
|
+
(imageParts.length > 0 || imageTextAttachmentMeta.length > 0) && /* @__PURE__ */ jsxs25("div", { className: "grid gap-2", children: [
|
|
6590
|
+
imageParts.map((part, idx) => /* @__PURE__ */ jsx30(
|
|
6502
6591
|
"button",
|
|
6503
6592
|
{
|
|
6504
6593
|
type: "button",
|
|
6505
6594
|
onClick: () => setLightboxIndex(idx),
|
|
6506
6595
|
className: "cursor-zoom-in",
|
|
6507
6596
|
title: "\u67E5\u770B\u5927\u56FE",
|
|
6508
|
-
children: /* @__PURE__ */
|
|
6597
|
+
children: /* @__PURE__ */ jsx30(
|
|
6509
6598
|
"img",
|
|
6510
6599
|
{
|
|
6511
6600
|
src: part.image_url.url,
|
|
@@ -6518,14 +6607,14 @@ function UserMessageBubble({ message, className }) {
|
|
|
6518
6607
|
)),
|
|
6519
6608
|
imageTextAttachmentMeta.map((att, idx) => {
|
|
6520
6609
|
const blobUrl = imageAttachmentQueries[idx]?.data;
|
|
6521
|
-
return blobUrl ? /* @__PURE__ */
|
|
6610
|
+
return blobUrl ? /* @__PURE__ */ jsx30(
|
|
6522
6611
|
"button",
|
|
6523
6612
|
{
|
|
6524
6613
|
type: "button",
|
|
6525
6614
|
onClick: () => setLightboxIndex(imageParts.length + idx),
|
|
6526
6615
|
className: "cursor-zoom-in",
|
|
6527
6616
|
title: "\u67E5\u770B\u5927\u56FE",
|
|
6528
|
-
children: /* @__PURE__ */
|
|
6617
|
+
children: /* @__PURE__ */ jsx30(
|
|
6529
6618
|
"img",
|
|
6530
6619
|
{
|
|
6531
6620
|
src: blobUrl,
|
|
@@ -6535,7 +6624,7 @@ function UserMessageBubble({ message, className }) {
|
|
|
6535
6624
|
)
|
|
6536
6625
|
},
|
|
6537
6626
|
`${att.uploadedPath}:${att.name}`
|
|
6538
|
-
) : imageAttachmentQueries[idx]?.isError ? null : /* @__PURE__ */
|
|
6627
|
+
) : imageAttachmentQueries[idx]?.isError ? null : /* @__PURE__ */ jsx30(
|
|
6539
6628
|
"div",
|
|
6540
6629
|
{
|
|
6541
6630
|
className: "flex h-20 items-center justify-center rounded-xl border border-[hsl(var(--user-msg-border))] bg-[hsl(var(--muted)/0.3)] text-xs text-[hsl(var(--muted-foreground))]",
|
|
@@ -6545,7 +6634,7 @@ function UserMessageBubble({ message, className }) {
|
|
|
6545
6634
|
);
|
|
6546
6635
|
})
|
|
6547
6636
|
] }),
|
|
6548
|
-
lightboxImages.length > 0 && /* @__PURE__ */
|
|
6637
|
+
lightboxImages.length > 0 && /* @__PURE__ */ jsx30(
|
|
6549
6638
|
ImageLightbox,
|
|
6550
6639
|
{
|
|
6551
6640
|
open: lightboxIndex != null,
|
|
@@ -6556,15 +6645,15 @@ function UserMessageBubble({ message, className }) {
|
|
|
6556
6645
|
initialIndex: lightboxIndex ?? 0
|
|
6557
6646
|
}
|
|
6558
6647
|
),
|
|
6559
|
-
/* @__PURE__ */
|
|
6560
|
-
/* @__PURE__ */
|
|
6648
|
+
/* @__PURE__ */ jsx30(MessageFileAttachmentList, { files: fileParts }),
|
|
6649
|
+
/* @__PURE__ */ jsx30(
|
|
6561
6650
|
TextAttachmentPills,
|
|
6562
6651
|
{
|
|
6563
6652
|
attachments: nonImageTextAttachments,
|
|
6564
6653
|
onPreview: handleTextAttachmentPreview
|
|
6565
6654
|
}
|
|
6566
6655
|
),
|
|
6567
|
-
preview && /* @__PURE__ */
|
|
6656
|
+
preview && /* @__PURE__ */ jsx30(
|
|
6568
6657
|
AttachmentPreviewDialog,
|
|
6569
6658
|
{
|
|
6570
6659
|
open: preview != null,
|
|
@@ -6576,8 +6665,8 @@ function UserMessageBubble({ message, className }) {
|
|
|
6576
6665
|
mode: preview.mode
|
|
6577
6666
|
}
|
|
6578
6667
|
),
|
|
6579
|
-
/* @__PURE__ */
|
|
6580
|
-
trimmedClean && /* @__PURE__ */
|
|
6668
|
+
/* @__PURE__ */ jsx30(MessageContextPills, { contexts: textContexts }),
|
|
6669
|
+
trimmedClean && /* @__PURE__ */ jsx30("div", { className: "max-w-full rounded-2xl border border-[hsl(var(--user-msg-border))] bg-[hsl(var(--user-msg-bg))] px-4 py-2.5 text-sm leading-relaxed text-[hsl(var(--user-msg-fg))] shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]", children: /* @__PURE__ */ jsx30(
|
|
6581
6670
|
MarkdownContent,
|
|
6582
6671
|
{
|
|
6583
6672
|
className: USER_MESSAGE_MARKDOWN_CLASS,
|
|
@@ -6585,10 +6674,10 @@ function UserMessageBubble({ message, className }) {
|
|
|
6585
6674
|
children: cleanText
|
|
6586
6675
|
}
|
|
6587
6676
|
) }),
|
|
6588
|
-
trimmedClean && (isSending(message) ? /* @__PURE__ */
|
|
6589
|
-
/* @__PURE__ */
|
|
6590
|
-
/* @__PURE__ */
|
|
6591
|
-
] }) : /* @__PURE__ */
|
|
6677
|
+
trimmedClean && (isSending(message) ? /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-1.5 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
6678
|
+
/* @__PURE__ */ jsx30(Loader24, { size: 12, className: "animate-spin" }),
|
|
6679
|
+
/* @__PURE__ */ jsx30("span", { children: "\u53D1\u9001\u4E2D" })
|
|
6680
|
+
] }) : /* @__PURE__ */ jsx30(
|
|
6592
6681
|
MessageActions,
|
|
6593
6682
|
{
|
|
6594
6683
|
content: cleanText,
|
|
@@ -6603,14 +6692,14 @@ function ErrorMessageBlock({
|
|
|
6603
6692
|
}) {
|
|
6604
6693
|
const text = getTextContent(message.content);
|
|
6605
6694
|
const looksLikeModelUnavailable = /no source matches this model|404/i.test(text);
|
|
6606
|
-
return /* @__PURE__ */
|
|
6695
|
+
return /* @__PURE__ */ jsx30("div", { className: cn("flex justify-center", className), children: /* @__PURE__ */ jsxs25("div", { className: "max-w-[85%] border-l-[3px] border-[hsl(var(--destructive))] px-4 py-1 text-sm leading-7 text-[hsl(var(--destructive))]", children: [
|
|
6607
6696
|
text,
|
|
6608
|
-
looksLikeModelUnavailable ? /* @__PURE__ */
|
|
6697
|
+
looksLikeModelUnavailable ? /* @__PURE__ */ jsx30("div", { className: "mt-1 opacity-80", children: "\u6A21\u578B\u53EF\u80FD\u672A\u542F\u52A8\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002" }) : null
|
|
6609
6698
|
] }) });
|
|
6610
6699
|
}
|
|
6611
6700
|
|
|
6612
6701
|
// src/react/components/chat/AgentLoopBlock.tsx
|
|
6613
|
-
import { Fragment as Fragment8, jsx as
|
|
6702
|
+
import { Fragment as Fragment8, jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6614
6703
|
var EMPTY_MESSAGES2 = [];
|
|
6615
6704
|
var EMPTY_AGENT_LOOPS = {};
|
|
6616
6705
|
var COLLAPSED_SUMMARY_HIDDEN_TOOLS = /* @__PURE__ */ new Set(["ReadSkill", "Read"]);
|
|
@@ -6710,7 +6799,7 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6710
6799
|
const description = safeParseDescription(toolCall.arguments);
|
|
6711
6800
|
const status = hasAwaitingAnswer || toolCall.status === "awaiting_answer" ? "awaiting_answer" : toolCall.status === "pending" || loopEntry?.info.status === "running" ? "running" : "done";
|
|
6712
6801
|
const cardStyles = getLoopCardStyles(status);
|
|
6713
|
-
return /* @__PURE__ */
|
|
6802
|
+
return /* @__PURE__ */ jsxs26(
|
|
6714
6803
|
"div",
|
|
6715
6804
|
{
|
|
6716
6805
|
className: cn(
|
|
@@ -6718,8 +6807,8 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6718
6807
|
cardStyles.borderClass
|
|
6719
6808
|
),
|
|
6720
6809
|
children: [
|
|
6721
|
-
status === "running" || status === "awaiting_answer" ? /* @__PURE__ */
|
|
6722
|
-
/* @__PURE__ */
|
|
6810
|
+
status === "running" || status === "awaiting_answer" ? /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
6811
|
+
/* @__PURE__ */ jsxs26(
|
|
6723
6812
|
"div",
|
|
6724
6813
|
{
|
|
6725
6814
|
className: cn(
|
|
@@ -6727,24 +6816,24 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6727
6816
|
cardStyles.headerClass
|
|
6728
6817
|
),
|
|
6729
6818
|
children: [
|
|
6730
|
-
/* @__PURE__ */
|
|
6819
|
+
/* @__PURE__ */ jsx31(
|
|
6731
6820
|
"button",
|
|
6732
6821
|
{
|
|
6733
6822
|
type: "button",
|
|
6734
6823
|
onClick: toggleExpanded,
|
|
6735
6824
|
"aria-expanded": expanded,
|
|
6736
6825
|
className: "flex min-w-0 flex-1 items-center gap-2 text-left focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
6737
|
-
children: /* @__PURE__ */
|
|
6738
|
-
status === "awaiting_answer" ? /* @__PURE__ */
|
|
6739
|
-
/* @__PURE__ */
|
|
6826
|
+
children: /* @__PURE__ */ jsxs26("span", { className: "min-w-0 flex items-center gap-2", children: [
|
|
6827
|
+
status === "awaiting_answer" ? /* @__PURE__ */ jsx31(MessageSquareMore2, { size: 14, className: "shrink-0 text-amber-500" }) : /* @__PURE__ */ jsx31(Bot, { size: 14, className: "shrink-0 text-blue-500" }),
|
|
6828
|
+
/* @__PURE__ */ jsxs26("span", { className: "truncate text-sm font-medium text-[hsl(var(--foreground))]", children: [
|
|
6740
6829
|
description,
|
|
6741
6830
|
status === "awaiting_answer" ? " \u2014 \u7B49\u5F85\u56DE\u7B54" : ""
|
|
6742
6831
|
] })
|
|
6743
6832
|
] })
|
|
6744
6833
|
}
|
|
6745
6834
|
),
|
|
6746
|
-
reasoning ? /* @__PURE__ */
|
|
6747
|
-
/* @__PURE__ */
|
|
6835
|
+
reasoning ? /* @__PURE__ */ jsx31(ThinkingBadge, { reasoning, variant: "block" }) : null,
|
|
6836
|
+
/* @__PURE__ */ jsx31(
|
|
6748
6837
|
Bot,
|
|
6749
6838
|
{
|
|
6750
6839
|
size: 13,
|
|
@@ -6752,14 +6841,14 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6752
6841
|
"aria-label": "\u5B50\u667A\u80FD\u4F53"
|
|
6753
6842
|
}
|
|
6754
6843
|
),
|
|
6755
|
-
/* @__PURE__ */
|
|
6844
|
+
/* @__PURE__ */ jsx31(
|
|
6756
6845
|
"button",
|
|
6757
6846
|
{
|
|
6758
6847
|
type: "button",
|
|
6759
6848
|
onClick: toggleExpanded,
|
|
6760
6849
|
"aria-expanded": expanded,
|
|
6761
6850
|
className: "inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-[hsl(var(--muted-foreground))] transition-colors hover:bg-[hsl(var(--muted))] focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
6762
|
-
children: /* @__PURE__ */
|
|
6851
|
+
children: /* @__PURE__ */ jsx31(
|
|
6763
6852
|
ChevronRight4,
|
|
6764
6853
|
{
|
|
6765
6854
|
size: 14,
|
|
@@ -6774,7 +6863,7 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6774
6863
|
]
|
|
6775
6864
|
}
|
|
6776
6865
|
),
|
|
6777
|
-
!expanded ? /* @__PURE__ */
|
|
6866
|
+
!expanded ? /* @__PURE__ */ jsx31("div", { className: "flex flex-col gap-1 py-2", children: visibleLoopToolCalls.length > 0 ? visibleLoopToolCalls.map((childToolCall) => /* @__PURE__ */ jsx31(
|
|
6778
6867
|
ToolCallBlock,
|
|
6779
6868
|
{
|
|
6780
6869
|
toolCall: childToolCall,
|
|
@@ -6782,12 +6871,12 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6782
6871
|
level: 2
|
|
6783
6872
|
},
|
|
6784
6873
|
childToolCall.id
|
|
6785
|
-
)) : /* @__PURE__ */
|
|
6786
|
-
/* @__PURE__ */
|
|
6787
|
-
/* @__PURE__ */
|
|
6788
|
-
] }) }) : status === "awaiting_answer" ? /* @__PURE__ */
|
|
6789
|
-
] }) : /* @__PURE__ */
|
|
6790
|
-
/* @__PURE__ */
|
|
6874
|
+
)) : /* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2 px-4 py-1 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
6875
|
+
/* @__PURE__ */ jsx31(Loader25, { size: 12, className: "shrink-0 animate-spin text-blue-500" }),
|
|
6876
|
+
/* @__PURE__ */ jsx31("span", { children: "\u6B63\u5728\u542F\u52A8..." })
|
|
6877
|
+
] }) }) : status === "awaiting_answer" ? /* @__PURE__ */ jsx31("div", { className: "flex flex-col gap-1 py-2", children: /* @__PURE__ */ jsx31("div", { className: "px-4 py-1 text-xs text-[hsl(var(--muted-foreground))]", children: "\u8BF7\u5728\u4E0B\u65B9\u5B50\u667A\u80FD\u4F53\u5BF9\u8BDD\u4E2D\u5B8C\u6210\u786E\u8BA4" }) }) : null
|
|
6878
|
+
] }) : /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
6879
|
+
/* @__PURE__ */ jsxs26(
|
|
6791
6880
|
"div",
|
|
6792
6881
|
{
|
|
6793
6882
|
className: cn(
|
|
@@ -6795,21 +6884,21 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6795
6884
|
cardStyles.headerClass
|
|
6796
6885
|
),
|
|
6797
6886
|
children: [
|
|
6798
|
-
/* @__PURE__ */
|
|
6887
|
+
/* @__PURE__ */ jsx31(
|
|
6799
6888
|
"button",
|
|
6800
6889
|
{
|
|
6801
6890
|
type: "button",
|
|
6802
6891
|
onClick: toggleExpanded,
|
|
6803
6892
|
"aria-expanded": expanded,
|
|
6804
6893
|
className: "flex min-w-0 flex-1 items-center gap-2 text-left focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
6805
|
-
children: /* @__PURE__ */
|
|
6806
|
-
/* @__PURE__ */
|
|
6807
|
-
/* @__PURE__ */
|
|
6894
|
+
children: /* @__PURE__ */ jsxs26("span", { className: "min-w-0 flex items-center gap-2", children: [
|
|
6895
|
+
/* @__PURE__ */ jsx31(Check4, { size: 14, className: "shrink-0 text-emerald-500" }),
|
|
6896
|
+
/* @__PURE__ */ jsx31("span", { className: "truncate text-sm font-medium text-[hsl(var(--foreground))]", children: description })
|
|
6808
6897
|
] })
|
|
6809
6898
|
}
|
|
6810
6899
|
),
|
|
6811
|
-
reasoning ? /* @__PURE__ */
|
|
6812
|
-
/* @__PURE__ */
|
|
6900
|
+
reasoning ? /* @__PURE__ */ jsx31(ThinkingBadge, { reasoning, variant: "block" }) : null,
|
|
6901
|
+
/* @__PURE__ */ jsx31(
|
|
6813
6902
|
Bot,
|
|
6814
6903
|
{
|
|
6815
6904
|
size: 13,
|
|
@@ -6817,14 +6906,14 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6817
6906
|
"aria-label": "\u5B50\u667A\u80FD\u4F53"
|
|
6818
6907
|
}
|
|
6819
6908
|
),
|
|
6820
|
-
/* @__PURE__ */
|
|
6909
|
+
/* @__PURE__ */ jsx31(
|
|
6821
6910
|
"button",
|
|
6822
6911
|
{
|
|
6823
6912
|
type: "button",
|
|
6824
6913
|
onClick: toggleExpanded,
|
|
6825
6914
|
"aria-expanded": expanded,
|
|
6826
6915
|
className: "inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-[hsl(var(--muted-foreground))] transition-colors hover:bg-[hsl(var(--muted))] focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
6827
|
-
children: /* @__PURE__ */
|
|
6916
|
+
children: /* @__PURE__ */ jsx31(
|
|
6828
6917
|
ChevronRight4,
|
|
6829
6918
|
{
|
|
6830
6919
|
size: 14,
|
|
@@ -6839,9 +6928,9 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6839
6928
|
]
|
|
6840
6929
|
}
|
|
6841
6930
|
),
|
|
6842
|
-
!expanded ? /* @__PURE__ */
|
|
6843
|
-
/* @__PURE__ */
|
|
6844
|
-
(item) => item.kind === "file" ? /* @__PURE__ */
|
|
6931
|
+
!expanded ? /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
6932
|
+
/* @__PURE__ */ jsx31("div", { className: "flex flex-wrap gap-1.5 px-4 py-2", children: completedToolLabels.length > 0 ? completedToolLabels.map(
|
|
6933
|
+
(item) => item.kind === "file" ? /* @__PURE__ */ jsxs26(
|
|
6845
6934
|
"span",
|
|
6846
6935
|
{
|
|
6847
6936
|
className: "inline-flex min-w-0 items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-semibold dark:border-emerald-500/25 dark:bg-emerald-500/10 dark:text-emerald-300",
|
|
@@ -6852,12 +6941,12 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6852
6941
|
},
|
|
6853
6942
|
title: item.label,
|
|
6854
6943
|
children: [
|
|
6855
|
-
/* @__PURE__ */
|
|
6856
|
-
/* @__PURE__ */
|
|
6944
|
+
/* @__PURE__ */ jsx31(FileText6, { size: 12, className: "shrink-0", "aria-hidden": "true" }),
|
|
6945
|
+
/* @__PURE__ */ jsx31("span", { className: "truncate", children: item.label })
|
|
6857
6946
|
]
|
|
6858
6947
|
},
|
|
6859
6948
|
item.key
|
|
6860
|
-
) : /* @__PURE__ */
|
|
6949
|
+
) : /* @__PURE__ */ jsx31(
|
|
6861
6950
|
"span",
|
|
6862
6951
|
{
|
|
6863
6952
|
className: "inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-semibold dark:border-blue-300 dark:bg-blue-400/10 dark:text-blue-300",
|
|
@@ -6870,20 +6959,20 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6870
6959
|
},
|
|
6871
6960
|
item.key
|
|
6872
6961
|
)
|
|
6873
|
-
) : /* @__PURE__ */
|
|
6874
|
-
inlineToolUiBlocks.length > 0 ? /* @__PURE__ */
|
|
6962
|
+
) : /* @__PURE__ */ jsx31("span", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u6682\u65E0\u5DE5\u5177\u8C03\u7528" }) }),
|
|
6963
|
+
inlineToolUiBlocks.length > 0 ? /* @__PURE__ */ jsx31("div", { className: "flex flex-col gap-2 px-4 pb-3", children: inlineToolUiBlocks.map((block) => /* @__PURE__ */ jsx31(ResourceIframe, { ui: block.ui, sessionId }, block.key)) }) : null
|
|
6875
6964
|
] }) : null
|
|
6876
6965
|
] }),
|
|
6877
|
-
expanded && /* @__PURE__ */
|
|
6966
|
+
expanded && /* @__PURE__ */ jsxs26("div", { className: "border-t border-[hsl(var(--border))] py-2", children: [
|
|
6878
6967
|
(() => {
|
|
6879
6968
|
const taskPrompt = safeParsePrompt(toolCall.arguments);
|
|
6880
|
-
return taskPrompt ? /* @__PURE__ */
|
|
6881
|
-
/* @__PURE__ */
|
|
6882
|
-
/* @__PURE__ */
|
|
6969
|
+
return taskPrompt ? /* @__PURE__ */ jsxs26("details", { className: "mx-3 mb-2 rounded-md bg-[hsl(var(--muted))]/40", children: [
|
|
6970
|
+
/* @__PURE__ */ jsx31("summary", { className: "cursor-pointer px-3 py-1.5 text-[11px] font-medium text-[hsl(var(--muted-foreground))]", children: "\u4EFB\u52A1" }),
|
|
6971
|
+
/* @__PURE__ */ jsx31("div", { className: "px-3 pb-2", children: /* @__PURE__ */ jsx31("pre", { className: "whitespace-pre-wrap text-[11px] leading-relaxed text-[hsl(var(--foreground))]", children: taskPrompt }) })
|
|
6883
6972
|
] }) : null;
|
|
6884
6973
|
})(),
|
|
6885
|
-
childMessages.length > 0 ? /* @__PURE__ */
|
|
6886
|
-
(message, index) => message.role === "assistant" ? /* @__PURE__ */
|
|
6974
|
+
childMessages.length > 0 ? /* @__PURE__ */ jsx31("div", { className: "flex flex-col gap-3 px-3", children: childMessages.map(
|
|
6975
|
+
(message, index) => message.role === "assistant" ? /* @__PURE__ */ jsx31(
|
|
6887
6976
|
ExpandedChildAssistantMessage,
|
|
6888
6977
|
{
|
|
6889
6978
|
message,
|
|
@@ -6891,13 +6980,13 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6891
6980
|
isStreaming: message.status === "streaming"
|
|
6892
6981
|
},
|
|
6893
6982
|
message.entry_id ?? `${message.timestamp ?? "child"}-${index}`
|
|
6894
|
-
) : message.role === "user" ? /* @__PURE__ */
|
|
6983
|
+
) : message.role === "user" ? /* @__PURE__ */ jsx31(
|
|
6895
6984
|
ExpandedChildUserMessage,
|
|
6896
6985
|
{
|
|
6897
6986
|
message
|
|
6898
6987
|
},
|
|
6899
6988
|
message.entry_id ?? `${message.timestamp ?? "user"}-${index}`
|
|
6900
|
-
) : message.role === "error" ? /* @__PURE__ */
|
|
6989
|
+
) : message.role === "error" ? /* @__PURE__ */ jsx31(
|
|
6901
6990
|
"div",
|
|
6902
6991
|
{
|
|
6903
6992
|
className: "border-l-[2px] border-l-red-500 px-3 py-2 text-[11px] text-red-200",
|
|
@@ -6905,17 +6994,17 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6905
6994
|
},
|
|
6906
6995
|
message.entry_id ?? `${message.timestamp ?? "error"}-${index}`
|
|
6907
6996
|
) : null
|
|
6908
|
-
) }) : status === "running" ? /* @__PURE__ */
|
|
6909
|
-
/* @__PURE__ */
|
|
6997
|
+
) }) : status === "running" ? /* @__PURE__ */ jsxs26("div", { className: "px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
6998
|
+
/* @__PURE__ */ jsx31(Loader25, { size: 12, className: "mr-1.5 inline animate-spin" }),
|
|
6910
6999
|
"\u6B63\u5728\u542F\u52A8..."
|
|
6911
|
-
] }) : toolCall.result ? /* @__PURE__ */
|
|
7000
|
+
] }) : toolCall.result ? /* @__PURE__ */ jsx31("pre", { className: "max-h-[400px] overflow-auto px-3 py-2 whitespace-pre-wrap text-[11px] text-[hsl(var(--muted-foreground))]", children: typeof toolCall.result === "string" ? toolCall.result : JSON.stringify(toolCall.result, null, 2) }) : null
|
|
6912
7001
|
] })
|
|
6913
7002
|
]
|
|
6914
7003
|
}
|
|
6915
7004
|
);
|
|
6916
7005
|
}
|
|
6917
7006
|
function ExpandedChildUserMessage({ message }) {
|
|
6918
|
-
return /* @__PURE__ */
|
|
7007
|
+
return /* @__PURE__ */ jsx31("div", { className: "pl-8", children: /* @__PURE__ */ jsx31(UserMessageBubble, { message }) });
|
|
6919
7008
|
}
|
|
6920
7009
|
function ExpandedChildAssistantMessage({
|
|
6921
7010
|
message,
|
|
@@ -6925,12 +7014,12 @@ function ExpandedChildAssistantMessage({
|
|
|
6925
7014
|
const text = typeof message.content === "string" ? message.content.trim() : message.content.filter((part) => part.type === "text").map((part) => part.text).join("").trim();
|
|
6926
7015
|
const toolCalls = message.tool_calls ?? [];
|
|
6927
7016
|
const hasToolCalls = toolCalls.length > 0;
|
|
6928
|
-
return /* @__PURE__ */
|
|
6929
|
-
message.reasoning && /* @__PURE__ */
|
|
6930
|
-
/* @__PURE__ */
|
|
6931
|
-
/* @__PURE__ */
|
|
7017
|
+
return /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-2", children: [
|
|
7018
|
+
message.reasoning && /* @__PURE__ */ jsxs26(Reasoning, { isStreaming, children: [
|
|
7019
|
+
/* @__PURE__ */ jsx31(ReasoningTrigger, { wordCount: message.reasoning.length }),
|
|
7020
|
+
/* @__PURE__ */ jsx31(ReasoningContent, { children: message.reasoning })
|
|
6932
7021
|
] }),
|
|
6933
|
-
text ? /* @__PURE__ */
|
|
7022
|
+
text ? /* @__PURE__ */ jsx31(
|
|
6934
7023
|
ChildText,
|
|
6935
7024
|
{
|
|
6936
7025
|
text,
|
|
@@ -6939,9 +7028,9 @@ function ExpandedChildAssistantMessage({
|
|
|
6939
7028
|
reasoning: void 0
|
|
6940
7029
|
}
|
|
6941
7030
|
) : null,
|
|
6942
|
-
!text && isStreaming && /* @__PURE__ */
|
|
6943
|
-
hasToolCalls && /* @__PURE__ */
|
|
6944
|
-
(toolCall) => formatToolName(toolCall.name) === "Agent" ? /* @__PURE__ */
|
|
7031
|
+
!text && isStreaming && /* @__PURE__ */ jsx31("span", { className: "pl-8 text-[12px] text-[hsl(var(--muted-foreground))]", children: "\u6B63\u5728\u751F\u6210..." }),
|
|
7032
|
+
hasToolCalls && /* @__PURE__ */ jsx31("div", { className: "flex flex-col gap-2", children: toolCalls.map(
|
|
7033
|
+
(toolCall) => formatToolName(toolCall.name) === "Agent" ? /* @__PURE__ */ jsx31(
|
|
6945
7034
|
AgentLoopBlock,
|
|
6946
7035
|
{
|
|
6947
7036
|
toolCall,
|
|
@@ -6949,7 +7038,7 @@ function ExpandedChildAssistantMessage({
|
|
|
6949
7038
|
reasoning: void 0
|
|
6950
7039
|
},
|
|
6951
7040
|
toolCall.id
|
|
6952
|
-
) : /* @__PURE__ */
|
|
7041
|
+
) : /* @__PURE__ */ jsx31(
|
|
6953
7042
|
ToolCallBlock,
|
|
6954
7043
|
{
|
|
6955
7044
|
toolCall,
|
|
@@ -6961,8 +7050,8 @@ function ExpandedChildAssistantMessage({
|
|
|
6961
7050
|
toolCall.id
|
|
6962
7051
|
)
|
|
6963
7052
|
) }),
|
|
6964
|
-
message.blocks?.some((block) => block.type === "tool_ui") ? /* @__PURE__ */
|
|
6965
|
-
(block, index) => block.type === "tool_ui" && block.tool_call_id && isUiMeta(block.content) && block.content.target === "inline" ? /* @__PURE__ */
|
|
7053
|
+
message.blocks?.some((block) => block.type === "tool_ui") ? /* @__PURE__ */ jsx31("div", { className: "flex flex-col gap-2", children: message.blocks.map(
|
|
7054
|
+
(block, index) => block.type === "tool_ui" && block.tool_call_id && isUiMeta(block.content) && block.content.target === "inline" ? /* @__PURE__ */ jsx31("div", { className: "ml-4", children: /* @__PURE__ */ jsx31(ResourceIframe, { ui: block.content, sessionId }) }, `${block.tool_call_id}-${index}`) : null
|
|
6966
7055
|
) }) : null
|
|
6967
7056
|
] });
|
|
6968
7057
|
}
|
|
@@ -6972,8 +7061,8 @@ function ChildText({
|
|
|
6972
7061
|
sessionId,
|
|
6973
7062
|
reasoning
|
|
6974
7063
|
}) {
|
|
6975
|
-
return /* @__PURE__ */
|
|
6976
|
-
/* @__PURE__ */
|
|
7064
|
+
return /* @__PURE__ */ jsxs26("div", { className: "pl-8 text-[12px] leading-6 text-[hsl(var(--foreground))]", children: [
|
|
7065
|
+
/* @__PURE__ */ jsx31(
|
|
6977
7066
|
MarkdownContent,
|
|
6978
7067
|
{
|
|
6979
7068
|
mode: "streaming",
|
|
@@ -6983,8 +7072,8 @@ function ChildText({
|
|
|
6983
7072
|
children: text
|
|
6984
7073
|
}
|
|
6985
7074
|
),
|
|
6986
|
-
isStreaming && /* @__PURE__ */
|
|
6987
|
-
reasoning ? /* @__PURE__ */
|
|
7075
|
+
isStreaming && /* @__PURE__ */ jsx31("span", { className: "ml-0.5 inline-block h-[1em] w-[3px] animate-pulse rounded-sm bg-current opacity-60" }),
|
|
7076
|
+
reasoning ? /* @__PURE__ */ jsx31(ThinkingBadge, { reasoning }) : null
|
|
6988
7077
|
] });
|
|
6989
7078
|
}
|
|
6990
7079
|
function getLoopCardStyles(status) {
|
|
@@ -7024,7 +7113,7 @@ function getLoopCardStyles(status) {
|
|
|
7024
7113
|
}
|
|
7025
7114
|
|
|
7026
7115
|
// src/react/components/chat/AssistantTurnBlock.tsx
|
|
7027
|
-
import { jsx as
|
|
7116
|
+
import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
7028
7117
|
var EMPTY_MESSAGES3 = [];
|
|
7029
7118
|
var EMPTY_AGENT_LOOPS2 = {};
|
|
7030
7119
|
function defaultTurnDisplayMode({
|
|
@@ -7192,7 +7281,7 @@ function AssistantTurnBlockBase({
|
|
|
7192
7281
|
const hasInterruptedState = messages.some((message) => message.status === "interrupted");
|
|
7193
7282
|
const effectiveMode = resolveTurnDisplayMode({ isStreaming, displayMode });
|
|
7194
7283
|
const memoryRefs = Array.isArray(messages[0]?.memory_refs) ? messages[0].memory_refs : [];
|
|
7195
|
-
return /* @__PURE__ */
|
|
7284
|
+
return /* @__PURE__ */ jsxs27(
|
|
7196
7285
|
"div",
|
|
7197
7286
|
{
|
|
7198
7287
|
className: cn(
|
|
@@ -7201,17 +7290,17 @@ function AssistantTurnBlockBase({
|
|
|
7201
7290
|
customization?.classNames?.assistantTurn
|
|
7202
7291
|
),
|
|
7203
7292
|
children: [
|
|
7204
|
-
memoryRefs.length > 0 && /* @__PURE__ */
|
|
7205
|
-
hasInterruptedState && /* @__PURE__ */
|
|
7206
|
-
!isStreaming && /* @__PURE__ */
|
|
7293
|
+
memoryRefs.length > 0 && /* @__PURE__ */ jsx32(MemoryRefsHint, { refs: memoryRefs }),
|
|
7294
|
+
hasInterruptedState && /* @__PURE__ */ jsx32("div", { className: "ml-4 w-fit rounded-full border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.12em] text-amber-300", children: "\u5DF2\u4E2D\u65AD" }),
|
|
7295
|
+
!isStreaming && /* @__PURE__ */ jsx32("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs27(
|
|
7207
7296
|
"button",
|
|
7208
7297
|
{
|
|
7209
7298
|
type: "button",
|
|
7210
7299
|
onClick: () => setDisplayMode(displayMode === "detail" ? "compact" : "detail"),
|
|
7211
7300
|
className: "inline-flex shrink-0 items-center gap-1 text-xs text-[hsl(var(--muted-foreground))] transition-colors hover:text-[hsl(var(--foreground))]",
|
|
7212
7301
|
children: [
|
|
7213
|
-
/* @__PURE__ */
|
|
7214
|
-
/* @__PURE__ */
|
|
7302
|
+
/* @__PURE__ */ jsx32("span", { children: effectiveMode === "detail" ? "\u7CBE\u7B80" : "\u8BE6\u7EC6" }),
|
|
7303
|
+
/* @__PURE__ */ jsx32(
|
|
7215
7304
|
ChevronRight5,
|
|
7216
7305
|
{
|
|
7217
7306
|
size: 18,
|
|
@@ -7221,7 +7310,7 @@ function AssistantTurnBlockBase({
|
|
|
7221
7310
|
]
|
|
7222
7311
|
}
|
|
7223
7312
|
) }),
|
|
7224
|
-
effectiveMode === "detail" ? /* @__PURE__ */
|
|
7313
|
+
effectiveMode === "detail" ? /* @__PURE__ */ jsx32("div", { className: "flex flex-col gap-3", children: /* @__PURE__ */ jsx32(
|
|
7225
7314
|
AssistantMessages,
|
|
7226
7315
|
{
|
|
7227
7316
|
messages,
|
|
@@ -7234,15 +7323,15 @@ function AssistantTurnBlockBase({
|
|
|
7234
7323
|
showToolDetails: true,
|
|
7235
7324
|
customization
|
|
7236
7325
|
}
|
|
7237
|
-
) }) : /* @__PURE__ */
|
|
7238
|
-
resourceBlocks.length > 0 ? /* @__PURE__ */
|
|
7239
|
-
finalMessage ? /* @__PURE__ */
|
|
7326
|
+
) }) : /* @__PURE__ */ jsx32("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-4", children: [
|
|
7327
|
+
resourceBlocks.length > 0 ? /* @__PURE__ */ jsx32("div", { className: "flex flex-col gap-3", children: resourceBlocks.map((block) => /* @__PURE__ */ jsx32(ResourceIframe, { ui: block.ui, sessionId }, block.key)) }) : null,
|
|
7328
|
+
finalMessage ? /* @__PURE__ */ jsx32(
|
|
7240
7329
|
"div",
|
|
7241
7330
|
{
|
|
7242
7331
|
className: cn(
|
|
7243
7332
|
resourceBlocks.length > 0 && "border-t border-[hsl(var(--border))] pt-4"
|
|
7244
7333
|
),
|
|
7245
|
-
children: /* @__PURE__ */
|
|
7334
|
+
children: /* @__PURE__ */ jsx32(
|
|
7246
7335
|
AssistantMessageContent,
|
|
7247
7336
|
{
|
|
7248
7337
|
message: finalMessage,
|
|
@@ -7253,7 +7342,7 @@ function AssistantTurnBlockBase({
|
|
|
7253
7342
|
}
|
|
7254
7343
|
)
|
|
7255
7344
|
}
|
|
7256
|
-
) : isStreaming ? /* @__PURE__ */
|
|
7345
|
+
) : isStreaming ? /* @__PURE__ */ jsx32("span", { className: "text-sm text-[hsl(var(--muted-foreground))]", children: "\u6B63\u5728\u751F\u6210..." }) : null
|
|
7257
7346
|
] }) })
|
|
7258
7347
|
]
|
|
7259
7348
|
}
|
|
@@ -7282,16 +7371,16 @@ function AssistantMessages({
|
|
|
7282
7371
|
const toolCalls = message.tool_calls ?? [];
|
|
7283
7372
|
const hasToolCalls = toolCalls.length > 0;
|
|
7284
7373
|
const toolRenderItems = groupDetailedToolCalls(toolCalls);
|
|
7285
|
-
return /* @__PURE__ */
|
|
7374
|
+
return /* @__PURE__ */ jsxs27(
|
|
7286
7375
|
"div",
|
|
7287
7376
|
{
|
|
7288
7377
|
className: "flex flex-col gap-3",
|
|
7289
7378
|
children: [
|
|
7290
|
-
hasReasoning && /* @__PURE__ */
|
|
7291
|
-
/* @__PURE__ */
|
|
7292
|
-
/* @__PURE__ */
|
|
7379
|
+
hasReasoning && /* @__PURE__ */ jsxs27(Reasoning, { isStreaming: isStreamingLastMessage, children: [
|
|
7380
|
+
/* @__PURE__ */ jsx32(ReasoningTrigger, { wordCount: reasoning.length }),
|
|
7381
|
+
/* @__PURE__ */ jsx32(ReasoningContent, { children: reasoning })
|
|
7293
7382
|
] }),
|
|
7294
|
-
/* @__PURE__ */
|
|
7383
|
+
/* @__PURE__ */ jsx32(
|
|
7295
7384
|
AssistantMessageContent,
|
|
7296
7385
|
{
|
|
7297
7386
|
message,
|
|
@@ -7301,9 +7390,9 @@ function AssistantMessages({
|
|
|
7301
7390
|
className: customization?.classNames?.assistantText
|
|
7302
7391
|
}
|
|
7303
7392
|
),
|
|
7304
|
-
hasToolCalls && showToolDetails && /* @__PURE__ */
|
|
7393
|
+
hasToolCalls && showToolDetails && /* @__PURE__ */ jsx32("div", { className: "flex flex-col gap-2", children: toolRenderItems.map((item) => {
|
|
7305
7394
|
if (item.kind === "read_group") {
|
|
7306
|
-
return /* @__PURE__ */
|
|
7395
|
+
return /* @__PURE__ */ jsx32(
|
|
7307
7396
|
CompactToolGroupBlock,
|
|
7308
7397
|
{
|
|
7309
7398
|
toolCalls: item.toolCalls,
|
|
@@ -7320,7 +7409,7 @@ function AssistantMessages({
|
|
|
7320
7409
|
);
|
|
7321
7410
|
}
|
|
7322
7411
|
const { toolCall } = item;
|
|
7323
|
-
return formatToolName(toolCall.name) === "Agent" ? /* @__PURE__ */
|
|
7412
|
+
return formatToolName(toolCall.name) === "Agent" ? /* @__PURE__ */ jsx32(
|
|
7324
7413
|
AgentLoopBlock,
|
|
7325
7414
|
{
|
|
7326
7415
|
toolCall,
|
|
@@ -7328,7 +7417,7 @@ function AssistantMessages({
|
|
|
7328
7417
|
reasoning: void 0
|
|
7329
7418
|
},
|
|
7330
7419
|
toolCall.id
|
|
7331
|
-
) : customization?.components?.ToolCall ? /* @__PURE__ */
|
|
7420
|
+
) : customization?.components?.ToolCall ? /* @__PURE__ */ jsx32(
|
|
7332
7421
|
customization.components.ToolCall,
|
|
7333
7422
|
{
|
|
7334
7423
|
toolCall,
|
|
@@ -7343,7 +7432,7 @@ function AssistantMessages({
|
|
|
7343
7432
|
customization
|
|
7344
7433
|
},
|
|
7345
7434
|
toolCall.id
|
|
7346
|
-
) : /* @__PURE__ */
|
|
7435
|
+
) : /* @__PURE__ */ jsx32(
|
|
7347
7436
|
ToolCallBlock,
|
|
7348
7437
|
{
|
|
7349
7438
|
toolCall,
|
|
@@ -7360,8 +7449,8 @@ function AssistantMessages({
|
|
|
7360
7449
|
toolCall.id
|
|
7361
7450
|
);
|
|
7362
7451
|
}) }),
|
|
7363
|
-
showToolDetails && message.blocks?.some((block) => block.type === "tool_ui") ? /* @__PURE__ */
|
|
7364
|
-
(block, blockIndex) => block.type === "tool_ui" && block.tool_call_id && isUiMeta(block.content) && block.content.target === "inline" ? /* @__PURE__ */
|
|
7452
|
+
showToolDetails && message.blocks?.some((block) => block.type === "tool_ui") ? /* @__PURE__ */ jsx32("div", { className: "flex flex-col gap-2", children: message.blocks.map(
|
|
7453
|
+
(block, blockIndex) => block.type === "tool_ui" && block.tool_call_id && isUiMeta(block.content) && block.content.target === "inline" ? /* @__PURE__ */ jsx32("div", { className: "ml-4", children: /* @__PURE__ */ jsx32(ResourceIframe, { ui: block.content, sessionId }) }, `${block.tool_call_id}-${blockIndex}`) : null
|
|
7365
7454
|
) }) : null
|
|
7366
7455
|
]
|
|
7367
7456
|
},
|
|
@@ -7409,12 +7498,12 @@ function CompactToolGroupBlock({
|
|
|
7409
7498
|
return filePath ? formatFileName(filePath) : "\u672A\u77E5\u6587\u4EF6";
|
|
7410
7499
|
});
|
|
7411
7500
|
const title = `\u8BFB\u53D6 ${toolCalls.length} \u4E2A\u6587\u4EF6`;
|
|
7412
|
-
return /* @__PURE__ */
|
|
7413
|
-
/* @__PURE__ */
|
|
7501
|
+
return /* @__PURE__ */ jsxs27("div", { className: cn(indentClass, "text-xs"), children: [
|
|
7502
|
+
/* @__PURE__ */ jsxs27("div", { className: cn(
|
|
7414
7503
|
"flex items-center gap-2 border-l-[3px] px-3 py-2",
|
|
7415
7504
|
hasError ? "border-l-[hsl(var(--destructive))]" : "border-l-[hsl(var(--primary))]"
|
|
7416
7505
|
), children: [
|
|
7417
|
-
/* @__PURE__ */
|
|
7506
|
+
/* @__PURE__ */ jsxs27(
|
|
7418
7507
|
"button",
|
|
7419
7508
|
{
|
|
7420
7509
|
type: "button",
|
|
@@ -7422,7 +7511,7 @@ function CompactToolGroupBlock({
|
|
|
7422
7511
|
className: "flex min-w-0 shrink-0 items-center gap-2 text-left transition-colors hover:bg-white/3 focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
7423
7512
|
"aria-expanded": expanded,
|
|
7424
7513
|
children: [
|
|
7425
|
-
/* @__PURE__ */
|
|
7514
|
+
/* @__PURE__ */ jsx32(
|
|
7426
7515
|
ChevronRight5,
|
|
7427
7516
|
{
|
|
7428
7517
|
size: 11,
|
|
@@ -7432,18 +7521,18 @@ function CompactToolGroupBlock({
|
|
|
7432
7521
|
)
|
|
7433
7522
|
}
|
|
7434
7523
|
),
|
|
7435
|
-
hasError ? /* @__PURE__ */
|
|
7436
|
-
/* @__PURE__ */
|
|
7437
|
-
/* @__PURE__ */
|
|
7438
|
-
] }) : /* @__PURE__ */
|
|
7439
|
-
/* @__PURE__ */
|
|
7440
|
-
/* @__PURE__ */
|
|
7524
|
+
hasError ? /* @__PURE__ */ jsxs27("span", { className: "flex shrink-0 items-center gap-1 text-[10px] text-[hsl(var(--destructive))]", children: [
|
|
7525
|
+
/* @__PURE__ */ jsx32(AlertCircle, { size: 11 }),
|
|
7526
|
+
/* @__PURE__ */ jsx32("span", { children: "\u5931\u8D25" })
|
|
7527
|
+
] }) : /* @__PURE__ */ jsxs27("span", { className: "flex shrink-0 items-center gap-1 text-[10px] text-[hsl(var(--primary))]", children: [
|
|
7528
|
+
/* @__PURE__ */ jsx32(Check5, { size: 11 }),
|
|
7529
|
+
/* @__PURE__ */ jsx32("span", { children: "\u5B8C\u6210" })
|
|
7441
7530
|
] }),
|
|
7442
|
-
/* @__PURE__ */
|
|
7531
|
+
/* @__PURE__ */ jsx32("span", { className: "min-w-0 shrink-0 font-medium text-[hsl(var(--foreground))]", children: title })
|
|
7443
7532
|
]
|
|
7444
7533
|
}
|
|
7445
7534
|
),
|
|
7446
|
-
/* @__PURE__ */
|
|
7535
|
+
/* @__PURE__ */ jsx32("div", { className: "flex min-w-0 flex-1 flex-wrap gap-1.5", children: tags.map((tag, index) => /* @__PURE__ */ jsx32(
|
|
7447
7536
|
"span",
|
|
7448
7537
|
{
|
|
7449
7538
|
className: "max-w-40 truncate rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.35)] px-1.5 py-0.5 font-mono text-[10px] text-[hsl(var(--muted-foreground))]",
|
|
@@ -7452,12 +7541,12 @@ function CompactToolGroupBlock({
|
|
|
7452
7541
|
},
|
|
7453
7542
|
`${tag}-${index}`
|
|
7454
7543
|
)) }),
|
|
7455
|
-
reasoning ? /* @__PURE__ */
|
|
7456
|
-
totalDurationMs > 0 ? /* @__PURE__ */
|
|
7544
|
+
reasoning ? /* @__PURE__ */ jsx32(ThinkingBadge, { reasoning, variant: "block" }) : null,
|
|
7545
|
+
totalDurationMs > 0 ? /* @__PURE__ */ jsx32("span", { className: "shrink-0 font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: formatToolDuration2(totalDurationMs) }) : null
|
|
7457
7546
|
] }),
|
|
7458
|
-
expanded ? /* @__PURE__ */
|
|
7547
|
+
expanded ? /* @__PURE__ */ jsx32("div", { className: "mt-1 flex flex-col gap-1", children: toolCalls.map((toolCall) => {
|
|
7459
7548
|
const CustomToolCall = customization?.components?.ToolCall;
|
|
7460
|
-
return CustomToolCall ? /* @__PURE__ */
|
|
7549
|
+
return CustomToolCall ? /* @__PURE__ */ jsx32(
|
|
7461
7550
|
CustomToolCall,
|
|
7462
7551
|
{
|
|
7463
7552
|
toolCall,
|
|
@@ -7471,7 +7560,7 @@ function CompactToolGroupBlock({
|
|
|
7471
7560
|
customization
|
|
7472
7561
|
},
|
|
7473
7562
|
toolCall.id
|
|
7474
|
-
) : /* @__PURE__ */
|
|
7563
|
+
) : /* @__PURE__ */ jsx32(
|
|
7475
7564
|
ToolCallBlock,
|
|
7476
7565
|
{
|
|
7477
7566
|
toolCall,
|
|
@@ -7502,8 +7591,8 @@ function AssistantMessageContent({
|
|
|
7502
7591
|
if (!text && imageParts.length === 0 && fileParts.length === 0 && !isStreaming && !reasoning) {
|
|
7503
7592
|
return null;
|
|
7504
7593
|
}
|
|
7505
|
-
return /* @__PURE__ */
|
|
7506
|
-
imageParts.length > 0 && /* @__PURE__ */
|
|
7594
|
+
return /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-3", children: [
|
|
7595
|
+
imageParts.length > 0 && /* @__PURE__ */ jsx32("div", { className: "grid gap-2", children: imageParts.map((part) => /* @__PURE__ */ jsx32(
|
|
7507
7596
|
"img",
|
|
7508
7597
|
{
|
|
7509
7598
|
src: part.image_url.url,
|
|
@@ -7512,8 +7601,8 @@ function AssistantMessageContent({
|
|
|
7512
7601
|
},
|
|
7513
7602
|
part.image_url.url
|
|
7514
7603
|
)) }),
|
|
7515
|
-
/* @__PURE__ */
|
|
7516
|
-
text ? /* @__PURE__ */
|
|
7604
|
+
/* @__PURE__ */ jsx32(MessageFileAttachmentList, { files: fileParts }),
|
|
7605
|
+
text ? /* @__PURE__ */ jsx32(
|
|
7517
7606
|
AssistantText,
|
|
7518
7607
|
{
|
|
7519
7608
|
text,
|
|
@@ -7523,8 +7612,8 @@ function AssistantMessageContent({
|
|
|
7523
7612
|
className
|
|
7524
7613
|
}
|
|
7525
7614
|
) : null,
|
|
7526
|
-
!text && isStreaming && /* @__PURE__ */
|
|
7527
|
-
!text && reasoning ? /* @__PURE__ */
|
|
7615
|
+
!text && isStreaming && /* @__PURE__ */ jsx32("span", { className: "text-sm text-[hsl(var(--muted-foreground))]", children: "\u6B63\u5728\u751F\u6210..." }),
|
|
7616
|
+
!text && reasoning ? /* @__PURE__ */ jsx32(ThinkingBadge, { reasoning, variant: "block" }) : null
|
|
7528
7617
|
] });
|
|
7529
7618
|
}
|
|
7530
7619
|
function AssistantText({
|
|
@@ -7544,8 +7633,8 @@ function AssistantText({
|
|
|
7544
7633
|
() => ({ sessionId, messageId, sendMessage }),
|
|
7545
7634
|
[sessionId, messageId, sendMessage]
|
|
7546
7635
|
);
|
|
7547
|
-
return /* @__PURE__ */
|
|
7548
|
-
/* @__PURE__ */
|
|
7636
|
+
return /* @__PURE__ */ jsxs27("div", { className: cn("text-[15px] leading-8 text-[hsl(var(--foreground))]", className), children: [
|
|
7637
|
+
/* @__PURE__ */ jsx32(CardContext.Provider, { value: cardCtx, children: /* @__PURE__ */ jsx32(
|
|
7549
7638
|
MarkdownContent,
|
|
7550
7639
|
{
|
|
7551
7640
|
mode: "streaming",
|
|
@@ -7555,7 +7644,7 @@ function AssistantText({
|
|
|
7555
7644
|
children: text
|
|
7556
7645
|
}
|
|
7557
7646
|
) }),
|
|
7558
|
-
reasoning ? /* @__PURE__ */
|
|
7647
|
+
reasoning ? /* @__PURE__ */ jsx32(ThinkingBadge, { reasoning }) : null
|
|
7559
7648
|
] });
|
|
7560
7649
|
}
|
|
7561
7650
|
function MemoryRefsHint({ refs: rawRefs }) {
|
|
@@ -7563,22 +7652,22 @@ function MemoryRefsHint({ refs: rawRefs }) {
|
|
|
7563
7652
|
const [expanded, setExpanded] = useState18(false);
|
|
7564
7653
|
const hasSkill = refs.some((r3) => r3.skill_name);
|
|
7565
7654
|
const label = hasSkill ? "\u53C2\u8003\u4E86\u8BE5\u6280\u80FD\u7684\u5386\u53F2\u7ECF\u9A8C" : "\u53C2\u8003\u4E86\u5386\u53F2\u7ECF\u9A8C";
|
|
7566
|
-
return /* @__PURE__ */
|
|
7567
|
-
/* @__PURE__ */
|
|
7655
|
+
return /* @__PURE__ */ jsxs27("div", { className: "ml-4", children: [
|
|
7656
|
+
/* @__PURE__ */ jsxs27(
|
|
7568
7657
|
"button",
|
|
7569
7658
|
{
|
|
7570
7659
|
type: "button",
|
|
7571
7660
|
onClick: () => setExpanded(!expanded),
|
|
7572
7661
|
className: "inline-flex items-center gap-1.5 rounded-md border border-[hsl(var(--primary)/0.25)] bg-[hsl(var(--primary)/0.08)] px-2.5 py-1 text-[11px] text-[hsl(var(--primary))] transition-colors hover:bg-[hsl(var(--primary)/0.12)]",
|
|
7573
7662
|
children: [
|
|
7574
|
-
/* @__PURE__ */
|
|
7575
|
-
/* @__PURE__ */
|
|
7663
|
+
/* @__PURE__ */ jsx32(BookOpen, { size: 12 }),
|
|
7664
|
+
/* @__PURE__ */ jsxs27("span", { children: [
|
|
7576
7665
|
label,
|
|
7577
7666
|
"\uFF08",
|
|
7578
7667
|
refs.length,
|
|
7579
7668
|
"\uFF09"
|
|
7580
7669
|
] }),
|
|
7581
|
-
/* @__PURE__ */
|
|
7670
|
+
/* @__PURE__ */ jsx32(
|
|
7582
7671
|
ChevronRight5,
|
|
7583
7672
|
{
|
|
7584
7673
|
size: 10,
|
|
@@ -7588,13 +7677,13 @@ function MemoryRefsHint({ refs: rawRefs }) {
|
|
|
7588
7677
|
]
|
|
7589
7678
|
}
|
|
7590
7679
|
),
|
|
7591
|
-
expanded && /* @__PURE__ */
|
|
7592
|
-
refs.map((ref) => /* @__PURE__ */
|
|
7593
|
-
/* @__PURE__ */
|
|
7594
|
-
/* @__PURE__ */
|
|
7595
|
-
ref.skill_name && /* @__PURE__ */
|
|
7680
|
+
expanded && /* @__PURE__ */ jsxs27("div", { className: "mt-1.5 flex flex-col gap-1 rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.45)] px-3 py-2", children: [
|
|
7681
|
+
refs.map((ref) => /* @__PURE__ */ jsxs27("div", { className: "flex items-start gap-2 text-[11px] text-[hsl(var(--foreground)/0.82)]", children: [
|
|
7682
|
+
/* @__PURE__ */ jsx32("span", { className: "mt-0.5 shrink-0 text-[hsl(var(--primary)/0.75)]", children: "\u2022" }),
|
|
7683
|
+
/* @__PURE__ */ jsx32("span", { className: "line-clamp-1", children: ref.content_preview }),
|
|
7684
|
+
ref.skill_name && /* @__PURE__ */ jsx32("span", { className: "ml-auto shrink-0 rounded bg-[hsl(var(--primary)/0.12)] px-1.5 py-0.5 text-[10px] text-[hsl(var(--primary))]", children: ref.skill_name })
|
|
7596
7685
|
] }, ref.id)),
|
|
7597
|
-
/* @__PURE__ */
|
|
7686
|
+
/* @__PURE__ */ jsx32(
|
|
7598
7687
|
"a",
|
|
7599
7688
|
{
|
|
7600
7689
|
href: MEMORIES_ROUTE,
|
|
@@ -7609,7 +7698,7 @@ function MemoryRefsHint({ refs: rawRefs }) {
|
|
|
7609
7698
|
// src/react/components/chat/CompactionCard.tsx
|
|
7610
7699
|
import { ChevronDown as ChevronDown2, ChevronRight as ChevronRight6, Loader2 as Loader26, Square as Square3, XCircle } from "lucide-react";
|
|
7611
7700
|
import { useState as useState19 } from "react";
|
|
7612
|
-
import { jsx as
|
|
7701
|
+
import { jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
7613
7702
|
var PERCENT_FORMATTER = new Intl.NumberFormat("zh-CN", {
|
|
7614
7703
|
style: "percent",
|
|
7615
7704
|
maximumFractionDigits: 0
|
|
@@ -7669,9 +7758,9 @@ function CompactionCard({
|
|
|
7669
7758
|
const hasSummary = typeof source.summary_full === "string" && source.summary_full.trim().length > 0 && !isGenericArchiveSummary(source.summary_full);
|
|
7670
7759
|
const hasFailureReason = source.status === "failed" && Boolean(source.failure_reason);
|
|
7671
7760
|
const canExpand = source.status === "completed" && (hasSummary || archivedToolCalls.length > 0) || hasFailureReason;
|
|
7672
|
-
return /* @__PURE__ */
|
|
7673
|
-
/* @__PURE__ */
|
|
7674
|
-
/* @__PURE__ */
|
|
7761
|
+
return /* @__PURE__ */ jsxs28("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
7762
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between gap-2", children: [
|
|
7763
|
+
/* @__PURE__ */ jsxs28(
|
|
7675
7764
|
"button",
|
|
7676
7765
|
{
|
|
7677
7766
|
type: "button",
|
|
@@ -7682,21 +7771,21 @@ function CompactionCard({
|
|
|
7682
7771
|
),
|
|
7683
7772
|
"aria-expanded": expanded,
|
|
7684
7773
|
children: [
|
|
7685
|
-
canExpand ? expanded ? /* @__PURE__ */
|
|
7686
|
-
/* @__PURE__ */
|
|
7687
|
-
/* @__PURE__ */
|
|
7774
|
+
canExpand ? expanded ? /* @__PURE__ */ jsx33(ChevronDown2, { size: 12, className: "shrink-0" }) : /* @__PURE__ */ jsx33(ChevronRight6, { size: 12, className: "shrink-0" }) : null,
|
|
7775
|
+
/* @__PURE__ */ jsx33("span", { children: source.status === "streaming" ? /* @__PURE__ */ jsxs28("span", { className: "inline-flex items-center gap-1", children: [
|
|
7776
|
+
/* @__PURE__ */ jsx33(Loader26, { size: 12, className: "animate-spin" }),
|
|
7688
7777
|
"\u6B63\u5728\u538B\u7F29\u4E0A\u4E0B\u6587"
|
|
7689
|
-
] }) : source.status === "failed" ? /* @__PURE__ */
|
|
7690
|
-
/* @__PURE__ */
|
|
7778
|
+
] }) : source.status === "failed" ? /* @__PURE__ */ jsxs28("span", { className: "inline-flex items-center gap-1 text-rose-500/80", children: [
|
|
7779
|
+
/* @__PURE__ */ jsx33(XCircle, { size: 12 }),
|
|
7691
7780
|
"\u4E0A\u4E0B\u6587\u538B\u7F29\u5931\u8D25"
|
|
7692
|
-
] }) : source.status === "interrupted" ? /* @__PURE__ */
|
|
7693
|
-
/* @__PURE__ */
|
|
7781
|
+
] }) : source.status === "interrupted" ? /* @__PURE__ */ jsxs28("span", { className: "inline-flex items-center gap-1 text-amber-500/80", children: [
|
|
7782
|
+
/* @__PURE__ */ jsx33(Square3, { size: 11 }),
|
|
7694
7783
|
"\u4E0A\u4E0B\u6587\u538B\u7F29\u5DF2\u53D6\u6D88"
|
|
7695
7784
|
] }) : "\u4E0A\u4E0B\u6587\u5DF2\u538B\u7F29" })
|
|
7696
7785
|
]
|
|
7697
7786
|
}
|
|
7698
7787
|
),
|
|
7699
|
-
canCancel ? /* @__PURE__ */
|
|
7788
|
+
canCancel ? /* @__PURE__ */ jsx33(
|
|
7700
7789
|
"button",
|
|
7701
7790
|
{
|
|
7702
7791
|
type: "button",
|
|
@@ -7706,13 +7795,13 @@ function CompactionCard({
|
|
|
7706
7795
|
}
|
|
7707
7796
|
) : null
|
|
7708
7797
|
] }),
|
|
7709
|
-
expanded ? /* @__PURE__ */
|
|
7710
|
-
/* @__PURE__ */
|
|
7711
|
-
/* @__PURE__ */
|
|
7798
|
+
expanded ? /* @__PURE__ */ jsxs28("div", { className: "mt-1 max-w-3xl rounded-lg border border-[hsl(var(--border))]/70 bg-[hsl(var(--card))]/80 px-3 py-2 text-[11px] leading-relaxed shadow-sm", children: [
|
|
7799
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-[hsl(var(--muted-foreground))]", children: [
|
|
7800
|
+
/* @__PURE__ */ jsxs28("span", { children: [
|
|
7712
7801
|
"#",
|
|
7713
7802
|
shortId(source.compaction_id)
|
|
7714
7803
|
] }),
|
|
7715
|
-
/* @__PURE__ */
|
|
7804
|
+
/* @__PURE__ */ jsxs28("span", { children: [
|
|
7716
7805
|
"\u8282\u7701 ",
|
|
7717
7806
|
formatSavedRatio(source.saved_ratio),
|
|
7718
7807
|
"\uFF08",
|
|
@@ -7722,31 +7811,31 @@ function CompactionCard({
|
|
|
7722
7811
|
formatTokens(source.tokens_after),
|
|
7723
7812
|
" token\uFF09"
|
|
7724
7813
|
] }),
|
|
7725
|
-
/* @__PURE__ */
|
|
7814
|
+
/* @__PURE__ */ jsxs28("span", { children: [
|
|
7726
7815
|
"\u5F52\u6863 ",
|
|
7727
7816
|
archivedCount,
|
|
7728
7817
|
" \u4E2A\u5DE5\u5177\u7ED3\u679C"
|
|
7729
7818
|
] })
|
|
7730
7819
|
] }),
|
|
7731
|
-
archivedToolCalls.length > 0 ? /* @__PURE__ */
|
|
7820
|
+
archivedToolCalls.length > 0 ? /* @__PURE__ */ jsx33("div", { className: "mt-2 space-y-1.5", children: archivedToolCalls.map((item, index) => {
|
|
7732
7821
|
const archivePath = getArchivePath(item, archivedFiles);
|
|
7733
|
-
return /* @__PURE__ */
|
|
7822
|
+
return /* @__PURE__ */ jsxs28(
|
|
7734
7823
|
"div",
|
|
7735
7824
|
{
|
|
7736
7825
|
className: "rounded-md border border-[hsl(var(--border))]/70 bg-[hsl(var(--muted))]/35 px-2 py-1.5",
|
|
7737
7826
|
children: [
|
|
7738
|
-
/* @__PURE__ */
|
|
7739
|
-
/* @__PURE__ */
|
|
7740
|
-
item.tool_call_id ? /* @__PURE__ */
|
|
7827
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1 text-[hsl(var(--foreground))]", children: [
|
|
7828
|
+
/* @__PURE__ */ jsx33("span", { className: "font-medium", children: getArchivedToolLabel(item) }),
|
|
7829
|
+
item.tool_call_id ? /* @__PURE__ */ jsx33("span", { className: "font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: item.tool_call_id }) : null
|
|
7741
7830
|
] }),
|
|
7742
|
-
archivePath ? /* @__PURE__ */
|
|
7831
|
+
archivePath ? /* @__PURE__ */ jsx33("div", { className: "mt-0.5 break-all font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: archivePath }) : null
|
|
7743
7832
|
]
|
|
7744
7833
|
},
|
|
7745
7834
|
item.tool_call_id || item.entry_id || `${item.tool_name}-${index}`
|
|
7746
7835
|
);
|
|
7747
7836
|
}) }) : null,
|
|
7748
|
-
hasSummary ? /* @__PURE__ */
|
|
7749
|
-
source.status === "failed" && source.failure_reason ? /* @__PURE__ */
|
|
7837
|
+
hasSummary ? /* @__PURE__ */ jsx33("pre", { className: "mt-2 max-h-[360px] overflow-auto whitespace-pre-wrap rounded-md border border-[hsl(var(--border))]/70 bg-[hsl(var(--muted))]/25 px-2 py-1.5 font-mono text-[11px] leading-relaxed text-[hsl(var(--foreground))]", children: source.summary_full }) : null,
|
|
7838
|
+
source.status === "failed" && source.failure_reason ? /* @__PURE__ */ jsxs28("div", { className: "mt-2 text-rose-500/90", children: [
|
|
7750
7839
|
"\u5931\u8D25\u539F\u56E0\uFF1A",
|
|
7751
7840
|
source.failure_reason
|
|
7752
7841
|
] }) : null
|
|
@@ -7757,7 +7846,7 @@ function CompactionCard({
|
|
|
7757
7846
|
// src/react/components/chat/RenderErrorBoundary.tsx
|
|
7758
7847
|
import { AlertTriangle as AlertTriangle2 } from "lucide-react";
|
|
7759
7848
|
import { Component } from "react";
|
|
7760
|
-
import { jsx as
|
|
7849
|
+
import { jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
7761
7850
|
function getFirstComponentName(componentStack) {
|
|
7762
7851
|
const match = componentStack.match(/\n\s+at\s+([^\s(]+)/);
|
|
7763
7852
|
return match?.[1] ?? null;
|
|
@@ -7790,18 +7879,18 @@ var RenderErrorBoundary = class extends Component {
|
|
|
7790
7879
|
return children;
|
|
7791
7880
|
}
|
|
7792
7881
|
const componentName = getFirstComponentName(componentStack);
|
|
7793
|
-
return /* @__PURE__ */
|
|
7794
|
-
/* @__PURE__ */
|
|
7795
|
-
/* @__PURE__ */
|
|
7796
|
-
/* @__PURE__ */
|
|
7882
|
+
return /* @__PURE__ */ jsx34("div", { className: "rounded-xl border border-amber-500/30 bg-amber-500/8 px-4 py-3 text-sm text-amber-100", children: /* @__PURE__ */ jsxs29("div", { className: "flex items-start gap-2", children: [
|
|
7883
|
+
/* @__PURE__ */ jsx34(AlertTriangle2, { className: "mt-0.5 h-4 w-4 shrink-0 text-amber-300" }),
|
|
7884
|
+
/* @__PURE__ */ jsxs29("div", { className: "min-w-0 flex-1", children: [
|
|
7885
|
+
/* @__PURE__ */ jsxs29("div", { className: "font-medium", children: [
|
|
7797
7886
|
label,
|
|
7798
7887
|
"\u6E32\u67D3\u5931\u8D25"
|
|
7799
7888
|
] }),
|
|
7800
|
-
/* @__PURE__ */
|
|
7889
|
+
/* @__PURE__ */ jsxs29("div", { className: "mt-1 break-words text-xs leading-5 text-amber-100/75", children: [
|
|
7801
7890
|
componentName ? `\u7EC4\u4EF6\uFF1A${componentName}\u3002` : null,
|
|
7802
7891
|
error.message || "\u53D1\u751F\u4E86\u672A\u9884\u671F\u7684\u6E32\u67D3\u9519\u8BEF\u3002"
|
|
7803
7892
|
] }),
|
|
7804
|
-
details ? /* @__PURE__ */
|
|
7893
|
+
details ? /* @__PURE__ */ jsx34("div", { className: "mt-1 truncate text-xs text-amber-100/55", children: details }) : null
|
|
7805
7894
|
] })
|
|
7806
7895
|
] }) });
|
|
7807
7896
|
}
|
|
@@ -7820,7 +7909,7 @@ import {
|
|
|
7820
7909
|
WandSparkles
|
|
7821
7910
|
} from "lucide-react";
|
|
7822
7911
|
import { useEffect as useEffect16, useMemo as useMemo17, useState as useState20 } from "react";
|
|
7823
|
-
import { jsx as
|
|
7912
|
+
import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
7824
7913
|
var EMPTY_EVENTS = [];
|
|
7825
7914
|
function formatElapsedDuration(durationMs) {
|
|
7826
7915
|
if (durationMs == null) return null;
|
|
@@ -7930,22 +8019,22 @@ function StickyStatusBar({
|
|
|
7930
8019
|
}
|
|
7931
8020
|
const elapsedLabel = formatElapsedDuration(elapsedDuration);
|
|
7932
8021
|
const Icon = action.Icon;
|
|
7933
|
-
return /* @__PURE__ */
|
|
8022
|
+
return /* @__PURE__ */ jsxs30(
|
|
7934
8023
|
"button",
|
|
7935
8024
|
{
|
|
7936
8025
|
type: "button",
|
|
7937
8026
|
onClick: onJumpToLatest,
|
|
7938
8027
|
className: "sticky top-0 z-20 mb-4 flex w-full items-center gap-3 rounded-2xl border border-[hsl(var(--primary)/0.2)] bg-[hsl(var(--background)/0.92)] px-4 py-3 text-left shadow-[0_12px_32px_-24px_hsl(var(--foreground)/0.6)] backdrop-blur",
|
|
7939
8028
|
children: [
|
|
7940
|
-
/* @__PURE__ */
|
|
7941
|
-
/* @__PURE__ */
|
|
7942
|
-
/* @__PURE__ */
|
|
7943
|
-
/* @__PURE__ */
|
|
7944
|
-
elapsedLabel ? /* @__PURE__ */
|
|
8029
|
+
/* @__PURE__ */ jsx35("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-[hsl(var(--primary)/0.12)] text-[hsl(var(--primary))]", children: /* @__PURE__ */ jsx35(Icon, { size: 18, className: Icon === LoaderCircle2 ? "animate-spin" : void 0 }) }),
|
|
8030
|
+
/* @__PURE__ */ jsxs30("div", { className: "min-w-0 flex-1", children: [
|
|
8031
|
+
/* @__PURE__ */ jsx35("div", { className: "truncate text-sm font-medium text-[hsl(var(--foreground))]", children: action.label }),
|
|
8032
|
+
/* @__PURE__ */ jsxs30("div", { className: "mt-1 flex flex-wrap items-center gap-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
8033
|
+
elapsedLabel ? /* @__PURE__ */ jsxs30("span", { className: "font-mono", children: [
|
|
7945
8034
|
"\u5DF2\u6301\u7EED ",
|
|
7946
8035
|
elapsedLabel
|
|
7947
8036
|
] }) : null,
|
|
7948
|
-
/* @__PURE__ */
|
|
8037
|
+
/* @__PURE__ */ jsx35("span", { children: "\u70B9\u51FB\u8DF3\u5230\u6700\u65B0\u4F4D\u7F6E" })
|
|
7949
8038
|
] })
|
|
7950
8039
|
] })
|
|
7951
8040
|
]
|
|
@@ -7954,7 +8043,7 @@ function StickyStatusBar({
|
|
|
7954
8043
|
}
|
|
7955
8044
|
|
|
7956
8045
|
// src/react/components/chat/TurnNavRail.tsx
|
|
7957
|
-
import { jsx as
|
|
8046
|
+
import { jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
7958
8047
|
function TurnNavRail({
|
|
7959
8048
|
items,
|
|
7960
8049
|
activeTurnId,
|
|
@@ -7963,14 +8052,14 @@ function TurnNavRail({
|
|
|
7963
8052
|
if (items.length < 2) {
|
|
7964
8053
|
return null;
|
|
7965
8054
|
}
|
|
7966
|
-
return /* @__PURE__ */
|
|
8055
|
+
return /* @__PURE__ */ jsx36(
|
|
7967
8056
|
"nav",
|
|
7968
8057
|
{
|
|
7969
8058
|
"aria-label": "\u56DE\u5408\u5BFC\u822A",
|
|
7970
8059
|
className: "absolute right-2 top-4 z-10 hidden flex-col items-end gap-0.5 md:flex",
|
|
7971
8060
|
children: items.map((item, index) => {
|
|
7972
8061
|
const isActive = item.id === activeTurnId;
|
|
7973
|
-
return /* @__PURE__ */
|
|
8062
|
+
return /* @__PURE__ */ jsxs31(
|
|
7974
8063
|
"button",
|
|
7975
8064
|
{
|
|
7976
8065
|
type: "button",
|
|
@@ -7978,8 +8067,8 @@ function TurnNavRail({
|
|
|
7978
8067
|
"aria-current": isActive ? "true" : void 0,
|
|
7979
8068
|
className: "group relative flex h-3.5 items-center",
|
|
7980
8069
|
children: [
|
|
7981
|
-
/* @__PURE__ */
|
|
7982
|
-
/* @__PURE__ */
|
|
8070
|
+
/* @__PURE__ */ jsx36("span", { className: "pointer-events-none absolute right-full mr-2 hidden max-w-48 truncate whitespace-nowrap rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--popover))] px-2.5 py-1.5 text-xs text-[hsl(var(--popover-foreground))] shadow-lg group-hover:block", children: item.title || `\u7B2C ${index + 1} \u8F6E` }),
|
|
8071
|
+
/* @__PURE__ */ jsx36(
|
|
7983
8072
|
"span",
|
|
7984
8073
|
{
|
|
7985
8074
|
className: cn(
|
|
@@ -7998,7 +8087,7 @@ function TurnNavRail({
|
|
|
7998
8087
|
}
|
|
7999
8088
|
|
|
8000
8089
|
// src/react/components/chat/MessageList.tsx
|
|
8001
|
-
import { jsx as
|
|
8090
|
+
import { jsx as jsx37, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
8002
8091
|
function parseModeChange(message) {
|
|
8003
8092
|
if (message.kind !== "mode_change" || typeof message.content !== "string") {
|
|
8004
8093
|
return null;
|
|
@@ -8274,13 +8363,13 @@ function MessageList({
|
|
|
8274
8363
|
const handleSelectTurn = useCallback12((turnId) => {
|
|
8275
8364
|
document.getElementById(turnId)?.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
8276
8365
|
}, []);
|
|
8277
|
-
return /* @__PURE__ */
|
|
8366
|
+
return /* @__PURE__ */ jsxs32(
|
|
8278
8367
|
"div",
|
|
8279
8368
|
{
|
|
8280
8369
|
ref: containerRef,
|
|
8281
8370
|
className: `relative min-h-0 flex-1 ${customization?.classNames?.messageListRoot ?? ""}`,
|
|
8282
8371
|
children: [
|
|
8283
|
-
turnNavItems.length > 1 ? /* @__PURE__ */
|
|
8372
|
+
turnNavItems.length > 1 ? /* @__PURE__ */ jsx37(
|
|
8284
8373
|
TurnNavRail,
|
|
8285
8374
|
{
|
|
8286
8375
|
items: turnNavItems,
|
|
@@ -8288,7 +8377,7 @@ function MessageList({
|
|
|
8288
8377
|
onSelectTurn: handleSelectTurn
|
|
8289
8378
|
}
|
|
8290
8379
|
) : null,
|
|
8291
|
-
/* @__PURE__ */
|
|
8380
|
+
/* @__PURE__ */ jsxs32(
|
|
8292
8381
|
StickToBottom,
|
|
8293
8382
|
{
|
|
8294
8383
|
contextRef: stickContextRef,
|
|
@@ -8296,7 +8385,7 @@ function MessageList({
|
|
|
8296
8385
|
initial: "instant",
|
|
8297
8386
|
resize: stickyTurn ? { damping: 0.8, stiffness: 0.08, mass: 1 } : "instant",
|
|
8298
8387
|
children: [
|
|
8299
|
-
/* @__PURE__ */
|
|
8388
|
+
/* @__PURE__ */ jsx37(StickToBottom.Content, { className: "px-5 py-6", children: /* @__PURE__ */ jsx37(
|
|
8300
8389
|
MessageListContent,
|
|
8301
8390
|
{
|
|
8302
8391
|
askAnswers,
|
|
@@ -8313,7 +8402,7 @@ function MessageList({
|
|
|
8313
8402
|
customization
|
|
8314
8403
|
}
|
|
8315
8404
|
) }),
|
|
8316
|
-
/* @__PURE__ */
|
|
8405
|
+
/* @__PURE__ */ jsx37(ScrollToBottomButton, {})
|
|
8317
8406
|
]
|
|
8318
8407
|
}
|
|
8319
8408
|
)
|
|
@@ -8343,8 +8432,8 @@ function MessageListContent({
|
|
|
8343
8432
|
}
|
|
8344
8433
|
scrollToBottom();
|
|
8345
8434
|
}, [lastTurnId, scrollToBottom]);
|
|
8346
|
-
return /* @__PURE__ */
|
|
8347
|
-
stickyTurn ? /* @__PURE__ */
|
|
8435
|
+
return /* @__PURE__ */ jsx37("div", { className: `mx-auto max-w-3xl ${customization?.classNames?.messageListContent ?? ""}`, children: /* @__PURE__ */ jsxs32("div", { className: `min-w-0 flex flex-col gap-8 ${customization?.classNames?.messageListInner ?? ""}`, children: [
|
|
8436
|
+
stickyTurn ? /* @__PURE__ */ jsx37(
|
|
8348
8437
|
StickyStatusBar,
|
|
8349
8438
|
{
|
|
8350
8439
|
sessionId,
|
|
@@ -8354,31 +8443,31 @@ function MessageListContent({
|
|
|
8354
8443
|
onJumpToLatest: handleJumpToLatest
|
|
8355
8444
|
}
|
|
8356
8445
|
) : null,
|
|
8357
|
-
renderBlocks.length === 0 ? customization?.components?.EmptyState ? /* @__PURE__ */
|
|
8358
|
-
/* @__PURE__ */
|
|
8359
|
-
/* @__PURE__ */
|
|
8360
|
-
/* @__PURE__ */
|
|
8446
|
+
renderBlocks.length === 0 ? customization?.components?.EmptyState ? /* @__PURE__ */ jsx37(customization.components.EmptyState, {}) : /* @__PURE__ */ jsxs32("div", { className: `flex flex-col items-center justify-center gap-3 py-24 text-[hsl(var(--muted-foreground))] ${customization?.classNames?.emptyState ?? ""}`, children: [
|
|
8447
|
+
/* @__PURE__ */ jsx37(MessageSquare, { size: 40, strokeWidth: 1.5 }),
|
|
8448
|
+
/* @__PURE__ */ jsx37("span", { className: "text-base font-medium", children: "\u5F00\u59CB\u5BF9\u8BDD" }),
|
|
8449
|
+
/* @__PURE__ */ jsx37("span", { className: "text-sm opacity-60", children: "\u5728\u4E0B\u65B9\u8F93\u5165\u6D88\u606F\u5F00\u59CB\u804A\u5929" })
|
|
8361
8450
|
] }) : renderBlocks.map((block, blockIndex) => {
|
|
8362
8451
|
if (block.type === "message") {
|
|
8363
|
-
return /* @__PURE__ */
|
|
8452
|
+
return /* @__PURE__ */ jsx37("div", { className: "msg-animate", children: isUserMessage(block.message) ? customization?.components?.UserMessage ? /* @__PURE__ */ jsx37(
|
|
8364
8453
|
customization.components.UserMessage,
|
|
8365
8454
|
{
|
|
8366
8455
|
message: block.message,
|
|
8367
8456
|
className: customization.classNames?.userMessage
|
|
8368
8457
|
}
|
|
8369
|
-
) : /* @__PURE__ */
|
|
8458
|
+
) : /* @__PURE__ */ jsx37(
|
|
8370
8459
|
UserMessageBubble,
|
|
8371
8460
|
{
|
|
8372
8461
|
message: block.message,
|
|
8373
8462
|
className: customization?.classNames?.userMessage
|
|
8374
8463
|
}
|
|
8375
|
-
) : isErrorMessage(block.message) ? customization?.components?.ErrorMessage ? /* @__PURE__ */
|
|
8464
|
+
) : isErrorMessage(block.message) ? customization?.components?.ErrorMessage ? /* @__PURE__ */ jsx37(
|
|
8376
8465
|
customization.components.ErrorMessage,
|
|
8377
8466
|
{
|
|
8378
8467
|
message: block.message,
|
|
8379
8468
|
className: customization.classNames?.errorMessage
|
|
8380
8469
|
}
|
|
8381
|
-
) : /* @__PURE__ */
|
|
8470
|
+
) : /* @__PURE__ */ jsx37(
|
|
8382
8471
|
ErrorMessageBlock,
|
|
8383
8472
|
{
|
|
8384
8473
|
message: block.message,
|
|
@@ -8395,20 +8484,20 @@ function MessageListContent({
|
|
|
8395
8484
|
);
|
|
8396
8485
|
const isFollowedByPlanningExit = nextBlock?.type === "planning_divider" && nextBlock.kind === "exit";
|
|
8397
8486
|
const showPlanCard = (hasExitPlan || isFollowedByPlanningExit) && onConfirmPlan && sessionStatus === "waiting_for_input";
|
|
8398
|
-
return /* @__PURE__ */
|
|
8487
|
+
return /* @__PURE__ */ jsxs32(
|
|
8399
8488
|
"div",
|
|
8400
8489
|
{
|
|
8401
8490
|
id: block.anchorId,
|
|
8402
8491
|
"data-turn-id": block.anchorId,
|
|
8403
8492
|
className: "msg-animate flex scroll-mt-6 flex-col gap-4",
|
|
8404
8493
|
children: [
|
|
8405
|
-
/* @__PURE__ */
|
|
8494
|
+
/* @__PURE__ */ jsx37(
|
|
8406
8495
|
RenderErrorBoundary,
|
|
8407
8496
|
{
|
|
8408
8497
|
label: "\u52A9\u624B\u6D88\u606F",
|
|
8409
8498
|
details: block.key,
|
|
8410
8499
|
resetKey: getMessagesResetSignature(block.messages),
|
|
8411
|
-
children: customization?.components?.AssistantTurn ? /* @__PURE__ */
|
|
8500
|
+
children: customization?.components?.AssistantTurn ? /* @__PURE__ */ jsx37(
|
|
8412
8501
|
customization.components.AssistantTurn,
|
|
8413
8502
|
{
|
|
8414
8503
|
turnKey: block.key,
|
|
@@ -8421,7 +8510,7 @@ function MessageListContent({
|
|
|
8421
8510
|
sessionStatus,
|
|
8422
8511
|
customization
|
|
8423
8512
|
}
|
|
8424
|
-
) : /* @__PURE__ */
|
|
8513
|
+
) : /* @__PURE__ */ jsx37(
|
|
8425
8514
|
AssistantTurnBlock,
|
|
8426
8515
|
{
|
|
8427
8516
|
turnKey: block.key,
|
|
@@ -8437,13 +8526,13 @@ function MessageListContent({
|
|
|
8437
8526
|
)
|
|
8438
8527
|
}
|
|
8439
8528
|
),
|
|
8440
|
-
showPlanCard ? /* @__PURE__ */
|
|
8529
|
+
showPlanCard ? /* @__PURE__ */ jsx37(
|
|
8441
8530
|
RenderErrorBoundary,
|
|
8442
8531
|
{
|
|
8443
8532
|
label: "\u89C4\u5212\u6458\u8981",
|
|
8444
8533
|
details: block.key,
|
|
8445
8534
|
resetKey: `${sessionStatus ?? ""}:${layoutSignature}`,
|
|
8446
|
-
children: /* @__PURE__ */
|
|
8535
|
+
children: /* @__PURE__ */ jsx37(
|
|
8447
8536
|
PlanSummaryCard,
|
|
8448
8537
|
{
|
|
8449
8538
|
messages: extractLatestPlanMessages(messages),
|
|
@@ -8459,7 +8548,7 @@ function MessageListContent({
|
|
|
8459
8548
|
);
|
|
8460
8549
|
}
|
|
8461
8550
|
if (block.type === "compaction") {
|
|
8462
|
-
return /* @__PURE__ */
|
|
8551
|
+
return /* @__PURE__ */ jsx37("div", { className: "msg-animate", children: /* @__PURE__ */ jsx37(
|
|
8463
8552
|
CompactionCard,
|
|
8464
8553
|
{
|
|
8465
8554
|
sessionId,
|
|
@@ -8468,41 +8557,41 @@ function MessageListContent({
|
|
|
8468
8557
|
}
|
|
8469
8558
|
) }, block.key);
|
|
8470
8559
|
}
|
|
8471
|
-
return /* @__PURE__ */
|
|
8560
|
+
return /* @__PURE__ */ jsx37(PlanningDivider, { kind: block.kind }, block.key);
|
|
8472
8561
|
}),
|
|
8473
|
-
sessionStatus === "interrupted" && !hasInterruptedTurn ? /* @__PURE__ */
|
|
8562
|
+
sessionStatus === "interrupted" && !hasInterruptedTurn ? /* @__PURE__ */ jsx37("div", { className: "flex", children: /* @__PURE__ */ jsx37("div", { className: "rounded-full border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.12em] text-amber-300", children: "\u5DF2\u4E2D\u65AD" }) }) : null
|
|
8474
8563
|
] }) });
|
|
8475
8564
|
}
|
|
8476
8565
|
function ScrollToBottomButton() {
|
|
8477
8566
|
const { isAtBottom, scrollToBottom } = useStickToBottomContext();
|
|
8478
8567
|
if (isAtBottom) return null;
|
|
8479
|
-
return /* @__PURE__ */
|
|
8568
|
+
return /* @__PURE__ */ jsxs32(
|
|
8480
8569
|
"button",
|
|
8481
8570
|
{
|
|
8482
8571
|
type: "button",
|
|
8483
8572
|
onClick: () => scrollToBottom(),
|
|
8484
8573
|
className: "absolute bottom-4 right-4 flex items-center gap-1 rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-3 py-1.5 text-xs text-[hsl(var(--muted-foreground))] shadow-lg transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]",
|
|
8485
8574
|
children: [
|
|
8486
|
-
/* @__PURE__ */
|
|
8487
|
-
/* @__PURE__ */
|
|
8575
|
+
/* @__PURE__ */ jsx37(ChevronDown3, { size: 14 }),
|
|
8576
|
+
/* @__PURE__ */ jsx37("span", { children: "\u6EDA\u52A8\u5230\u5E95\u90E8" })
|
|
8488
8577
|
]
|
|
8489
8578
|
}
|
|
8490
8579
|
);
|
|
8491
8580
|
}
|
|
8492
8581
|
function PlanningDivider({ kind }) {
|
|
8493
8582
|
const isEnter = kind === "enter";
|
|
8494
|
-
return /* @__PURE__ */
|
|
8495
|
-
/* @__PURE__ */
|
|
8496
|
-
/* @__PURE__ */
|
|
8497
|
-
/* @__PURE__ */
|
|
8498
|
-
/* @__PURE__ */
|
|
8583
|
+
return /* @__PURE__ */ jsxs32("div", { className: "flex items-center gap-3 py-1", children: [
|
|
8584
|
+
/* @__PURE__ */ jsx37("div", { className: "h-px flex-1 bg-gradient-to-r from-transparent via-amber-400/40 to-transparent" }),
|
|
8585
|
+
/* @__PURE__ */ jsxs32("div", { className: "inline-flex items-center gap-1.5 rounded-full border border-amber-500/30 bg-amber-500/10 px-3 py-1 text-[11px] text-amber-300", children: [
|
|
8586
|
+
/* @__PURE__ */ jsx37(Lightbulb2, { size: 12 }),
|
|
8587
|
+
/* @__PURE__ */ jsx37("span", { children: isEnter ? "\u8FDB\u5165\u89C4\u5212\u6A21\u5F0F" : "\u89C4\u5212\u5B8C\u6210" })
|
|
8499
8588
|
] }),
|
|
8500
|
-
/* @__PURE__ */
|
|
8589
|
+
/* @__PURE__ */ jsx37("div", { className: "h-px flex-1 bg-gradient-to-r from-transparent via-amber-400/40 to-transparent" })
|
|
8501
8590
|
] });
|
|
8502
8591
|
}
|
|
8503
8592
|
|
|
8504
8593
|
// src/react/components/chat/ChatView.tsx
|
|
8505
|
-
import { jsx as
|
|
8594
|
+
import { jsx as jsx38, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
8506
8595
|
function ChatView({
|
|
8507
8596
|
sessionId,
|
|
8508
8597
|
renderAttachments,
|
|
@@ -8550,17 +8639,17 @@ function ChatView({
|
|
|
8550
8639
|
[classNames, components, renderers]
|
|
8551
8640
|
);
|
|
8552
8641
|
const SkillStatus = components?.SkillStatusBar;
|
|
8553
|
-
return /* @__PURE__ */
|
|
8554
|
-
isViewer && /* @__PURE__ */
|
|
8555
|
-
/* @__PURE__ */
|
|
8642
|
+
return /* @__PURE__ */ jsxs33("div", { className: `flex min-h-0 flex-1 flex-col overflow-hidden ${classNames?.root ?? ""}`, children: [
|
|
8643
|
+
isViewer && /* @__PURE__ */ jsxs33("div", { className: `flex items-center justify-center gap-2 border-b border-[hsl(var(--border))] bg-[hsl(var(--card))] py-2 text-xs text-[hsl(var(--muted-foreground))] ${classNames?.viewerBanner ?? ""}`, children: [
|
|
8644
|
+
/* @__PURE__ */ jsx38(Eye, { size: 14 }),
|
|
8556
8645
|
"\u4F60\u6B63\u5728\u67E5\u770B\u5206\u4EAB\u7684\u4F1A\u8BDD\uFF08\u53EA\u8BFB\uFF09"
|
|
8557
8646
|
] }),
|
|
8558
|
-
!isViewer && /* @__PURE__ */
|
|
8559
|
-
errorMessage && /* @__PURE__ */
|
|
8560
|
-
/* @__PURE__ */
|
|
8561
|
-
/* @__PURE__ */
|
|
8647
|
+
!isViewer && /* @__PURE__ */ jsx38(ConnectionBanner, {}),
|
|
8648
|
+
errorMessage && /* @__PURE__ */ jsxs33("div", { className: "flex items-start gap-2 border-b border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800 dark:border-red-800/30 dark:bg-red-950/30 dark:text-red-300", children: [
|
|
8649
|
+
/* @__PURE__ */ jsx38(CircleAlert2, { size: 16, className: "mt-0.5 shrink-0" }),
|
|
8650
|
+
/* @__PURE__ */ jsx38("span", { children: errorMessage })
|
|
8562
8651
|
] }),
|
|
8563
|
-
/* @__PURE__ */
|
|
8652
|
+
/* @__PURE__ */ jsx38(
|
|
8564
8653
|
MessageList,
|
|
8565
8654
|
{
|
|
8566
8655
|
sessionId,
|
|
@@ -8572,10 +8661,13 @@ function ChatView({
|
|
|
8572
8661
|
},
|
|
8573
8662
|
sessionId
|
|
8574
8663
|
),
|
|
8575
|
-
!isViewer && /* @__PURE__ */
|
|
8664
|
+
!isViewer && /* @__PURE__ */ jsx38(
|
|
8576
8665
|
ChatInput,
|
|
8577
8666
|
{
|
|
8578
|
-
onSend: (msg,
|
|
8667
|
+
onSend: (msg, options) => send(msg, mode, void 0, {
|
|
8668
|
+
model: options?.model || void 0,
|
|
8669
|
+
thinkingOverride: options?.thinkingOverride
|
|
8670
|
+
}),
|
|
8579
8671
|
onAppend: append,
|
|
8580
8672
|
onStop: stop,
|
|
8581
8673
|
isStreaming,
|
|
@@ -8609,6 +8701,7 @@ export {
|
|
|
8609
8701
|
useInputHistory,
|
|
8610
8702
|
useModelConfig,
|
|
8611
8703
|
usePreferredModel,
|
|
8704
|
+
useThinkingPreference,
|
|
8612
8705
|
useResolvedModel,
|
|
8613
8706
|
buildVoiceInputUnavailableError,
|
|
8614
8707
|
useVoiceInput,
|
|
@@ -8626,6 +8719,7 @@ export {
|
|
|
8626
8719
|
SkillStatusBar,
|
|
8627
8720
|
skillMentionSuggestionKey,
|
|
8628
8721
|
SkillMention,
|
|
8722
|
+
ThinkingToggle,
|
|
8629
8723
|
ChatInput,
|
|
8630
8724
|
ResourceIframe,
|
|
8631
8725
|
ImageLightbox,
|
|
@@ -8652,4 +8746,4 @@ use-stick-to-bottom/dist/StickToBottom.js:
|
|
|
8652
8746
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
8653
8747
|
*--------------------------------------------------------------------------------------------*)
|
|
8654
8748
|
*/
|
|
8655
|
-
//# sourceMappingURL=chunk-
|
|
8749
|
+
//# sourceMappingURL=chunk-JHUSL3JZ.js.map
|