@object-ui/plugin-chatbot 11.5.0 → 13.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/dist/ChatbotEnhanced.d.ts +19 -1
- package/dist/ChatbotEnhanced.d.ts.map +1 -1
- package/dist/index.js +174 -154
- package/dist/index.umd.cjs +1 -1
- package/dist/mapMessages.d.ts +20 -0
- package/dist/mapMessages.d.ts.map +1 -1
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -996,10 +996,12 @@ var er = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
|
996
996
|
currentBranch: i,
|
|
997
997
|
totalBranches: o.length,
|
|
998
998
|
goToPrevious: () => {
|
|
999
|
-
|
|
999
|
+
let e = i > 0 ? i - 1 : o.length - 1;
|
|
1000
|
+
c(e);
|
|
1000
1001
|
},
|
|
1001
1002
|
goToNext: () => {
|
|
1002
|
-
|
|
1003
|
+
let e = i < o.length - 1 ? i + 1 : 0;
|
|
1004
|
+
c(e);
|
|
1003
1005
|
},
|
|
1004
1006
|
branches: o,
|
|
1005
1007
|
setBranches: s
|
|
@@ -2018,10 +2020,14 @@ function Vi(e) {
|
|
|
2018
2020
|
}
|
|
2019
2021
|
}
|
|
2020
2022
|
function Hi(e) {
|
|
2021
|
-
let t =
|
|
2022
|
-
return t === "
|
|
2023
|
+
let t = Vt(e)?.status;
|
|
2024
|
+
return t === "changes_proposed" || t === "blueprint_proposed" || t === "awaiting_confirmation";
|
|
2023
2025
|
}
|
|
2024
2026
|
function Ui(e) {
|
|
2027
|
+
let t = e.state ?? (e.errorText ? "output-error" : e.result === void 0 ? "input-available" : "output-available");
|
|
2028
|
+
return t === "output-error" || t === "output-denied" ? "failed" : t === "approval-requested" || t === "approval-responded" ? "awaiting" : t === "output-available" ? Hi(e.result) ? "awaiting" : "completed" : "running";
|
|
2029
|
+
}
|
|
2030
|
+
function Wi(e) {
|
|
2025
2031
|
return [
|
|
2026
2032
|
{
|
|
2027
2033
|
create_object: "新建对象",
|
|
@@ -2037,13 +2043,13 @@ function Ui(e) {
|
|
|
2037
2043
|
e.details
|
|
2038
2044
|
].filter(Boolean).join(" ");
|
|
2039
2045
|
}
|
|
2040
|
-
function
|
|
2046
|
+
function Gi(e) {
|
|
2041
2047
|
return e.toolName === "propose_blueprint";
|
|
2042
2048
|
}
|
|
2043
|
-
function
|
|
2044
|
-
return
|
|
2049
|
+
function Ki(e) {
|
|
2050
|
+
return Gi(e) && Ui(e) === "completed" && !e.proposedPlan && !e.proposedChanges && !e.draftReview?.items.length;
|
|
2045
2051
|
}
|
|
2046
|
-
var
|
|
2052
|
+
var qi = [
|
|
2047
2053
|
"待补",
|
|
2048
2054
|
"后续",
|
|
2049
2055
|
"将在",
|
|
@@ -2069,25 +2075,25 @@ var Ki = [
|
|
|
2069
2075
|
"coming soon",
|
|
2070
2076
|
"tbd"
|
|
2071
2077
|
];
|
|
2072
|
-
function
|
|
2078
|
+
function Ji(e) {
|
|
2073
2079
|
let t = [], n = [];
|
|
2074
2080
|
for (let r of e) {
|
|
2075
2081
|
if (typeof r != "string") continue;
|
|
2076
2082
|
let e = r.trim();
|
|
2077
2083
|
if (!e) continue;
|
|
2078
2084
|
let i = e.toLowerCase();
|
|
2079
|
-
|
|
2085
|
+
qi.some((e) => i.includes(e)) ? n.push(e) : t.push(e);
|
|
2080
2086
|
}
|
|
2081
2087
|
return {
|
|
2082
2088
|
designNotes: t,
|
|
2083
2089
|
deferred: n
|
|
2084
2090
|
};
|
|
2085
2091
|
}
|
|
2086
|
-
function Ji(e) {
|
|
2087
|
-
let t = Hi(e);
|
|
2088
|
-
return t === "awaiting" || t === "failed" || !!e.pendingActionId || !!e.draftReview?.items.length || !!e.proposedPlan || !!e.proposedChanges || Gi(e);
|
|
2089
|
-
}
|
|
2090
2092
|
function Yi(e) {
|
|
2093
|
+
let t = Ui(e);
|
|
2094
|
+
return t === "awaiting" || t === "failed" || !!e.pendingActionId || !!e.draftReview?.items.length || !!e.proposedPlan || !!e.proposedChanges || Ki(e);
|
|
2095
|
+
}
|
|
2096
|
+
function Xi(e) {
|
|
2091
2097
|
switch (e) {
|
|
2092
2098
|
case "failed": return 4;
|
|
2093
2099
|
case "awaiting": return 3;
|
|
@@ -2095,10 +2101,13 @@ function Yi(e) {
|
|
|
2095
2101
|
case "completed": return 1;
|
|
2096
2102
|
}
|
|
2097
2103
|
}
|
|
2098
|
-
function
|
|
2104
|
+
function Zi(e) {
|
|
2105
|
+
return /^\((?:called [^)]*|tool call|no content)\)$/.test(e.trim());
|
|
2106
|
+
}
|
|
2107
|
+
function Qi(e) {
|
|
2099
2108
|
let t = /* @__PURE__ */ new Map();
|
|
2100
2109
|
for (let n of e) {
|
|
2101
|
-
let e =
|
|
2110
|
+
let e = Ui(n), r = `${n.toolName}:${e}`, i = t.get(r);
|
|
2102
2111
|
if (i) {
|
|
2103
2112
|
i.count += 1, i.errorText = i.errorText ?? n.errorText;
|
|
2104
2113
|
continue;
|
|
@@ -2113,11 +2122,11 @@ function Xi(e) {
|
|
|
2113
2122
|
});
|
|
2114
2123
|
}
|
|
2115
2124
|
return Array.from(t.values()).sort((e, t) => {
|
|
2116
|
-
let n =
|
|
2125
|
+
let n = Xi(t.state) - Xi(e.state);
|
|
2117
2126
|
return n === 0 ? e.title.localeCompare(t.title) : n;
|
|
2118
2127
|
});
|
|
2119
2128
|
}
|
|
2120
|
-
function
|
|
2129
|
+
function $i({ health: e }) {
|
|
2121
2130
|
if (!e) return null;
|
|
2122
2131
|
let t = e.issues ?? [], n = t.filter((e) => e.severity === "error"), r = t.filter((e) => e.severity !== "error"), i = e.checked, a = !!i && i.seeds + i.views + i.widgets > 0, o = [];
|
|
2123
2132
|
if (typeof e.seededRows == "number" && e.seededRows > 0 && !e.seedError && o.push(`${e.seededRows} sample row${e.seededRows === 1 ? "" : "s"} live`), a && n.length === 0) {
|
|
@@ -2147,7 +2156,7 @@ function Zi({ health: e }) {
|
|
|
2147
2156
|
]
|
|
2148
2157
|
});
|
|
2149
2158
|
}
|
|
2150
|
-
var
|
|
2159
|
+
var ea = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type your message...", onSendMessage: i, onClear: a, onStop: o, onReload: s, onUpgrade: c, disabled: l = !1, readOnly: u = !1, isLoading: d = !1, error: f, showTimestamp: p = !1, showAvatars: m = !1, userAvatarUrl: h, userAvatarFallback: g = "You", assistantAvatarUrl: _, assistantAvatarFallback: v = "AI", hideClearBar: y = !1, maxHeight: b = "500px", enableMarkdown: x = !0, enableFileUpload: S = !1, acceptedFileTypes: C = "image/*,.pdf,.doc,.docx,.txt", maxFileSize: w = 10 * 1024 * 1024, suggestions: T, labels: E, models: D, selectedModelId: O, onModelChange: k, headerSlot: A, promptOverlaySlot: j, onInputChange: M, onToolApprove: N, toolApproveLabel: P = "Approve", toolDenyLabel: F = "Deny", toolDenyReason: I = "User denied the operation", toolDecisions: L, onReviewDraft: ee, toolReviewLabel: te = (e) => `Review ${e} change${e === 1 ? "" : "s"}`, onPublishDrafts: R, onOpenBuiltApp: ne, openBuiltAppLabel: re = "Open app", onPreviewDraftApp: z, previewDraftLabel: ie = "Preview", onDraftArtifacts: B, onBuildMaterialized: ae, publishDraftsLabel: V = "Publish", publishedLabel: oe = "Published", verifiedLabel: se = "Verified", nextStepsLabel: ce = "What's next", planTitleLabel: le = "Proposed plan", planExtendLabel: ue = "Adding to existing app", planQuestionsLabel: de = "Confirm before building", planAssumptionsLabel: fe = "Assumptions", planDeferredLabel: pe = "Not yet built", planApproveHintLabel: me = "Reply to approve or adjust this plan.", planApproveLabel: he = "Build it", planAdjustLabel: ge = "Adjust", planBuiltLabel: _e = "Built", planReadyLabel: ve = "The plan is ready. Build it now, or tell me what to adjust.", planApproveMessage: ye = "Looks good — build it as proposed.", planApproveDefaultsMessage: be = "Build it with your best assumptions; use sensible defaults for the open questions.", planAnswerMessage: xe = (e, t) => `For "${e}", go with: ${t}.`, fetchPendingDraftCount: H, autoPublishDrafts: U = !1, processVisibility: W = "summary", surface: Se = "card", ...Ce }, we) => {
|
|
2151
2160
|
let G = d ? "streaming" : "ready", K = Se === "plain", [Te, Ee] = e.useState(null), De = e.useRef(""), Oe = e.useRef(null), J = e.useMemo(() => ({
|
|
2152
2161
|
emptyTitle: E?.emptyTitle ?? "Start a conversation",
|
|
2153
2162
|
emptyDescription: E?.emptyDescription ?? "Ask anything — the assistant has access to your current app context.",
|
|
@@ -2174,7 +2183,7 @@ var Qi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2174
2183
|
connectionStalledLabel: E?.connectionStalledLabel ?? "Still working…",
|
|
2175
2184
|
connectionOfflineLabel: E?.connectionOfflineLabel ?? "Connection lost — reconnecting…",
|
|
2176
2185
|
designingPlanLabel: E?.designingPlanLabel ?? "Designing your app…",
|
|
2177
|
-
designingPlanHints: E?.designingPlanHints ??
|
|
2186
|
+
designingPlanHints: E?.designingPlanHints ?? la
|
|
2178
2187
|
}), [E]), [Ae, je] = e.useState(() => /* @__PURE__ */ new Set()), [Ne, Fe] = e.useState(() => /* @__PURE__ */ new Map()), [Ie, Le] = e.useState(() => /* @__PURE__ */ new Map()), Re = e.useRef(/* @__PURE__ */ new Set()), ze = e.useCallback(async (e) => {
|
|
2179
2188
|
if (H) try {
|
|
2180
2189
|
let t = await H(e);
|
|
@@ -2304,7 +2313,7 @@ var Qi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2304
2313
|
navigator.clipboard?.writeText(e.content), Ee(e.id), window.setTimeout(() => Ee((t) => t === e.id ? null : t), 1500);
|
|
2305
2314
|
}, []), it = e.useMemo(() => {
|
|
2306
2315
|
let e = /* @__PURE__ */ new Set(), t = [], r = -1, i = 0;
|
|
2307
|
-
for (let e of n) for (let n of e.toolInvocations ?? []) (n.proposedPlan ||
|
|
2316
|
+
for (let e of n) for (let n of e.toolInvocations ?? []) (n.proposedPlan || Ki(n)) && n.toolCallId && t.push({
|
|
2308
2317
|
id: n.toolCallId,
|
|
2309
2318
|
order: i
|
|
2310
2319
|
}), n.toolName === "apply_blueprint" && (r = i), i += 1;
|
|
@@ -2323,7 +2332,7 @@ var Qi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2323
2332
|
}
|
|
2324
2333
|
return e;
|
|
2325
2334
|
}, [n]), ot = (e) => {
|
|
2326
|
-
let t = e.state ?? (e.errorText ? "output-error" : e.result === void 0 ? "input-available" : "output-available"), n = `tool-${e.toolName}`, r = L?.[e.toolCallId], a = t === "approval-requested" && !!N && !r, o = t === "approval-requested" && !!e.pendingActionId, s = zn(e.toolName), c = Bn(e.result), l = W === "debug" && s && s.toLowerCase() !== e.toolName.toLowerCase(), u = W === "debug" || a, d = e.draftReview?.packageId, f = d === void 0 ? void 0 : Ie.get(d), p = f === void 0 ? Ae.has(e.toolCallId) : f === 0, m = t === "input-streaming" || t === "input-available", h = /* @__PURE__ */ $("span", {
|
|
2335
|
+
let t = e.state ?? (e.errorText ? "output-error" : e.result === void 0 ? "input-available" : "output-available"), n = `tool-${e.toolName}`, r = L?.[e.toolCallId], a = t === "approval-requested" && !!N && !r, o = t === "approval-requested" && !!e.pendingActionId, s = zn(e.toolName), c = Bn(e.result), l = W === "debug" && s && s.toLowerCase() !== e.toolName.toLowerCase(), u = W === "debug" || a, d = e.draftReview?.packageId, f = d === void 0 ? void 0 : Ie.get(d), p = f === void 0 ? Ae.has(e.toolCallId) : f === 0, m = t === "input-streaming" || t === "input-available", h = t === "output-available" && Hi(e.result) ? "approval-requested" : t, g = /* @__PURE__ */ $("span", {
|
|
2327
2336
|
className: "inline-flex min-w-0 items-center gap-2",
|
|
2328
2337
|
children: [
|
|
2329
2338
|
/* @__PURE__ */ Q("span", { children: s || e.toolName }),
|
|
@@ -2331,22 +2340,22 @@ var Qi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2331
2340
|
className: "rounded bg-muted px-1 py-px text-[10px] font-mono text-muted-foreground",
|
|
2332
2341
|
children: e.toolName
|
|
2333
2342
|
}) : null,
|
|
2334
|
-
m ?
|
|
2343
|
+
m ? Gi(e) ? /* @__PURE__ */ Q(fa, {
|
|
2335
2344
|
label: J.designingPlanLabel,
|
|
2336
2345
|
hints: J.designingPlanHints,
|
|
2337
2346
|
offlineLabel: J.connectionOfflineLabel
|
|
2338
|
-
}) : /* @__PURE__ */ Q(
|
|
2347
|
+
}) : /* @__PURE__ */ Q(pa, { offlineLabel: J.connectionOfflineLabel }) : null
|
|
2339
2348
|
]
|
|
2340
2349
|
});
|
|
2341
2350
|
return /* @__PURE__ */ $(bi, {
|
|
2342
|
-
defaultOpen: t === "output-error" || t === "approval-requested" || !!(e.draftReview && e.draftReview.items.length > 0) || !!e.proposedPlan || !!e.proposedChanges ||
|
|
2351
|
+
defaultOpen: t === "output-error" || t === "approval-requested" || !!(e.draftReview && e.draftReview.items.length > 0) || !!e.proposedPlan || !!e.proposedChanges || Ki(e),
|
|
2343
2352
|
children: [/* @__PURE__ */ Q(Si, {
|
|
2344
2353
|
type: n,
|
|
2345
|
-
state:
|
|
2346
|
-
title:
|
|
2354
|
+
state: h,
|
|
2355
|
+
title: g
|
|
2347
2356
|
}), /* @__PURE__ */ $(Ci, { children: [
|
|
2348
2357
|
u && e.args !== void 0 ? /* @__PURE__ */ Q(wi, { input: e.args }) : null,
|
|
2349
|
-
o ? null : u || t === "output-error" ? /* @__PURE__ */ Q(
|
|
2358
|
+
o ? null : u || t === "output-error" ? /* @__PURE__ */ Q(Ca, {
|
|
2350
2359
|
output: c,
|
|
2351
2360
|
errorText: e.errorText
|
|
2352
2361
|
}) : null,
|
|
@@ -2438,7 +2447,7 @@ var Qi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2438
2447
|
children: [/* @__PURE__ */ Q(ke, { className: "mt-0.5 size-3.5 shrink-0" }), /* @__PURE__ */ Q("span", { children: e.message })]
|
|
2439
2448
|
}, `w${t}`))]
|
|
2440
2449
|
}) : null,
|
|
2441
|
-
Ae.has(e.toolCallId) ? /* @__PURE__ */ Q(
|
|
2450
|
+
Ae.has(e.toolCallId) ? /* @__PURE__ */ Q($i, { health: Ne.get(e.toolCallId) }) : null,
|
|
2442
2451
|
e.draftReview.nextSteps && e.draftReview.nextSteps.length > 0 ? /* @__PURE__ */ $("div", {
|
|
2443
2452
|
className: "flex flex-col gap-1 border-t bg-muted/20 px-3 py-2",
|
|
2444
2453
|
"data-testid": "draft-next-steps",
|
|
@@ -2500,7 +2509,7 @@ var Qi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2500
2509
|
}) : null;
|
|
2501
2510
|
})(),
|
|
2502
2511
|
(() => {
|
|
2503
|
-
let { designNotes: t, deferred: n } =
|
|
2512
|
+
let { designNotes: t, deferred: n } = Ji(e.proposedPlan.assumptions);
|
|
2504
2513
|
return /* @__PURE__ */ $(Z, { children: [t.length > 0 ? /* @__PURE__ */ $("div", {
|
|
2505
2514
|
className: "flex flex-col gap-0.5",
|
|
2506
2515
|
"data-testid": "proposed-plan-assumptions",
|
|
@@ -2588,7 +2597,7 @@ var Qi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2588
2597
|
})
|
|
2589
2598
|
]
|
|
2590
2599
|
}) : null,
|
|
2591
|
-
|
|
2600
|
+
Ki(e) ? /* @__PURE__ */ $("div", {
|
|
2592
2601
|
className: "flex flex-col gap-2 border-t bg-muted/20 px-3 py-2.5",
|
|
2593
2602
|
"data-testid": "proposed-plan-fallback",
|
|
2594
2603
|
children: [
|
|
@@ -2646,7 +2655,7 @@ var Qi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2646
2655
|
className: "flex flex-col gap-1",
|
|
2647
2656
|
children: e.proposedChanges.changes.map((e, t) => /* @__PURE__ */ $("div", {
|
|
2648
2657
|
className: "flex items-start gap-1.5 rounded-md border bg-background px-2 py-1 text-[11px] text-foreground/80",
|
|
2649
|
-
children: [/* @__PURE__ */ Q(mt, { className: "mt-px size-3 shrink-0 text-foreground/40" }), /* @__PURE__ */ Q("span", { children:
|
|
2658
|
+
children: [/* @__PURE__ */ Q(mt, { className: "mt-px size-3 shrink-0 text-foreground/40" }), /* @__PURE__ */ Q("span", { children: Wi(e) })]
|
|
2650
2659
|
}, t))
|
|
2651
2660
|
}),
|
|
2652
2661
|
i ? at.has(e.toolCallId) ? /* @__PURE__ */ Q("div", {
|
|
@@ -2717,38 +2726,38 @@ var Qi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2717
2726
|
}) : /* @__PURE__ */ Q(Me, { className: "size-4" })
|
|
2718
2727
|
}),
|
|
2719
2728
|
/* @__PURE__ */ $("div", {
|
|
2720
|
-
className: "space-y-1",
|
|
2729
|
+
className: "w-full max-w-full space-y-1",
|
|
2721
2730
|
children: [/* @__PURE__ */ Q("h3", {
|
|
2722
|
-
className: "text-sm font-medium text-foreground/90",
|
|
2731
|
+
className: "text-sm font-medium text-foreground/90 break-words",
|
|
2723
2732
|
children: J.emptyTitle
|
|
2724
2733
|
}), /* @__PURE__ */ Q("p", {
|
|
2725
|
-
className: "text-sm text-muted-foreground",
|
|
2734
|
+
className: "text-sm text-muted-foreground break-words",
|
|
2726
2735
|
children: J.emptyDescription
|
|
2727
2736
|
})]
|
|
2728
2737
|
}),
|
|
2729
|
-
T && T.length > 0 ? /* @__PURE__ */ Q(
|
|
2730
|
-
className: "justify-center gap-2",
|
|
2738
|
+
T && T.length > 0 ? /* @__PURE__ */ Q("div", {
|
|
2739
|
+
className: "flex w-full max-w-full flex-wrap justify-center gap-2",
|
|
2731
2740
|
children: T.map((e) => /* @__PURE__ */ Q(mi, {
|
|
2732
|
-
className: "h-8 border-border/60 bg-background/80 px-3 text-xs font-medium text-foreground/90 shadow-none hover:bg-muted/60",
|
|
2741
|
+
className: "h-auto min-h-8 min-w-0 max-w-full whitespace-normal break-words rounded-full border-border/60 bg-background/80 px-3 py-1 text-left text-xs font-medium text-foreground/90 shadow-none hover:bg-muted/60",
|
|
2733
2742
|
suggestion: e,
|
|
2734
2743
|
onClick: $e
|
|
2735
2744
|
}, e))
|
|
2736
2745
|
}) : null
|
|
2737
2746
|
]
|
|
2738
2747
|
}) : n.map((e) => {
|
|
2739
|
-
let t = e.role === "user", n = e.toolInvocations ?? [], r = e.reasoning?.trim(), i = e.sources ?? [], a = t ? void 0 : e.buildProgress, o = !t && !n.some((e) => !!e.proposedPlan) ? e.blueprintProgress : void 0, c = !t && !!e.streaming && !e.content && n.length === 0 && !r && !a && !o, l = !t && W === "summary" ? n.filter((e) => !
|
|
2748
|
+
let t = e.role === "user", n = e.toolInvocations ?? [], r = e.reasoning?.trim(), i = e.sources ?? [], a = t ? void 0 : e.buildProgress, o = !t && !n.some((e) => !!e.proposedPlan) ? e.blueprintProgress : void 0, c = !t && !!e.streaming && !e.content && n.length === 0 && !r && !a && !o, l = !t && W === "summary" ? n.filter((e) => !Yi(e) && !(o && e.toolName === "propose_blueprint")) : [], u = !t && W === "debug" ? n : !t && W !== "debug" ? n.filter(Yi) : [];
|
|
2740
2749
|
return /* @__PURE__ */ Q(er, {
|
|
2741
2750
|
from: Bi(e.role),
|
|
2742
2751
|
children: /* @__PURE__ */ $("div", {
|
|
2743
2752
|
className: q("flex w-full gap-2.5", m ? t ? "flex-row-reverse items-start" : "flex-row items-start" : "flex-col"),
|
|
2744
|
-
children: [m ? /* @__PURE__ */ Q(
|
|
2753
|
+
children: [m ? /* @__PURE__ */ Q(ta, {
|
|
2745
2754
|
isUser: t,
|
|
2746
2755
|
url: t ? h : _,
|
|
2747
2756
|
fallback: t ? g : v
|
|
2748
2757
|
}) : null, /* @__PURE__ */ $("div", {
|
|
2749
2758
|
className: q("flex min-w-0 flex-col gap-2", m && !t && "flex-1"),
|
|
2750
2759
|
children: [/* @__PURE__ */ $(tr, { children: [
|
|
2751
|
-
o ? /* @__PURE__ */ Q(
|
|
2760
|
+
o ? /* @__PURE__ */ Q(ga, {
|
|
2752
2761
|
progress: o,
|
|
2753
2762
|
designingLabel: J.designingPlanLabel,
|
|
2754
2763
|
extendLabel: ue,
|
|
@@ -2756,7 +2765,7 @@ var Qi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2756
2765
|
stalledLabel: J.connectionStalledLabel,
|
|
2757
2766
|
offlineLabel: J.connectionOfflineLabel
|
|
2758
2767
|
}) : null,
|
|
2759
|
-
a ? /* @__PURE__ */ Q(
|
|
2768
|
+
a ? /* @__PURE__ */ Q(_a, {
|
|
2760
2769
|
progress: a,
|
|
2761
2770
|
onOpenBuiltApp: ne,
|
|
2762
2771
|
openBuiltAppLabel: re,
|
|
@@ -2771,15 +2780,19 @@ var Qi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2771
2780
|
className: "mb-2",
|
|
2772
2781
|
children: [/* @__PURE__ */ Q(Ni, {}), /* @__PURE__ */ Q(Pi, { children: r })]
|
|
2773
2782
|
}) : null,
|
|
2774
|
-
!t && W === "summary" && l.length > 0 ? /* @__PURE__ */ Q(
|
|
2775
|
-
groups:
|
|
2783
|
+
!t && W === "summary" && l.length > 0 ? /* @__PURE__ */ Q(va, {
|
|
2784
|
+
groups: Qi(l),
|
|
2776
2785
|
labels: J
|
|
2777
2786
|
}) : null,
|
|
2778
2787
|
!t && u.length > 0 ? u.map(ot) : null,
|
|
2779
2788
|
t ? e.content ? /* @__PURE__ */ Q("div", {
|
|
2780
2789
|
className: "whitespace-pre-wrap break-words",
|
|
2781
2790
|
children: e.content
|
|
2782
|
-
}) : null : c ? /* @__PURE__ */ Q(
|
|
2791
|
+
}) : null : c ? /* @__PURE__ */ Q(ra, {}) : e.content ? Zi(e.content) ? /* @__PURE__ */ Q("span", {
|
|
2792
|
+
className: "text-xs italic text-muted-foreground/70",
|
|
2793
|
+
title: e.content,
|
|
2794
|
+
children: J.agentActivity
|
|
2795
|
+
}) : /* @__PURE__ */ Q(fr, { children: e.content }) : null,
|
|
2783
2796
|
e.streaming && !c ? /* @__PURE__ */ Q("span", {
|
|
2784
2797
|
"aria-hidden": !0,
|
|
2785
2798
|
className: "ml-0.5 inline-block w-[2px] h-4 align-middle bg-current animate-pulse"
|
|
@@ -2838,7 +2851,7 @@ var Qi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2838
2851
|
})]
|
|
2839
2852
|
})
|
|
2840
2853
|
}, e.id);
|
|
2841
|
-
}), d && !n.some((e) => e.streaming) ? /* @__PURE__ */ Q(
|
|
2854
|
+
}), d && !n.some((e) => e.streaming) ? /* @__PURE__ */ Q(na, {
|
|
2842
2855
|
showAvatar: m,
|
|
2843
2856
|
assistantAvatarUrl: _,
|
|
2844
2857
|
assistantAvatarFallback: v,
|
|
@@ -2848,11 +2861,11 @@ var Qi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2848
2861
|
}) : null]
|
|
2849
2862
|
}), /* @__PURE__ */ Q(Xn, {})]
|
|
2850
2863
|
}),
|
|
2851
|
-
f ? Wn(f) && !Un(f) ? /* @__PURE__ */ Q(
|
|
2864
|
+
f ? Wn(f) && !Un(f) ? /* @__PURE__ */ Q(xa, {
|
|
2852
2865
|
error: f,
|
|
2853
2866
|
rateLimitedLabel: J.sendFailedRateLimited,
|
|
2854
2867
|
genericLabel: J.sendFailedGeneric
|
|
2855
|
-
}) : /* @__PURE__ */ Q(
|
|
2868
|
+
}) : /* @__PURE__ */ Q(Sa, {
|
|
2856
2869
|
error: f,
|
|
2857
2870
|
onReload: s,
|
|
2858
2871
|
onUpgrade: c
|
|
@@ -2918,8 +2931,8 @@ var Qi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2918
2931
|
]
|
|
2919
2932
|
});
|
|
2920
2933
|
});
|
|
2921
|
-
|
|
2922
|
-
function
|
|
2934
|
+
ea.displayName = "ChatbotEnhanced";
|
|
2935
|
+
function ta({ isUser: e, url: t, fallback: n }) {
|
|
2923
2936
|
return /* @__PURE__ */ Q("div", {
|
|
2924
2937
|
className: q("mt-0.5 flex size-7 shrink-0 items-center justify-center overflow-hidden rounded-full text-[11px] font-medium", e ? "bg-secondary text-secondary-foreground" : "bg-primary/10 text-primary"),
|
|
2925
2938
|
"aria-hidden": "true",
|
|
@@ -2930,13 +2943,13 @@ function $i({ isUser: e, url: t, fallback: n }) {
|
|
|
2930
2943
|
}) : e ? n?.trim()?.charAt(0)?.toUpperCase() || "U" : /* @__PURE__ */ Q(Me, { className: "size-4" })
|
|
2931
2944
|
});
|
|
2932
2945
|
}
|
|
2933
|
-
function
|
|
2946
|
+
function na({ showAvatar: e, assistantAvatarUrl: t, assistantAvatarFallback: n, waitingLabel: r, stalledLabel: i, offlineLabel: a }) {
|
|
2934
2947
|
return /* @__PURE__ */ Q(er, {
|
|
2935
2948
|
from: "assistant",
|
|
2936
2949
|
"aria-live": "polite",
|
|
2937
2950
|
children: /* @__PURE__ */ $("div", {
|
|
2938
2951
|
className: q("flex w-full gap-2.5", e ? "flex-row items-start" : "flex-col"),
|
|
2939
|
-
children: [e ? /* @__PURE__ */ Q(
|
|
2952
|
+
children: [e ? /* @__PURE__ */ Q(ta, {
|
|
2940
2953
|
isUser: !1,
|
|
2941
2954
|
url: t,
|
|
2942
2955
|
fallback: n
|
|
@@ -2944,7 +2957,7 @@ function ea({ showAvatar: e, assistantAvatarUrl: t, assistantAvatarFallback: n,
|
|
|
2944
2957
|
className: "rounded-lg border bg-muted/30 px-3 py-2 text-muted-foreground",
|
|
2945
2958
|
children: /* @__PURE__ */ $("span", {
|
|
2946
2959
|
className: "inline-flex items-center gap-2",
|
|
2947
|
-
children: [/* @__PURE__ */ Q(
|
|
2960
|
+
children: [/* @__PURE__ */ Q(ra, {}), /* @__PURE__ */ Q(ca, {
|
|
2948
2961
|
active: !0,
|
|
2949
2962
|
pending: !0,
|
|
2950
2963
|
activityKey: 0,
|
|
@@ -2957,7 +2970,7 @@ function ea({ showAvatar: e, assistantAvatarUrl: t, assistantAvatarFallback: n,
|
|
|
2957
2970
|
})
|
|
2958
2971
|
});
|
|
2959
2972
|
}
|
|
2960
|
-
function
|
|
2973
|
+
function ra() {
|
|
2961
2974
|
return /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("span", {
|
|
2962
2975
|
className: "sr-only",
|
|
2963
2976
|
children: "Assistant is responding"
|
|
@@ -2971,12 +2984,12 @@ function ta() {
|
|
|
2971
2984
|
]
|
|
2972
2985
|
})] });
|
|
2973
2986
|
}
|
|
2974
|
-
function
|
|
2987
|
+
function ia(e) {
|
|
2975
2988
|
let t = Math.floor(e / 60), n = e % 60;
|
|
2976
2989
|
return `${t}:${String(n).padStart(2, "0")}`;
|
|
2977
2990
|
}
|
|
2978
|
-
var
|
|
2979
|
-
function
|
|
2991
|
+
var aa = 6;
|
|
2992
|
+
function oa(t, n) {
|
|
2980
2993
|
let r = e.useRef(0), i = e.useRef(0), [a, o] = e.useState({
|
|
2981
2994
|
elapsed: 0,
|
|
2982
2995
|
quiet: 0
|
|
@@ -3005,10 +3018,10 @@ function ia(t, n) {
|
|
|
3005
3018
|
}, [t]), {
|
|
3006
3019
|
elapsedSeconds: a.elapsed,
|
|
3007
3020
|
quietSeconds: a.quiet,
|
|
3008
|
-
live: a.quiet <
|
|
3021
|
+
live: a.quiet < aa
|
|
3009
3022
|
};
|
|
3010
3023
|
}
|
|
3011
|
-
function
|
|
3024
|
+
function sa() {
|
|
3012
3025
|
let [t, n] = e.useState(() => typeof navigator < "u" && navigator.onLine === !1);
|
|
3013
3026
|
return e.useEffect(() => {
|
|
3014
3027
|
if (typeof window > "u") return;
|
|
@@ -3018,8 +3031,8 @@ function aa() {
|
|
|
3018
3031
|
};
|
|
3019
3032
|
}, []), t;
|
|
3020
3033
|
}
|
|
3021
|
-
function
|
|
3022
|
-
let { elapsedSeconds: o, quietSeconds: s, live: c } =
|
|
3034
|
+
function ca({ active: e, activityKey: t, pending: n = !1, waitingLabel: r, stalledLabel: i = "Still working…", offlineLabel: a = "Connection lost — reconnecting…" }) {
|
|
3035
|
+
let { elapsedSeconds: o, quietSeconds: s, live: c } = oa(e, t), l = sa() ? "offline" : c ? n ? "waiting" : "receiving" : "stalled", u = ia(o);
|
|
3023
3036
|
return /* @__PURE__ */ $("span", {
|
|
3024
3037
|
className: q("inline-flex items-center gap-1.5 text-xs tabular-nums", l === "offline" ? "text-red-600 font-medium" : l === "stalled" ? "text-amber-600 font-medium" : "font-normal text-muted-foreground"),
|
|
3025
3038
|
"aria-live": "polite",
|
|
@@ -3042,7 +3055,7 @@ function oa({ active: e, activityKey: t, pending: n = !1, waitingLabel: r, stall
|
|
|
3042
3055
|
]
|
|
3043
3056
|
});
|
|
3044
3057
|
}
|
|
3045
|
-
var
|
|
3058
|
+
var la = [
|
|
3046
3059
|
"Mapping out the data you’ll track…",
|
|
3047
3060
|
"Shaping objects and their fields…",
|
|
3048
3061
|
"Connecting related records…",
|
|
@@ -3053,21 +3066,21 @@ var sa = [
|
|
|
3053
3066
|
"Sketching a dashboard to track it…",
|
|
3054
3067
|
"Double-checking the structure hangs together…",
|
|
3055
3068
|
"Pulling the plan together…"
|
|
3056
|
-
],
|
|
3057
|
-
function
|
|
3069
|
+
], ua = 3500;
|
|
3070
|
+
function da(e, t, n = ua) {
|
|
3058
3071
|
if (t <= 0) return -1;
|
|
3059
3072
|
if (t === 1) return 0;
|
|
3060
|
-
let r = Math.floor((Number.isFinite(e) && e > 0 ? e : 0) / (n > 0 ? n :
|
|
3073
|
+
let r = Math.floor((Number.isFinite(e) && e > 0 ? e : 0) / (n > 0 ? n : ua));
|
|
3061
3074
|
return Math.min(r, t - 1);
|
|
3062
3075
|
}
|
|
3063
|
-
function
|
|
3076
|
+
function fa({ label: t, hints: n, offlineLabel: r }) {
|
|
3064
3077
|
let [i, a] = e.useState(0);
|
|
3065
3078
|
e.useEffect(() => {
|
|
3066
3079
|
if (n.length <= 1) return;
|
|
3067
|
-
let e = Date.now(), t = setInterval(() => a(Date.now() - e),
|
|
3080
|
+
let e = Date.now(), t = setInterval(() => a(Date.now() - e), ua);
|
|
3068
3081
|
return () => clearInterval(t);
|
|
3069
3082
|
}, [n.length]);
|
|
3070
|
-
let o =
|
|
3083
|
+
let o = da(i, n.length), s = o >= 0 ? n[o] : void 0, c = n.length > 1 && n.length <= 12;
|
|
3071
3084
|
return /* @__PURE__ */ $("span", {
|
|
3072
3085
|
className: "inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",
|
|
3073
3086
|
"data-testid": "build-proposal-progress",
|
|
@@ -3091,12 +3104,12 @@ function ua({ label: t, hints: n, offlineLabel: r }) {
|
|
|
3091
3104
|
"aria-hidden": !0,
|
|
3092
3105
|
children: n.map((e, t) => /* @__PURE__ */ Q("span", { className: q("size-1 rounded-full transition-colors", t <= o ? "bg-primary/70" : "bg-muted-foreground/25") }, t))
|
|
3093
3106
|
}) : null,
|
|
3094
|
-
/* @__PURE__ */ Q(
|
|
3107
|
+
/* @__PURE__ */ Q(pa, { offlineLabel: r })
|
|
3095
3108
|
]
|
|
3096
3109
|
});
|
|
3097
3110
|
}
|
|
3098
|
-
function
|
|
3099
|
-
let [n, r] = e.useState(0), i =
|
|
3111
|
+
function pa({ offlineLabel: t }) {
|
|
3112
|
+
let [n, r] = e.useState(0), i = sa();
|
|
3100
3113
|
return e.useEffect(() => {
|
|
3101
3114
|
let e = Date.now(), t = setInterval(() => r(Math.floor((Date.now() - e) / 1e3)), 1e3);
|
|
3102
3115
|
return () => clearInterval(t);
|
|
@@ -3109,25 +3122,25 @@ function da({ offlineLabel: t }) {
|
|
|
3109
3122
|
className: "size-3 shrink-0",
|
|
3110
3123
|
"aria-hidden": !0
|
|
3111
3124
|
}),
|
|
3112
|
-
/* @__PURE__ */ Q("span", { children:
|
|
3125
|
+
/* @__PURE__ */ Q("span", { children: ia(n) }),
|
|
3113
3126
|
i ? /* @__PURE__ */ $("span", { children: ["· ", t] }) : null
|
|
3114
3127
|
]
|
|
3115
3128
|
});
|
|
3116
3129
|
}
|
|
3117
|
-
var
|
|
3130
|
+
var ma = [
|
|
3118
3131
|
"object",
|
|
3119
3132
|
"view",
|
|
3120
3133
|
"dashboard",
|
|
3121
3134
|
"app",
|
|
3122
3135
|
"seed"
|
|
3123
|
-
],
|
|
3136
|
+
], ha = {
|
|
3124
3137
|
object: "Objects",
|
|
3125
3138
|
view: "Views",
|
|
3126
3139
|
dashboard: "Dashboards",
|
|
3127
3140
|
app: "App",
|
|
3128
3141
|
seed: "Sample data"
|
|
3129
3142
|
};
|
|
3130
|
-
function
|
|
3143
|
+
function ga({ progress: e, designingLabel: t = "Designing your app…", extendLabel: n = "Adding to existing app", waitingLabel: r = "Waiting for server…", stalledLabel: i = "Still working…", offlineLabel: a = "Connection lost — reconnecting…" }) {
|
|
3131
3144
|
let { phase: o, summary: s, appLabel: c, targetApp: l, objects: u, counts: d, seq: f } = e, p = o === "done", m = f ?? `${o}:${u.length}`, h = p && (s || c) || t, g = [];
|
|
3132
3145
|
return d?.objects && g.push(`${d.objects} object${d.objects === 1 ? "" : "s"}`), d?.views && g.push(`${d.views} view${d.views === 1 ? "" : "s"}`), d?.dashboards && g.push(`${d.dashboards} dashboard${d.dashboards === 1 ? "" : "s"}`), /* @__PURE__ */ $("div", {
|
|
3133
3146
|
className: "rounded-lg border bg-muted/30 p-3 text-sm",
|
|
@@ -3154,7 +3167,7 @@ function ma({ progress: e, designingLabel: t = "Designing your app…", extendLa
|
|
|
3154
3167
|
}) : null,
|
|
3155
3168
|
p ? null : /* @__PURE__ */ Q("span", {
|
|
3156
3169
|
className: "ml-auto shrink-0",
|
|
3157
|
-
children: /* @__PURE__ */ Q(
|
|
3170
|
+
children: /* @__PURE__ */ Q(ca, {
|
|
3158
3171
|
active: !0,
|
|
3159
3172
|
activityKey: m,
|
|
3160
3173
|
waitingLabel: r,
|
|
@@ -3191,13 +3204,13 @@ function ma({ progress: e, designingLabel: t = "Designing your app…", extendLa
|
|
|
3191
3204
|
]
|
|
3192
3205
|
});
|
|
3193
3206
|
}
|
|
3194
|
-
function
|
|
3207
|
+
function _a({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app", onPreviewDraftApp: r, previewDraftLabel: i = "Preview", waitingLabel: a = "Waiting for server…", stalledLabel: o = "Still working…", offlineLabel: s = "Connection lost — reconnecting…" }) {
|
|
3195
3208
|
let { phase: c, appLabel: l, items: u, done: d, total: f, seq: p } = e, m = c === "done", h = p ?? `${c}:${d}:${u.length}`, g = u.find((e) => e.type === "app"), _ = f > 0 ? Math.min(100, Math.round(d / f * 100)) : m ? 100 : 6, v = /* @__PURE__ */ new Map();
|
|
3196
3209
|
for (let e of u) {
|
|
3197
3210
|
let t = v.get(e.type) ?? [];
|
|
3198
3211
|
t.push(e.name.replace(/_sample$/, "")), v.set(e.type, t);
|
|
3199
3212
|
}
|
|
3200
|
-
let y = [...
|
|
3213
|
+
let y = [...ma.filter((e) => v.has(e)), ...[...v.keys()].filter((e) => !ma.includes(e))];
|
|
3201
3214
|
return /* @__PURE__ */ $("div", {
|
|
3202
3215
|
className: "rounded-lg border bg-muted/30 p-3 text-sm",
|
|
3203
3216
|
"data-testid": "build-progress",
|
|
@@ -3213,7 +3226,7 @@ function ha({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app",
|
|
|
3213
3226
|
}) : null,
|
|
3214
3227
|
m ? null : /* @__PURE__ */ Q("span", {
|
|
3215
3228
|
className: "ml-auto",
|
|
3216
|
-
children: /* @__PURE__ */ Q(
|
|
3229
|
+
children: /* @__PURE__ */ Q(ca, {
|
|
3217
3230
|
active: !0,
|
|
3218
3231
|
activityKey: h,
|
|
3219
3232
|
waitingLabel: a,
|
|
@@ -3241,7 +3254,7 @@ function ha({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app",
|
|
|
3241
3254
|
children: [
|
|
3242
3255
|
/* @__PURE__ */ Q("span", {
|
|
3243
3256
|
className: "font-medium text-foreground",
|
|
3244
|
-
children:
|
|
3257
|
+
children: ha[e] ?? e
|
|
3245
3258
|
}),
|
|
3246
3259
|
" ",
|
|
3247
3260
|
t.slice(0, 6).join(", "),
|
|
@@ -3270,7 +3283,7 @@ function ha({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app",
|
|
|
3270
3283
|
]
|
|
3271
3284
|
});
|
|
3272
3285
|
}
|
|
3273
|
-
function
|
|
3286
|
+
function va({ groups: e, labels: t }) {
|
|
3274
3287
|
return e.length === 0 ? null : /* @__PURE__ */ Q("div", {
|
|
3275
3288
|
className: "not-prose mb-2 border-l border-border/70 pl-3",
|
|
3276
3289
|
children: /* @__PURE__ */ Q("div", {
|
|
@@ -3280,7 +3293,7 @@ function ga({ groups: e, labels: t }) {
|
|
|
3280
3293
|
children: [/* @__PURE__ */ $("div", {
|
|
3281
3294
|
className: "flex min-w-0 items-center gap-2",
|
|
3282
3295
|
children: [
|
|
3283
|
-
/* @__PURE__ */ Q(
|
|
3296
|
+
/* @__PURE__ */ Q(ya, { state: e.state }),
|
|
3284
3297
|
/* @__PURE__ */ Q("span", {
|
|
3285
3298
|
className: "truncate font-medium text-foreground",
|
|
3286
3299
|
children: e.title
|
|
@@ -3290,22 +3303,22 @@ function ga({ groups: e, labels: t }) {
|
|
|
3290
3303
|
children: ["x", e.count]
|
|
3291
3304
|
}) : null
|
|
3292
3305
|
]
|
|
3293
|
-
}), e.state === "running" ? e.rawName === "propose_blueprint" ? /* @__PURE__ */ Q(
|
|
3306
|
+
}), e.state === "running" ? e.rawName === "propose_blueprint" ? /* @__PURE__ */ Q(fa, {
|
|
3294
3307
|
label: t.designingPlanLabel,
|
|
3295
3308
|
hints: t.designingPlanHints,
|
|
3296
3309
|
offlineLabel: t.connectionOfflineLabel
|
|
3297
|
-
}) : /* @__PURE__ */ Q(
|
|
3310
|
+
}) : /* @__PURE__ */ Q(pa, { offlineLabel: t.connectionOfflineLabel }) : /* @__PURE__ */ Q("span", {
|
|
3298
3311
|
className: q("shrink-0 text-[10px] font-medium", e.state === "failed" ? "text-destructive" : e.state === "completed" ? "text-emerald-700 dark:text-emerald-400" : "text-muted-foreground"),
|
|
3299
|
-
children:
|
|
3312
|
+
children: ba(e.state, t)
|
|
3300
3313
|
})]
|
|
3301
3314
|
}, e.key))
|
|
3302
3315
|
})
|
|
3303
3316
|
});
|
|
3304
3317
|
}
|
|
3305
|
-
function
|
|
3318
|
+
function ya({ state: e }) {
|
|
3306
3319
|
return e === "failed" ? /* @__PURE__ */ Q(X, { className: "size-3.5 shrink-0 text-destructive" }) : e === "completed" ? /* @__PURE__ */ Q(Y, { className: "size-3.5 shrink-0 text-emerald-600" }) : /* @__PURE__ */ Q(Ue, { className: "size-3.5 shrink-0 text-muted-foreground" });
|
|
3307
3320
|
}
|
|
3308
|
-
function
|
|
3321
|
+
function ba(e, t) {
|
|
3309
3322
|
switch (e) {
|
|
3310
3323
|
case "failed": return t.toolFailed;
|
|
3311
3324
|
case "awaiting": return t.toolAwaitingApproval;
|
|
@@ -3313,7 +3326,7 @@ function va(e, t) {
|
|
|
3313
3326
|
case "completed": return t.toolCompleted;
|
|
3314
3327
|
}
|
|
3315
3328
|
}
|
|
3316
|
-
function
|
|
3329
|
+
function xa({ error: t, rateLimitedLabel: n, genericLabel: r }) {
|
|
3317
3330
|
let i = e.useMemo(() => Kn(t) ? n : r, [
|
|
3318
3331
|
t,
|
|
3319
3332
|
n,
|
|
@@ -3335,7 +3348,7 @@ function ya({ error: t, rateLimitedLabel: n, genericLabel: r }) {
|
|
|
3335
3348
|
})
|
|
3336
3349
|
});
|
|
3337
3350
|
}
|
|
3338
|
-
function
|
|
3351
|
+
function Sa({ error: t, onReload: n, onUpgrade: r }) {
|
|
3339
3352
|
let i = e.useMemo(() => Un(t), [t]), { summary: a, details: o } = e.useMemo(() => Vn(t), [t]), [s, c] = e.useState(!1);
|
|
3340
3353
|
if (i) {
|
|
3341
3354
|
let e = typeof navigator < "u" && !!navigator.language?.toLowerCase().startsWith("zh"), t = (e ? i.message : i.messageEn ?? i.message) || (e ? "AI 额度已用完。" : "You have reached your AI quota."), n = i.topUp ? e ? "购买额度包" : "Buy a credit pack" : e ? "升级方案" : "Upgrade plan";
|
|
@@ -3407,7 +3420,7 @@ function ba({ error: t, onReload: n, onUpgrade: r }) {
|
|
|
3407
3420
|
})
|
|
3408
3421
|
});
|
|
3409
3422
|
}
|
|
3410
|
-
function
|
|
3423
|
+
function Ca({ output: e, errorText: t }) {
|
|
3411
3424
|
return t ? /* @__PURE__ */ Q(Ti, {
|
|
3412
3425
|
output: void 0,
|
|
3413
3426
|
errorText: t
|
|
@@ -3427,7 +3440,7 @@ function xa({ output: e, errorText: t }) {
|
|
|
3427
3440
|
}
|
|
3428
3441
|
//#endregion
|
|
3429
3442
|
//#region src/FloatingChatbot.tsx
|
|
3430
|
-
function
|
|
3443
|
+
function wa({ floatingConfig: t, headerExtra: n, headerActions: r, ...i }) {
|
|
3431
3444
|
let { position: a = "bottom-right", defaultOpen: o = !1, panelWidth: s = 400, panelHeight: c = 520, title: l = "Chat", triggerSize: u = 56 } = t ?? {}, [d, f] = e.useState(null);
|
|
3432
3445
|
e.useEffect(() => {
|
|
3433
3446
|
let e = document.getElementById("floating-chatbot-portal");
|
|
@@ -3447,7 +3460,7 @@ function Sa({ floatingConfig: t, headerExtra: n, headerActions: r, ...i }) {
|
|
|
3447
3460
|
height: c,
|
|
3448
3461
|
headerExtra: n,
|
|
3449
3462
|
headerActions: r,
|
|
3450
|
-
children: /* @__PURE__ */ Q(
|
|
3463
|
+
children: /* @__PURE__ */ Q(ea, {
|
|
3451
3464
|
...i,
|
|
3452
3465
|
maxHeight: "100%",
|
|
3453
3466
|
className: "h-full border-0 rounded-none"
|
|
@@ -3474,7 +3487,7 @@ Ft.register("chatbot", ({ schema: e, className: t, ...n }) => {
|
|
|
3474
3487
|
autoResponseDelay: e.autoResponseDelay,
|
|
3475
3488
|
onSend: e.onSend
|
|
3476
3489
|
});
|
|
3477
|
-
return /* @__PURE__ */ Q(
|
|
3490
|
+
return /* @__PURE__ */ Q(Ga, {
|
|
3478
3491
|
messages: r,
|
|
3479
3492
|
placeholder: e.placeholder,
|
|
3480
3493
|
onSendMessage: (e) => {
|
|
@@ -3640,7 +3653,7 @@ Ft.register("chatbot", ({ schema: e, className: t, ...n }) => {
|
|
|
3640
3653
|
autoResponseDelay: e.autoResponseDelay,
|
|
3641
3654
|
onSend: e.onSend
|
|
3642
3655
|
});
|
|
3643
|
-
return /* @__PURE__ */ Q(
|
|
3656
|
+
return /* @__PURE__ */ Q(ea, {
|
|
3644
3657
|
messages: r,
|
|
3645
3658
|
placeholder: e.placeholder,
|
|
3646
3659
|
onSendMessage: (e, t) => {
|
|
@@ -3827,7 +3840,7 @@ Ft.register("chatbot", ({ schema: e, className: t, ...n }) => {
|
|
|
3827
3840
|
autoResponseDelay: e.autoResponseDelay,
|
|
3828
3841
|
onSend: e.onSend
|
|
3829
3842
|
});
|
|
3830
|
-
return /* @__PURE__ */ Q(
|
|
3843
|
+
return /* @__PURE__ */ Q(wa, {
|
|
3831
3844
|
floatingConfig: e.floatingConfig,
|
|
3832
3845
|
messages: r,
|
|
3833
3846
|
placeholder: e.placeholder,
|
|
@@ -3999,7 +4012,7 @@ Ft.register("chatbot", ({ schema: e, className: t, ...n }) => {
|
|
|
3999
4012
|
});
|
|
4000
4013
|
//#endregion
|
|
4001
4014
|
//#region src/elements/loader.tsx
|
|
4002
|
-
var
|
|
4015
|
+
var Ta = ({ size: e = 16 }) => /* @__PURE__ */ $("svg", {
|
|
4003
4016
|
height: e,
|
|
4004
4017
|
strokeLinejoin: "round",
|
|
4005
4018
|
style: { color: "currentcolor" },
|
|
@@ -4080,18 +4093,18 @@ var Ca = ({ size: e = 16 }) => /* @__PURE__ */ $("svg", {
|
|
|
4080
4093
|
})
|
|
4081
4094
|
}) })
|
|
4082
4095
|
]
|
|
4083
|
-
}),
|
|
4096
|
+
}), Ea = ({ className: e, size: t = 16, ...n }) => /* @__PURE__ */ Q("div", {
|
|
4084
4097
|
className: q("inline-flex animate-spin items-center justify-center", e),
|
|
4085
4098
|
...n,
|
|
4086
|
-
children: /* @__PURE__ */ Q(
|
|
4087
|
-
}),
|
|
4099
|
+
children: /* @__PURE__ */ Q(Ta, { size: t })
|
|
4100
|
+
}), Da = /* @__PURE__ */ Lt({
|
|
4088
4101
|
CodeBlock: () => vi,
|
|
4089
4102
|
CodeBlockCopyButton: () => yi,
|
|
4090
4103
|
Conversation: () => qn,
|
|
4091
4104
|
ConversationContent: () => Jn,
|
|
4092
4105
|
ConversationEmptyState: () => Yn,
|
|
4093
4106
|
ConversationScrollButton: () => Xn,
|
|
4094
|
-
Loader: () =>
|
|
4107
|
+
Loader: () => Ea,
|
|
4095
4108
|
Message: () => er,
|
|
4096
4109
|
MessageAction: () => rr,
|
|
4097
4110
|
MessageActions: () => nr,
|
|
@@ -4163,14 +4176,14 @@ var Ca = ({ size: e = 16 }) => /* @__PURE__ */ $("svg", {
|
|
|
4163
4176
|
usePromptInputController: () => wr,
|
|
4164
4177
|
useProviderAttachments: () => Er,
|
|
4165
4178
|
useReasoning: () => Oi
|
|
4166
|
-
}),
|
|
4167
|
-
function
|
|
4179
|
+
}), Oa = "/api/v1/ai";
|
|
4180
|
+
function ka(e, t, n) {
|
|
4168
4181
|
let r = e.replace(/\/$/, ""), i = new URLSearchParams();
|
|
4169
4182
|
if (n) for (let [e, t] of Object.entries(n)) t == null || t === "" || i.set(e, String(t));
|
|
4170
4183
|
let a = i.toString();
|
|
4171
4184
|
return `${r}${t}${a ? `?${a}` : ""}`;
|
|
4172
4185
|
}
|
|
4173
|
-
async function
|
|
4186
|
+
async function Aa(e, t, n) {
|
|
4174
4187
|
let r = await fetch(e, {
|
|
4175
4188
|
credentials: "include",
|
|
4176
4189
|
...t,
|
|
@@ -4190,8 +4203,8 @@ async function Oa(e, t, n) {
|
|
|
4190
4203
|
}
|
|
4191
4204
|
return i;
|
|
4192
4205
|
}
|
|
4193
|
-
function
|
|
4194
|
-
let { apiBase: n =
|
|
4206
|
+
function ja(t = {}) {
|
|
4207
|
+
let { apiBase: n = Oa, status: r = "pending", conversationId: i, limit: a, headers: o, pollInterval: s = 5e3, enabled: c = !0 } = t, [l, u] = e.useState([]), [d, f] = e.useState(0), [p, m] = e.useState(!1), [h, g] = e.useState(void 0), _ = e.useRef({
|
|
4195
4208
|
apiBase: n,
|
|
4196
4209
|
status: r,
|
|
4197
4210
|
conversationId: i,
|
|
@@ -4209,7 +4222,7 @@ function ka(t = {}) {
|
|
|
4209
4222
|
let { apiBase: e, status: t, conversationId: n, limit: r, headers: i } = _.current;
|
|
4210
4223
|
m(!0), g(void 0);
|
|
4211
4224
|
try {
|
|
4212
|
-
let a = await
|
|
4225
|
+
let a = await Aa(ka(e, "/pending-actions", {
|
|
4213
4226
|
status: t && t !== "all" ? t : void 0,
|
|
4214
4227
|
conversationId: n,
|
|
4215
4228
|
limit: r
|
|
@@ -4221,9 +4234,9 @@ function ka(t = {}) {
|
|
|
4221
4234
|
m(!1);
|
|
4222
4235
|
}
|
|
4223
4236
|
}, []), y = e.useCallback(async (e) => {
|
|
4224
|
-
let { apiBase: t, headers: n } = _.current, r =
|
|
4237
|
+
let { apiBase: t, headers: n } = _.current, r = ka(t, `/pending-actions/${encodeURIComponent(e)}/approve`);
|
|
4225
4238
|
try {
|
|
4226
|
-
return await
|
|
4239
|
+
return await Aa(r, {
|
|
4227
4240
|
method: "POST",
|
|
4228
4241
|
body: "{}"
|
|
4229
4242
|
}, n);
|
|
@@ -4231,9 +4244,9 @@ function ka(t = {}) {
|
|
|
4231
4244
|
v();
|
|
4232
4245
|
}
|
|
4233
4246
|
}, [v]), b = e.useCallback(async (e, t) => {
|
|
4234
|
-
let { apiBase: n, headers: r } = _.current, i =
|
|
4247
|
+
let { apiBase: n, headers: r } = _.current, i = ka(n, `/pending-actions/${encodeURIComponent(e)}/reject`);
|
|
4235
4248
|
try {
|
|
4236
|
-
return await
|
|
4249
|
+
return await Aa(i, {
|
|
4237
4250
|
method: "POST",
|
|
4238
4251
|
body: JSON.stringify(t ? { reason: t } : {})
|
|
4239
4252
|
}, r);
|
|
@@ -4267,7 +4280,7 @@ function ka(t = {}) {
|
|
|
4267
4280
|
}
|
|
4268
4281
|
//#endregion
|
|
4269
4282
|
//#region src/AiPendingActionsInbox.tsx
|
|
4270
|
-
var
|
|
4283
|
+
var Ma = {
|
|
4271
4284
|
pending: {
|
|
4272
4285
|
variant: "secondary",
|
|
4273
4286
|
label: "Pending"
|
|
@@ -4289,8 +4302,8 @@ var Aa = {
|
|
|
4289
4302
|
label: "Rejected"
|
|
4290
4303
|
}
|
|
4291
4304
|
};
|
|
4292
|
-
function
|
|
4293
|
-
let t =
|
|
4305
|
+
function Na({ status: e }) {
|
|
4306
|
+
let t = Ma[e] ?? {
|
|
4294
4307
|
variant: "outline",
|
|
4295
4308
|
label: e
|
|
4296
4309
|
};
|
|
@@ -4299,7 +4312,7 @@ function ja({ status: e }) {
|
|
|
4299
4312
|
children: t.label
|
|
4300
4313
|
});
|
|
4301
4314
|
}
|
|
4302
|
-
function
|
|
4315
|
+
function Pa(e) {
|
|
4303
4316
|
if (!e) return "—";
|
|
4304
4317
|
let t = Date.parse(e);
|
|
4305
4318
|
if (Number.isNaN(t)) return e;
|
|
@@ -4317,7 +4330,7 @@ function Ma(e) {
|
|
|
4317
4330
|
return e;
|
|
4318
4331
|
}
|
|
4319
4332
|
}
|
|
4320
|
-
function
|
|
4333
|
+
function Fa(e) {
|
|
4321
4334
|
if (!e) return null;
|
|
4322
4335
|
try {
|
|
4323
4336
|
return JSON.parse(e);
|
|
@@ -4325,7 +4338,7 @@ function Na(e) {
|
|
|
4325
4338
|
return e;
|
|
4326
4339
|
}
|
|
4327
4340
|
}
|
|
4328
|
-
function
|
|
4341
|
+
function Ia({ value: e, max: t = 320 }) {
|
|
4329
4342
|
let n = typeof e == "string" ? e : JSON.stringify(e, null, 2);
|
|
4330
4343
|
return n == null || n === "" ? /* @__PURE__ */ Q("span", {
|
|
4331
4344
|
className: "text-muted-foreground text-xs",
|
|
@@ -4336,20 +4349,20 @@ function Pa({ value: e, max: t = 320 }) {
|
|
|
4336
4349
|
children: n
|
|
4337
4350
|
});
|
|
4338
4351
|
}
|
|
4339
|
-
function
|
|
4352
|
+
function La(e) {
|
|
4340
4353
|
switch (e) {
|
|
4341
4354
|
case "pending": return "pending";
|
|
4342
4355
|
case "all": return "all";
|
|
4343
4356
|
case "decided": return "all";
|
|
4344
4357
|
}
|
|
4345
4358
|
}
|
|
4346
|
-
function
|
|
4347
|
-
let [l, u] = e.useState("pending"), [d, m] = e.useState(null), [h, g] = e.useState(null), [_, w] = e.useState(""), [T, E] = e.useState(null), [D, O] = e.useState(null), [k, A] = e.useState(null), { items: j, isLoading: M, error: N, refresh: P, approve: F, reject: I } =
|
|
4359
|
+
function Ra({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i, variant: a = "card", title: o = "AI Approvals", description: s = "Actions an AI agent proposed that need a human review before execution.", className: c }) {
|
|
4360
|
+
let [l, u] = e.useState("pending"), [d, m] = e.useState(null), [h, g] = e.useState(null), [_, w] = e.useState(""), [T, E] = e.useState(null), [D, O] = e.useState(null), [k, A] = e.useState(null), { items: j, isLoading: M, error: N, refresh: P, approve: F, reject: I } = ja({
|
|
4348
4361
|
apiBase: t,
|
|
4349
4362
|
headers: n,
|
|
4350
4363
|
pollInterval: r,
|
|
4351
4364
|
conversationId: i,
|
|
4352
|
-
status:
|
|
4365
|
+
status: La(l)
|
|
4353
4366
|
}), L = e.useMemo(() => l === "decided" ? j.filter((e) => e.status !== "pending") : j, [j, l]), z = e.useMemo(() => d ? j.find((e) => e.id === d) ?? null : null, [d, j]), ie = e.useCallback(async (e) => {
|
|
4354
4367
|
E(e), O(null);
|
|
4355
4368
|
try {
|
|
@@ -4498,7 +4511,7 @@ function Ia({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4498
4511
|
className: "text-sm",
|
|
4499
4512
|
children: e.object_name
|
|
4500
4513
|
}),
|
|
4501
|
-
/* @__PURE__ */ Q(H, { children: /* @__PURE__ */ Q(
|
|
4514
|
+
/* @__PURE__ */ Q(H, { children: /* @__PURE__ */ Q(Na, { status: e.status }) }),
|
|
4502
4515
|
/* @__PURE__ */ Q(H, {
|
|
4503
4516
|
className: "text-xs text-muted-foreground",
|
|
4504
4517
|
children: /* @__PURE__ */ $("span", {
|
|
@@ -4506,7 +4519,7 @@ function Ia({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4506
4519
|
children: [
|
|
4507
4520
|
/* @__PURE__ */ Q(He, { className: "h-3 w-3" }),
|
|
4508
4521
|
" ",
|
|
4509
|
-
|
|
4522
|
+
Pa(e.proposed_at)
|
|
4510
4523
|
]
|
|
4511
4524
|
})
|
|
4512
4525
|
}),
|
|
@@ -4595,14 +4608,14 @@ function Ia({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4595
4608
|
children: "Status"
|
|
4596
4609
|
}), /* @__PURE__ */ Q("div", {
|
|
4597
4610
|
className: "mt-1",
|
|
4598
|
-
children: /* @__PURE__ */ Q(
|
|
4611
|
+
children: /* @__PURE__ */ Q(Na, { status: z.status })
|
|
4599
4612
|
})] }),
|
|
4600
4613
|
/* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(V, {
|
|
4601
4614
|
className: "text-xs text-muted-foreground",
|
|
4602
4615
|
children: "Proposed"
|
|
4603
4616
|
}), /* @__PURE__ */ Q("div", {
|
|
4604
4617
|
className: "mt-1 text-xs",
|
|
4605
|
-
children:
|
|
4618
|
+
children: Pa(z.proposed_at)
|
|
4606
4619
|
})] }),
|
|
4607
4620
|
/* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(V, {
|
|
4608
4621
|
className: "text-xs text-muted-foreground",
|
|
@@ -4636,21 +4649,21 @@ function Ia({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4636
4649
|
children: "Tool input"
|
|
4637
4650
|
}), /* @__PURE__ */ Q("div", {
|
|
4638
4651
|
className: "mt-1.5",
|
|
4639
|
-
children: /* @__PURE__ */ Q(
|
|
4652
|
+
children: /* @__PURE__ */ Q(Ia, { value: Fa(z.tool_input) })
|
|
4640
4653
|
})] }),
|
|
4641
4654
|
z.result ? /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(V, {
|
|
4642
4655
|
className: "text-xs",
|
|
4643
4656
|
children: "Result"
|
|
4644
4657
|
}), /* @__PURE__ */ Q("div", {
|
|
4645
4658
|
className: "mt-1.5",
|
|
4646
|
-
children: /* @__PURE__ */ Q(
|
|
4659
|
+
children: /* @__PURE__ */ Q(Ia, { value: Fa(z.result) })
|
|
4647
4660
|
})] }) : null,
|
|
4648
4661
|
z.error ? /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(V, {
|
|
4649
4662
|
className: "text-xs text-destructive",
|
|
4650
4663
|
children: "Error"
|
|
4651
4664
|
}), /* @__PURE__ */ Q("div", {
|
|
4652
4665
|
className: "mt-1.5",
|
|
4653
|
-
children: /* @__PURE__ */ Q(
|
|
4666
|
+
children: /* @__PURE__ */ Q(Ia, { value: z.error })
|
|
4654
4667
|
})] }) : null,
|
|
4655
4668
|
z.rejection_reason ? /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(V, {
|
|
4656
4669
|
className: "text-xs",
|
|
@@ -4721,14 +4734,14 @@ function Ia({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4721
4734
|
}
|
|
4722
4735
|
//#endregion
|
|
4723
4736
|
//#region src/useHitlInChat.ts
|
|
4724
|
-
function
|
|
4737
|
+
function za(e) {
|
|
4725
4738
|
return !e || e.length === 0 ? "/api/v1/ai" : e.endsWith("/") ? e.slice(0, -1) : e;
|
|
4726
4739
|
}
|
|
4727
|
-
function
|
|
4740
|
+
function Ba(e, t) {
|
|
4728
4741
|
let n = { ...e ?? {} };
|
|
4729
4742
|
return t && (n["Content-Type"] = "application/json"), n;
|
|
4730
4743
|
}
|
|
4731
|
-
async function
|
|
4744
|
+
async function Va(e) {
|
|
4732
4745
|
let t = await e.text();
|
|
4733
4746
|
if (!t) return null;
|
|
4734
4747
|
try {
|
|
@@ -4737,8 +4750,8 @@ async function za(e) {
|
|
|
4737
4750
|
return { raw: t };
|
|
4738
4751
|
}
|
|
4739
4752
|
}
|
|
4740
|
-
function
|
|
4741
|
-
let { messages: n, apiBase: r, headers: i, onDecided: a, continueConversation: o } = t, s =
|
|
4753
|
+
function Ha(t) {
|
|
4754
|
+
let { messages: n, apiBase: r, headers: i, onDecided: a, continueConversation: o } = t, s = za(r), c = e.useMemo(() => {
|
|
4742
4755
|
let e = /* @__PURE__ */ new Map();
|
|
4743
4756
|
for (let t of n) {
|
|
4744
4757
|
let n = t.toolInvocations ?? [];
|
|
@@ -4781,9 +4794,9 @@ function Ba(t) {
|
|
|
4781
4794
|
let r = `${s}/pending-actions/${encodeURIComponent(l)}/${t ? "approve" : "reject"}`, c = t ? "{}" : JSON.stringify({ reason: n ?? "" }), d = await fetch(r, {
|
|
4782
4795
|
method: "POST",
|
|
4783
4796
|
credentials: "include",
|
|
4784
|
-
headers:
|
|
4797
|
+
headers: Ba(i, !0),
|
|
4785
4798
|
body: c
|
|
4786
|
-
}), f = await
|
|
4799
|
+
}), f = await Va(d) ?? {};
|
|
4787
4800
|
if (!d.ok) {
|
|
4788
4801
|
let t = typeof f.error == "string" ? f.error : `Approval failed: HTTP ${d.status}`;
|
|
4789
4802
|
m(e, {
|
|
@@ -4797,20 +4810,26 @@ function Ba(t) {
|
|
|
4797
4810
|
return;
|
|
4798
4811
|
}
|
|
4799
4812
|
let p = f.status ?? (t ? "executed" : "rejected"), h = !1;
|
|
4800
|
-
if (p === "executed"
|
|
4813
|
+
if (p === "executed") m(e, {
|
|
4801
4814
|
state: "success",
|
|
4802
4815
|
message: "Approved — action executed."
|
|
4803
|
-
}), h = !0
|
|
4816
|
+
}), h = !0;
|
|
4817
|
+
else if (p === "rejected") m(e, {
|
|
4804
4818
|
state: "success",
|
|
4805
4819
|
message: n ? `Rejected: ${n}` : "Rejected."
|
|
4806
|
-
}), h = !0
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4820
|
+
}), h = !0;
|
|
4821
|
+
else if (p === "failed") {
|
|
4822
|
+
let t = f.error ?? "Action approved but execution failed.";
|
|
4823
|
+
m(e, {
|
|
4824
|
+
state: "error",
|
|
4825
|
+
message: t
|
|
4826
|
+
});
|
|
4827
|
+
} else m(e, {
|
|
4810
4828
|
state: "success",
|
|
4811
4829
|
message: `Status: ${p}`
|
|
4812
|
-
}), h = !0
|
|
4813
|
-
|
|
4830
|
+
}), h = !0;
|
|
4831
|
+
if (a?.(e, f), h && o) {
|
|
4832
|
+
let r = Ua({
|
|
4814
4833
|
approved: t,
|
|
4815
4834
|
status: p,
|
|
4816
4835
|
toolName: u,
|
|
@@ -4827,9 +4846,10 @@ function Ba(t) {
|
|
|
4827
4846
|
});
|
|
4828
4847
|
}
|
|
4829
4848
|
} catch (t) {
|
|
4849
|
+
let n = t instanceof Error ? t.message : String(t);
|
|
4830
4850
|
m(e, {
|
|
4831
4851
|
state: "error",
|
|
4832
|
-
message:
|
|
4852
|
+
message: n
|
|
4833
4853
|
});
|
|
4834
4854
|
} finally {
|
|
4835
4855
|
--d.current, d.current <= 0 && (d.current = 0, p(!1));
|
|
@@ -4845,24 +4865,24 @@ function Ba(t) {
|
|
|
4845
4865
|
isDeciding: f
|
|
4846
4866
|
};
|
|
4847
4867
|
}
|
|
4848
|
-
function
|
|
4868
|
+
function Ua(e) {
|
|
4849
4869
|
let { approved: t, status: n, toolName: r, pendingActionId: i, outcome: a, reason: o } = e, s = `[HITL ${i}]`;
|
|
4850
4870
|
if (t && n === "executed") {
|
|
4851
4871
|
let e = a.result;
|
|
4852
|
-
return `${s} The operator approved the \`${r}\` call. It executed successfully with result: ${e == null ? "(no payload)" : typeof e == "string" ? e :
|
|
4872
|
+
return `${s} The operator approved the \`${r}\` call. It executed successfully with result: ${e == null ? "(no payload)" : typeof e == "string" ? e : Wa(JSON.stringify(e), 800)}. Acknowledge the outcome concisely and continue the user's task.`;
|
|
4853
4873
|
}
|
|
4854
4874
|
if (!t && n === "rejected") return `${s} The operator rejected the \`${r}\` call.${o && o.trim().length > 0 ? ` Reason: ${o}.` : ""} Acknowledge the rejection and ask whether to try a different approach.`;
|
|
4855
4875
|
if (n === "failed") {
|
|
4856
4876
|
let e = a.error;
|
|
4857
|
-
return `${s} The \`${r}\` call was approved but execution failed: ${typeof e == "string" ? e :
|
|
4877
|
+
return `${s} The \`${r}\` call was approved but execution failed: ${typeof e == "string" ? e : Wa(JSON.stringify(e ?? {}), 400)}. Apologize concisely and offer alternatives.`;
|
|
4858
4878
|
}
|
|
4859
4879
|
}
|
|
4860
|
-
function
|
|
4880
|
+
function Wa(e, t) {
|
|
4861
4881
|
return e.length <= t ? e : `${e.slice(0, t - 1)}…`;
|
|
4862
4882
|
}
|
|
4863
4883
|
//#endregion
|
|
4864
4884
|
//#region src/index.tsx
|
|
4865
|
-
var
|
|
4885
|
+
var Ga = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type your message...", onSendMessage: i, disabled: a = !1, showTimestamp: o = !1, userAvatarUrl: s, userAvatarFallback: c = "You", assistantAvatarUrl: l, assistantAvatarFallback: u = "AI", maxHeight: d = "500px", ...f }, p) => {
|
|
4866
4886
|
let [m, h] = e.useState(""), g = e.useRef(null), _ = e.useRef(null);
|
|
4867
4887
|
e.useEffect(() => {
|
|
4868
4888
|
if (g.current) {
|
|
@@ -4888,7 +4908,7 @@ var Ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
4888
4908
|
children: n.length === 0 ? /* @__PURE__ */ Q("div", {
|
|
4889
4909
|
className: "flex items-center justify-center h-32 text-muted-foreground text-sm",
|
|
4890
4910
|
children: "No messages yet. Start a conversation!"
|
|
4891
|
-
}) : n.map((e) => /* @__PURE__ */ Q(
|
|
4911
|
+
}) : n.map((e) => /* @__PURE__ */ Q(Ka, {
|
|
4892
4912
|
message: e,
|
|
4893
4913
|
showTimestamp: o,
|
|
4894
4914
|
userAvatarUrl: s,
|
|
@@ -4919,8 +4939,8 @@ var Ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
4919
4939
|
})]
|
|
4920
4940
|
});
|
|
4921
4941
|
});
|
|
4922
|
-
|
|
4923
|
-
var
|
|
4942
|
+
Ga.displayName = "Chatbot";
|
|
4943
|
+
var Ka = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback: r, assistantAvatarUrl: i, assistantAvatarFallback: a }) => {
|
|
4924
4944
|
let o = e.role === "user";
|
|
4925
4945
|
if (e.role === "system") return /* @__PURE__ */ Q("div", {
|
|
4926
4946
|
className: "flex justify-center",
|
|
@@ -4952,7 +4972,7 @@ var Wa = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback:
|
|
|
4952
4972
|
})]
|
|
4953
4973
|
})]
|
|
4954
4974
|
});
|
|
4955
|
-
},
|
|
4975
|
+
}, qa = e.forwardRef(({ className: e, avatarSrc: t, avatarFallback: n = "AI", ...r }, i) => /* @__PURE__ */ $("div", {
|
|
4956
4976
|
ref: i,
|
|
4957
4977
|
className: q("flex gap-3", e),
|
|
4958
4978
|
...r,
|
|
@@ -4974,6 +4994,6 @@ var Wa = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback:
|
|
|
4974
4994
|
})
|
|
4975
4995
|
})]
|
|
4976
4996
|
}));
|
|
4977
|
-
|
|
4997
|
+
qa.displayName = "TypingIndicator";
|
|
4978
4998
|
//#endregion
|
|
4979
|
-
export { sn as AGENT_ALIAS_GROUPS,
|
|
4999
|
+
export { sn as AGENT_ALIAS_GROUPS, Da as AIElements, Ra as AiPendingActionsInbox, Ga as Chatbot, ea as ChatbotEnhanced, wa as FloatingChatbot, Ln as FloatingChatbotPanel, Tn as FloatingChatbotProvider, jn as FloatingChatbotTrigger, mn as PLATFORM_DEFAULT_AGENT, qa as TypingIndicator, cn as agentAliasGroup, ln as agentRouteName, Jt as buildProgressFromDraftReview, Kt as detectDraftResult, Wt as detectProposedPlan, zn as humanizeToolName, pn as isAskAgent, fn as isBuildAgent, dn as isBuiltinAgentName, zi as publishHealthFromResponse, un as resolveAgentParam, hn as resolveDefaultAgentName, Vn as summarizeChatError, en as uiMessageToChatMessage, tn as uiMessagesToChatMessages, Bn as unwrapToolResult, xn as useAgents, Cn as useAiModels, En as useFloatingChatbot, Ha as useHitlInChat, on as useObjectChat, ja as usePendingActions };
|