@iota-uz/sdk 0.4.9 → 0.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -34
- package/dist/applet/vite.cjs +17 -42
- package/dist/applet/vite.cjs.map +1 -1
- package/dist/applet/vite.d.cts +7 -23
- package/dist/applet/vite.d.ts +7 -23
- package/dist/applet/vite.mjs +17 -41
- package/dist/applet/vite.mjs.map +1 -1
- package/dist/bichat/index.cjs +410 -332
- package/dist/bichat/index.cjs.map +1 -1
- package/dist/bichat/index.d.cts +2 -2
- package/dist/bichat/index.d.ts +2 -2
- package/dist/bichat/index.mjs +410 -332
- package/dist/bichat/index.mjs.map +1 -1
- package/package.json +1 -1
- package/tailwind/compiled.css +1 -1
package/dist/bichat/index.mjs
CHANGED
|
@@ -49,23 +49,25 @@ var init_IotaContext = __esm({
|
|
|
49
49
|
IotaContext = createContext(null);
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
|
-
|
|
53
|
-
// ui/src/bichat/hooks/useTranslation.ts
|
|
54
52
|
function useTranslation() {
|
|
55
53
|
const { locale } = useIotaContext();
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
const { translations, language } = locale;
|
|
55
|
+
const t = useCallback(
|
|
56
|
+
(key2, params) => {
|
|
57
|
+
let text = translations[key2] || key2;
|
|
58
|
+
if (params) {
|
|
59
|
+
Object.keys(params).forEach((paramKey) => {
|
|
60
|
+
const value = params[paramKey];
|
|
61
|
+
text = text.replace(new RegExp(`{{${paramKey}}}`, "g"), String(value));
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return text;
|
|
65
|
+
},
|
|
66
|
+
[translations]
|
|
67
|
+
);
|
|
66
68
|
return {
|
|
67
69
|
t,
|
|
68
|
-
locale:
|
|
70
|
+
locale: language
|
|
69
71
|
};
|
|
70
72
|
}
|
|
71
73
|
var init_useTranslation = __esm({
|
|
@@ -85,7 +87,7 @@ function ChartCard({ chartData }) {
|
|
|
85
87
|
title,
|
|
86
88
|
": "
|
|
87
89
|
] }),
|
|
88
|
-
t("Chart.NoData")
|
|
90
|
+
t("BiChat.Chart.NoData")
|
|
89
91
|
] }) });
|
|
90
92
|
}
|
|
91
93
|
const apexSeries = chartType === "pie" || chartType === "donut" ? series[0]?.data ?? [] : series.map((s) => ({ name: s.name, data: s.data }));
|
|
@@ -161,10 +163,10 @@ function ChartCard({ chartData }) {
|
|
|
161
163
|
onClick: handleExportPNG,
|
|
162
164
|
disabled: isExporting,
|
|
163
165
|
className: "inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium text-gray-400 opacity-0 transition-all duration-150 hover:bg-gray-100 hover:text-gray-600 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/50 group-hover/chart:opacity-100 disabled:opacity-50 dark:text-gray-500 dark:hover:bg-gray-700 dark:hover:text-gray-300",
|
|
164
|
-
title: t("Chart.Download"),
|
|
165
|
-
children: isExporting ? /* @__PURE__ */ jsx("span", { className: "text-gray-500 dark:text-gray-400", children: t("Chart.Exporting") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
166
|
+
title: t("BiChat.Chart.Download"),
|
|
167
|
+
children: isExporting ? /* @__PURE__ */ jsx("span", { className: "text-gray-500 dark:text-gray-400", children: t("BiChat.Chart.Exporting") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
166
168
|
/* @__PURE__ */ jsx(DownloadSimple, { className: "h-3.5 w-3.5", weight: "bold" }),
|
|
167
|
-
/* @__PURE__ */ jsx("span", { children: t("Chart.DownloadPNG") })
|
|
169
|
+
/* @__PURE__ */ jsx("span", { children: t("BiChat.Chart.DownloadPNG") })
|
|
168
170
|
] })
|
|
169
171
|
}
|
|
170
172
|
) })
|
|
@@ -1496,8 +1498,8 @@ function useBranding() {
|
|
|
1496
1498
|
appName: customBranding.appName || "BiChat",
|
|
1497
1499
|
logoUrl: customBranding.logoUrl,
|
|
1498
1500
|
welcome: {
|
|
1499
|
-
title: customBranding.welcome?.title || t("Welcome.Title"),
|
|
1500
|
-
description: customBranding.welcome?.description || t("Welcome.Description"),
|
|
1501
|
+
title: customBranding.welcome?.title || t("BiChat.Welcome.Title"),
|
|
1502
|
+
description: customBranding.welcome?.description || t("BiChat.Welcome.Description"),
|
|
1501
1503
|
examplePrompts
|
|
1502
1504
|
},
|
|
1503
1505
|
theme: customBranding.theme
|
|
@@ -1513,7 +1515,7 @@ function ChatHeader({ session, onBack, readOnly, logoSlot, actionsSlot }) {
|
|
|
1513
1515
|
{
|
|
1514
1516
|
onClick: onBack,
|
|
1515
1517
|
className: "cursor-pointer p-2 hover:bg-gray-100 dark:hover:bg-gray-700 active:bg-gray-200 dark:active:bg-gray-600 rounded-lg transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/50",
|
|
1516
|
-
"aria-label": t("Chat.GoBack"),
|
|
1518
|
+
"aria-label": t("BiChat.Chat.GoBack"),
|
|
1517
1519
|
children: /* @__PURE__ */ jsx("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) })
|
|
1518
1520
|
}
|
|
1519
1521
|
) : null;
|
|
@@ -1523,7 +1525,7 @@ function ChatHeader({ session, onBack, readOnly, logoSlot, actionsSlot }) {
|
|
|
1523
1525
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
1524
1526
|
BackButton,
|
|
1525
1527
|
Logo,
|
|
1526
|
-
/* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold text-[var(--bichat-text)]", children: t("Chat.NewChat") })
|
|
1528
|
+
/* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold text-[var(--bichat-text)]", children: t("BiChat.Chat.NewChat") })
|
|
1527
1529
|
] }),
|
|
1528
1530
|
actionsSlot && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: actionsSlot })
|
|
1529
1531
|
] }) });
|
|
@@ -1539,14 +1541,14 @@ function ChatHeader({ session, onBack, readOnly, logoSlot, actionsSlot }) {
|
|
|
1539
1541
|
className: "w-4 h-4 text-[var(--bichat-primary)]",
|
|
1540
1542
|
fill: "currentColor",
|
|
1541
1543
|
viewBox: "0 0 20 20",
|
|
1542
|
-
"aria-label": t("Chat.Pinned"),
|
|
1544
|
+
"aria-label": t("BiChat.Chat.Pinned"),
|
|
1543
1545
|
children: /* @__PURE__ */ jsx("path", { d: "M10 2a1 1 0 011 1v1.323l3.954 1.582 1.599-.8a1 1 0 01.894 1.79l-1.233.616 1.738 5.42a1 1 0 01-.285 1.05A3.989 3.989 0 0115 15a3.989 3.989 0 01-2.667-1.019 1 1 0 01-.285-1.05l1.715-5.349L11 6.477V16h2a1 1 0 110 2H7a1 1 0 110-2h2V6.477L6.237 7.582l1.715 5.349a1 1 0 01-.285 1.05A3.989 3.989 0 015 15a3.989 3.989 0 01-2.667-1.019 1 1 0 01-.285-1.05l1.738-5.42-1.233-.617a1 1 0 01.894-1.788l1.599.799L9 4.323V3a1 1 0 011-1z" })
|
|
1544
1546
|
}
|
|
1545
1547
|
)
|
|
1546
1548
|
] }),
|
|
1547
1549
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1548
|
-
readOnly && /* @__PURE__ */ jsx("span", { className: "px-2 py-1 text-xs bg-amber-100 dark:bg-amber-900/30 text-amber-800 dark:text-amber-200 rounded", children: t("Chat.ReadOnly") }),
|
|
1549
|
-
session.status === "archived" && /* @__PURE__ */ jsx("span", { className: "px-2 py-1 text-xs bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded", children: t("Chat.Archived") }),
|
|
1550
|
+
readOnly && /* @__PURE__ */ jsx("span", { className: "px-2 py-1 text-xs bg-amber-100 dark:bg-amber-900/30 text-amber-800 dark:text-amber-200 rounded", children: t("BiChat.Chat.ReadOnly") }),
|
|
1551
|
+
session.status === "archived" && /* @__PURE__ */ jsx("span", { className: "px-2 py-1 text-xs bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded", children: t("BiChat.Chat.Archived") }),
|
|
1550
1552
|
actionsSlot
|
|
1551
1553
|
] })
|
|
1552
1554
|
] }) });
|
|
@@ -1963,6 +1965,7 @@ function AttachmentGrid({
|
|
|
1963
1965
|
var MemoizedAttachmentGrid = React.memo(AttachmentGrid);
|
|
1964
1966
|
MemoizedAttachmentGrid.displayName = "AttachmentGrid";
|
|
1965
1967
|
var AttachmentGrid_default = MemoizedAttachmentGrid;
|
|
1968
|
+
init_useTranslation();
|
|
1966
1969
|
function ImageModal({
|
|
1967
1970
|
isOpen,
|
|
1968
1971
|
onClose,
|
|
@@ -1971,6 +1974,7 @@ function ImageModal({
|
|
|
1971
1974
|
currentIndex = 0,
|
|
1972
1975
|
onNavigate
|
|
1973
1976
|
}) {
|
|
1977
|
+
const { t } = useTranslation();
|
|
1974
1978
|
const [isImageLoaded, setIsImageLoaded] = useState(false);
|
|
1975
1979
|
const [imageError, setImageError] = useState(false);
|
|
1976
1980
|
const [retryKey, setRetryKey] = useState(0);
|
|
@@ -2023,7 +2027,7 @@ function ImageModal({
|
|
|
2023
2027
|
{
|
|
2024
2028
|
onClick: onClose,
|
|
2025
2029
|
className: "cursor-pointer flex items-center justify-center w-8 h-8 rounded-md bg-gray-100 hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700 text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-400",
|
|
2026
|
-
"aria-label": "Close
|
|
2030
|
+
"aria-label": t("BiChat.Image.Close"),
|
|
2027
2031
|
type: "button",
|
|
2028
2032
|
children: /* @__PURE__ */ jsx(X, { size: 18, weight: "bold" })
|
|
2029
2033
|
}
|
|
@@ -2039,11 +2043,11 @@ function ImageModal({
|
|
|
2039
2043
|
children: [
|
|
2040
2044
|
!isImageLoaded && !imageError && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-3", children: [
|
|
2041
2045
|
/* @__PURE__ */ jsx("div", { className: "w-8 h-8 border-2 border-gray-300 dark:border-gray-700 border-t-gray-500 dark:border-t-gray-400 rounded-full animate-spin" }),
|
|
2042
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs text-gray-400 dark:text-gray-500", children: "Loading" })
|
|
2046
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-gray-400 dark:text-gray-500", children: t("BiChat.Loading") })
|
|
2043
2047
|
] }) }),
|
|
2044
2048
|
imageError && /* @__PURE__ */ jsxs("div", { role: "alert", className: "flex flex-col items-center justify-center text-center max-w-xs", children: [
|
|
2045
2049
|
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-16 h-16 rounded-2xl bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 mb-5", children: /* @__PURE__ */ jsx(ImageBroken, { size: 28, className: "text-gray-400 dark:text-gray-500", weight: "duotone" }) }),
|
|
2046
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "
|
|
2050
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: t("BiChat.Image.FailedToLoad") }),
|
|
2047
2051
|
/* @__PURE__ */ jsx("p", { className: "text-xs text-gray-400 dark:text-gray-500 mb-5 truncate max-w-full", children: attachment.filename }),
|
|
2048
2052
|
/* @__PURE__ */ jsxs(
|
|
2049
2053
|
"button",
|
|
@@ -2051,10 +2055,10 @@ function ImageModal({
|
|
|
2051
2055
|
type: "button",
|
|
2052
2056
|
onClick: handleRetry,
|
|
2053
2057
|
className: "cursor-pointer inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 border border-gray-200 dark:border-gray-700 rounded-lg transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-400",
|
|
2054
|
-
"aria-label": "Retry
|
|
2058
|
+
"aria-label": t("BiChat.Image.Retry"),
|
|
2055
2059
|
children: [
|
|
2056
2060
|
/* @__PURE__ */ jsx(ArrowClockwise, { size: 16, weight: "bold" }),
|
|
2057
|
-
"Retry"
|
|
2061
|
+
t("BiChat.Retry.Label")
|
|
2058
2062
|
]
|
|
2059
2063
|
}
|
|
2060
2064
|
)
|
|
@@ -2088,7 +2092,7 @@ function ImageModal({
|
|
|
2088
2092
|
"transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-400",
|
|
2089
2093
|
canNavigatePrev && isImageLoaded && !imageError ? "cursor-pointer bg-white/90 hover:bg-white dark:bg-gray-800/90 dark:hover:bg-gray-700 text-gray-700 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white shadow-sm" : "bg-white/40 dark:bg-gray-800/40 text-gray-300 dark:text-gray-700 cursor-not-allowed"
|
|
2090
2094
|
].join(" "),
|
|
2091
|
-
"aria-label": "Previous
|
|
2095
|
+
"aria-label": t("BiChat.Image.Previous"),
|
|
2092
2096
|
type: "button",
|
|
2093
2097
|
children: /* @__PURE__ */ jsx(CaretLeft, { size: 20, weight: "bold" })
|
|
2094
2098
|
}
|
|
@@ -2104,7 +2108,7 @@ function ImageModal({
|
|
|
2104
2108
|
"transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-400",
|
|
2105
2109
|
canNavigateNext && isImageLoaded && !imageError ? "cursor-pointer bg-white/90 hover:bg-white dark:bg-gray-800/90 dark:hover:bg-gray-700 text-gray-700 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white shadow-sm" : "bg-white/40 dark:bg-gray-800/40 text-gray-300 dark:text-gray-700 cursor-not-allowed"
|
|
2106
2110
|
].join(" "),
|
|
2107
|
-
"aria-label": "Next
|
|
2111
|
+
"aria-label": t("BiChat.Image.Next"),
|
|
2108
2112
|
type: "button",
|
|
2109
2113
|
children: /* @__PURE__ */ jsx(CaretRight, { size: 20, weight: "bold" })
|
|
2110
2114
|
}
|
|
@@ -2351,7 +2355,7 @@ function UserMessage({
|
|
|
2351
2355
|
onClick: handleCopyClick,
|
|
2352
2356
|
className: `cursor-pointer ${classes.actionButton} ${isCopied ? "text-green-600 dark:text-green-400" : ""}`,
|
|
2353
2357
|
"aria-label": "Copy message",
|
|
2354
|
-
title: isCopied ? t("Message.Copied") : t("Message.Copy"),
|
|
2358
|
+
title: isCopied ? t("BiChat.Message.Copied") : t("BiChat.Message.Copy"),
|
|
2355
2359
|
children: isCopied ? /* @__PURE__ */ jsx(Check, { size: 14, weight: "bold" }) : /* @__PURE__ */ jsx(Copy, { size: 14, weight: "regular" })
|
|
2356
2360
|
}
|
|
2357
2361
|
),
|
|
@@ -2593,8 +2597,10 @@ function DownloadCard({ artifact }) {
|
|
|
2593
2597
|
}
|
|
2594
2598
|
);
|
|
2595
2599
|
}
|
|
2600
|
+
init_useTranslation();
|
|
2596
2601
|
function InlineQuestionForm({ pendingQuestion }) {
|
|
2597
2602
|
const { handleSubmitQuestionAnswers, handleRejectPendingQuestion, loading } = useChatMessaging();
|
|
2603
|
+
const { t } = useTranslation();
|
|
2598
2604
|
const [currentStep, setCurrentStep] = useState(0);
|
|
2599
2605
|
const [answers, setAnswers] = useState({});
|
|
2600
2606
|
const [otherTexts, setOtherTexts] = useState({});
|
|
@@ -2697,11 +2703,11 @@ function InlineQuestionForm({ pendingQuestion }) {
|
|
|
2697
2703
|
const options = currentQuestion.options || [];
|
|
2698
2704
|
const isOtherSelected = currentAnswer?.customText !== void 0;
|
|
2699
2705
|
const canProceed = isCurrentAnswerValid();
|
|
2700
|
-
return /* @__PURE__ */ jsx("div", { className: "animate-slide-up rounded-2xl border border-
|
|
2706
|
+
return /* @__PURE__ */ jsx("div", { className: "animate-slide-up rounded-2xl border border-gray-200 dark:border-gray-700/50 bg-gradient-to-b from-primary-50/80 to-white dark:from-primary-950/30 dark:to-gray-900/80 shadow-sm overflow-hidden", children: /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, children: [
|
|
2701
2707
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5 px-4 pt-4 pb-3", children: [
|
|
2702
2708
|
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-7 h-7 rounded-lg bg-primary-100 dark:bg-primary-900/40", children: /* @__PURE__ */ jsx(ChatCircleDots, { className: "w-4 h-4 text-primary-600 dark:text-primary-400", weight: "fill" }) }),
|
|
2703
2709
|
/* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2704
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400", children: "
|
|
2710
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400", children: t("BiChat.InlineQuestion.InputNeeded") }),
|
|
2705
2711
|
totalSteps > 1 && /* @__PURE__ */ jsxs("span", { className: "text-[11px] tabular-nums text-gray-400 dark:text-gray-500", children: [
|
|
2706
2712
|
currentStep + 1,
|
|
2707
2713
|
"/",
|
|
@@ -2715,7 +2721,7 @@ function InlineQuestionForm({ pendingQuestion }) {
|
|
|
2715
2721
|
onClick: handleRejectPendingQuestion,
|
|
2716
2722
|
disabled: loading,
|
|
2717
2723
|
className: "cursor-pointer p-1 rounded-md text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-40",
|
|
2718
|
-
"aria-label": "Dismiss",
|
|
2724
|
+
"aria-label": t("BiChat.InlineQuestion.Dismiss"),
|
|
2719
2725
|
children: /* @__PURE__ */ jsx(X, { size: 16, weight: "bold" })
|
|
2720
2726
|
}
|
|
2721
2727
|
)
|
|
@@ -2737,7 +2743,7 @@ function InlineQuestionForm({ pendingQuestion }) {
|
|
|
2737
2743
|
}) }),
|
|
2738
2744
|
/* @__PURE__ */ jsxs("div", { className: "px-4 pb-3", children: [
|
|
2739
2745
|
/* @__PURE__ */ jsx("p", { className: "text-[15px] leading-relaxed text-gray-800 dark:text-gray-200", children: currentQuestion.text }),
|
|
2740
|
-
isMultiSelect && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-gray-400 dark:text-gray-500", children: "
|
|
2746
|
+
isMultiSelect && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-gray-400 dark:text-gray-500", children: t("BiChat.InlineQuestion.SelectAllThatApply") })
|
|
2741
2747
|
] }),
|
|
2742
2748
|
/* @__PURE__ */ jsxs("div", { className: "px-4 pb-2 space-y-1.5", children: [
|
|
2743
2749
|
options.map((option) => {
|
|
@@ -2816,18 +2822,17 @@ function InlineQuestionForm({ pendingQuestion }) {
|
|
|
2816
2822
|
/* @__PURE__ */ jsx("span", { className: [
|
|
2817
2823
|
"text-sm transition-colors duration-150",
|
|
2818
2824
|
isOtherSelected ? "text-gray-900 dark:text-gray-100 font-medium" : "text-gray-700 dark:text-gray-300"
|
|
2819
|
-
].join(" "), children: "
|
|
2825
|
+
].join(" "), children: t("BiChat.InlineQuestion.OtherOption") })
|
|
2820
2826
|
]
|
|
2821
2827
|
}
|
|
2822
2828
|
),
|
|
2823
|
-
|
|
2829
|
+
/* @__PURE__ */ jsx("div", { className: "pl-8 pr-1 pb-1", children: /* @__PURE__ */ jsx(
|
|
2824
2830
|
"input",
|
|
2825
2831
|
{
|
|
2826
2832
|
type: "text",
|
|
2827
2833
|
value: currentOtherText,
|
|
2828
2834
|
onChange: (e) => handleOtherTextChange(e.target.value),
|
|
2829
|
-
placeholder: "
|
|
2830
|
-
autoFocus: true,
|
|
2835
|
+
placeholder: t("BiChat.InlineQuestion.TypeYourAnswer"),
|
|
2831
2836
|
className: "w-full px-3 py-2 text-sm border border-gray-200 dark:border-gray-700 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder:text-gray-400 dark:placeholder:text-gray-500 focus:outline-none focus:ring-2 focus:ring-primary-500/40 focus:border-primary-400 dark:focus:border-primary-600 transition-shadow"
|
|
2832
2837
|
}
|
|
2833
2838
|
) })
|
|
@@ -2841,7 +2846,7 @@ function InlineQuestionForm({ pendingQuestion }) {
|
|
|
2841
2846
|
className: "cursor-pointer flex items-center gap-1 px-2.5 py-1.5 text-sm text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",
|
|
2842
2847
|
children: [
|
|
2843
2848
|
/* @__PURE__ */ jsx(ArrowLeft, { size: 14, weight: "bold" }),
|
|
2844
|
-
"Back"
|
|
2849
|
+
t("BiChat.InlineQuestion.Back")
|
|
2845
2850
|
]
|
|
2846
2851
|
}
|
|
2847
2852
|
) }),
|
|
@@ -2856,10 +2861,10 @@ function InlineQuestionForm({ pendingQuestion }) {
|
|
|
2856
2861
|
canProceed ? "cursor-pointer bg-primary-600 hover:bg-primary-700 active:bg-primary-800 text-white shadow-sm hover:shadow" : "bg-gray-100 dark:bg-gray-800 text-gray-400 dark:text-gray-600 cursor-not-allowed"
|
|
2857
2862
|
].join(" "),
|
|
2858
2863
|
children: isLastStep ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2859
|
-
"Submit",
|
|
2864
|
+
t("BiChat.Submit"),
|
|
2860
2865
|
/* @__PURE__ */ jsx(PaperPlaneTilt, { size: 14, weight: "fill" })
|
|
2861
2866
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2862
|
-
"Next",
|
|
2867
|
+
t("BiChat.InlineQuestion.Next"),
|
|
2863
2868
|
/* @__PURE__ */ jsx(ArrowRight, { size: 14, weight: "bold" })
|
|
2864
2869
|
] })
|
|
2865
2870
|
}
|
|
@@ -3028,13 +3033,13 @@ function ToolCard({ tool }) {
|
|
|
3028
3033
|
children: /* @__PURE__ */ jsx("div", { className: "overflow-hidden min-h-0", children: /* @__PURE__ */ jsxs("div", { className: "px-3 pb-3 pt-1 space-y-2", children: [
|
|
3029
3034
|
tool.arguments && /* @__PURE__ */ jsxs("div", { className: "rounded-lg bg-[#1a1b26] dark:bg-gray-950 overflow-hidden ring-1 ring-gray-800/10 dark:ring-white/5", children: [
|
|
3030
3035
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-3 py-1.5 bg-[#1e1f2e] dark:bg-gray-900/80 border-b border-white/5", children: [
|
|
3031
|
-
/* @__PURE__ */ jsx("span", { className: "text-[10px] uppercase tracking-wider font-medium text-gray-500", children: t("Slash.DebugArguments") }),
|
|
3036
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] uppercase tracking-wider font-medium text-gray-500", children: t("BiChat.Slash.DebugArguments") }),
|
|
3032
3037
|
/* @__PURE__ */ jsx(
|
|
3033
3038
|
CopyPill,
|
|
3034
3039
|
{
|
|
3035
3040
|
text: tool.arguments,
|
|
3036
|
-
label: t("Slash.DebugCopyTrace"),
|
|
3037
|
-
copiedLabel: t("Slash.DebugCopied")
|
|
3041
|
+
label: t("BiChat.Slash.DebugCopyTrace"),
|
|
3042
|
+
copiedLabel: t("BiChat.Slash.DebugCopied")
|
|
3038
3043
|
}
|
|
3039
3044
|
)
|
|
3040
3045
|
] }),
|
|
@@ -3042,20 +3047,20 @@ function ToolCard({ tool }) {
|
|
|
3042
3047
|
] }),
|
|
3043
3048
|
tool.result && /* @__PURE__ */ jsxs("div", { className: "rounded-lg bg-[#1a1b26] dark:bg-gray-950 overflow-hidden ring-1 ring-gray-800/10 dark:ring-white/5", children: [
|
|
3044
3049
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-3 py-1.5 bg-[#1e1f2e] dark:bg-gray-900/80 border-b border-white/5", children: [
|
|
3045
|
-
/* @__PURE__ */ jsx("span", { className: "text-[10px] uppercase tracking-wider font-medium text-gray-500", children: t("Slash.DebugResult") }),
|
|
3050
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] uppercase tracking-wider font-medium text-gray-500", children: t("BiChat.Slash.DebugResult") }),
|
|
3046
3051
|
/* @__PURE__ */ jsx(
|
|
3047
3052
|
CopyPill,
|
|
3048
3053
|
{
|
|
3049
3054
|
text: tool.result,
|
|
3050
|
-
label: t("Slash.DebugCopyTrace"),
|
|
3051
|
-
copiedLabel: t("Slash.DebugCopied")
|
|
3055
|
+
label: t("BiChat.Slash.DebugCopyTrace"),
|
|
3056
|
+
copiedLabel: t("BiChat.Slash.DebugCopied")
|
|
3052
3057
|
}
|
|
3053
3058
|
)
|
|
3054
3059
|
] }),
|
|
3055
3060
|
/* @__PURE__ */ jsx("pre", { className: "p-3 text-[11px] font-mono text-gray-300 overflow-x-auto max-h-60 overflow-y-auto whitespace-pre-wrap break-all leading-relaxed", children: tool.result })
|
|
3056
3061
|
] }),
|
|
3057
3062
|
tool.error && /* @__PURE__ */ jsxs("div", { className: "rounded-lg bg-red-950/80 dark:bg-red-950/40 overflow-hidden ring-1 ring-red-800/20", children: [
|
|
3058
|
-
/* @__PURE__ */ jsx("div", { className: "px-3 py-1.5 border-b border-red-800/20", children: /* @__PURE__ */ jsx("span", { className: "text-[10px] uppercase tracking-wider font-medium text-red-400", children: t("Slash.DebugError") }) }),
|
|
3063
|
+
/* @__PURE__ */ jsx("div", { className: "px-3 py-1.5 border-b border-red-800/20", children: /* @__PURE__ */ jsx("span", { className: "text-[10px] uppercase tracking-wider font-medium text-red-400", children: t("BiChat.Slash.DebugError") }) }),
|
|
3059
3064
|
/* @__PURE__ */ jsx("pre", { className: "p-3 text-[11px] font-mono text-red-300 overflow-x-auto whitespace-pre-wrap break-all leading-relaxed", children: tool.error })
|
|
3060
3065
|
] })
|
|
3061
3066
|
] }) })
|
|
@@ -3075,7 +3080,7 @@ function DebugPanel({ trace }) {
|
|
|
3075
3080
|
metrics.push({
|
|
3076
3081
|
icon: /* @__PURE__ */ jsx(Timer, { size: 14, weight: "duotone", className: "text-amber-600 dark:text-amber-400" }),
|
|
3077
3082
|
value: formatGenerationDuration(trace.generationMs),
|
|
3078
|
-
label: t("Slash.DebugGeneration"),
|
|
3083
|
+
label: t("BiChat.Slash.DebugGeneration"),
|
|
3079
3084
|
accentBorder: "border-l-amber-400 dark:border-l-amber-500",
|
|
3080
3085
|
accentBg: "bg-amber-50 dark:bg-amber-950/30"
|
|
3081
3086
|
});
|
|
@@ -3084,7 +3089,7 @@ function DebugPanel({ trace }) {
|
|
|
3084
3089
|
metrics.push({
|
|
3085
3090
|
icon: /* @__PURE__ */ jsx(Lightning, { size: 14, weight: "fill", className: "text-orange-500 dark:text-orange-400" }),
|
|
3086
3091
|
value: `${tokensPerSecond.toFixed(1)}/s`,
|
|
3087
|
-
label: t("Slash.DebugTokensPerSecond"),
|
|
3092
|
+
label: t("BiChat.Slash.DebugTokensPerSecond"),
|
|
3088
3093
|
accentBorder: "border-l-orange-400 dark:border-l-orange-500",
|
|
3089
3094
|
accentBg: "bg-orange-50 dark:bg-orange-950/30"
|
|
3090
3095
|
});
|
|
@@ -3094,21 +3099,21 @@ function DebugPanel({ trace }) {
|
|
|
3094
3099
|
{
|
|
3095
3100
|
icon: /* @__PURE__ */ jsx(Stack, { size: 14, weight: "duotone", className: "text-violet-600 dark:text-violet-400" }),
|
|
3096
3101
|
value: trace.usage.totalTokens.toLocaleString(),
|
|
3097
|
-
label: t("Slash.DebugTotalTokens"),
|
|
3102
|
+
label: t("BiChat.Slash.DebugTotalTokens"),
|
|
3098
3103
|
accentBorder: "border-l-violet-400 dark:border-l-violet-500",
|
|
3099
3104
|
accentBg: "bg-violet-50 dark:bg-violet-950/30"
|
|
3100
3105
|
},
|
|
3101
3106
|
{
|
|
3102
3107
|
icon: /* @__PURE__ */ jsx(ArrowUp, { size: 14, weight: "bold", className: "text-blue-600 dark:text-blue-400" }),
|
|
3103
3108
|
value: trace.usage.promptTokens.toLocaleString(),
|
|
3104
|
-
label: t("Slash.DebugPromptTokens"),
|
|
3109
|
+
label: t("BiChat.Slash.DebugPromptTokens"),
|
|
3105
3110
|
accentBorder: "border-l-blue-400 dark:border-l-blue-500",
|
|
3106
3111
|
accentBg: "bg-blue-50 dark:bg-blue-950/30"
|
|
3107
3112
|
},
|
|
3108
3113
|
{
|
|
3109
3114
|
icon: /* @__PURE__ */ jsx(ArrowDown, { size: 14, weight: "bold", className: "text-indigo-600 dark:text-indigo-400" }),
|
|
3110
3115
|
value: trace.usage.completionTokens.toLocaleString(),
|
|
3111
|
-
label: t("Slash.DebugCompletionTokens"),
|
|
3116
|
+
label: t("BiChat.Slash.DebugCompletionTokens"),
|
|
3112
3117
|
accentBorder: "border-l-indigo-400 dark:border-l-indigo-500",
|
|
3113
3118
|
accentBg: "bg-indigo-50 dark:bg-indigo-950/30"
|
|
3114
3119
|
}
|
|
@@ -3117,7 +3122,7 @@ function DebugPanel({ trace }) {
|
|
|
3117
3122
|
metrics.push({
|
|
3118
3123
|
icon: /* @__PURE__ */ jsx(Database, { size: 14, weight: "duotone", className: "text-pink-600 dark:text-pink-400" }),
|
|
3119
3124
|
value: trace.usage.cachedTokens.toLocaleString(),
|
|
3120
|
-
label: t("Slash.DebugCachedTokens"),
|
|
3125
|
+
label: t("BiChat.Slash.DebugCachedTokens"),
|
|
3121
3126
|
accentBorder: "border-l-pink-400 dark:border-l-pink-500",
|
|
3122
3127
|
accentBg: "bg-pink-50 dark:bg-pink-950/30"
|
|
3123
3128
|
});
|
|
@@ -3128,14 +3133,14 @@ function DebugPanel({ trace }) {
|
|
|
3128
3133
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-4", children: [
|
|
3129
3134
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5", children: [
|
|
3130
3135
|
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-6 h-6 rounded-lg bg-gray-100 dark:bg-gray-800", children: /* @__PURE__ */ jsx(Bug, { size: 14, weight: "duotone", className: "text-gray-500 dark:text-gray-400" }) }),
|
|
3131
|
-
/* @__PURE__ */ jsx("h3", { className: "text-[11px] uppercase tracking-widest font-semibold text-gray-400 dark:text-gray-500", children: t("Slash.DebugPanelTitle") })
|
|
3136
|
+
/* @__PURE__ */ jsx("h3", { className: "text-[11px] uppercase tracking-widest font-semibold text-gray-400 dark:text-gray-500", children: t("BiChat.Slash.DebugPanelTitle") })
|
|
3132
3137
|
] }),
|
|
3133
3138
|
hasData && trace && /* @__PURE__ */ jsx(
|
|
3134
3139
|
CopyPill,
|
|
3135
3140
|
{
|
|
3136
3141
|
text: JSON.stringify(trace, null, 2),
|
|
3137
|
-
label: t("Slash.DebugCopyTrace"),
|
|
3138
|
-
copiedLabel: t("Slash.DebugCopied")
|
|
3142
|
+
label: t("BiChat.Slash.DebugCopyTrace"),
|
|
3143
|
+
copiedLabel: t("BiChat.Slash.DebugCopied")
|
|
3139
3144
|
}
|
|
3140
3145
|
)
|
|
3141
3146
|
] }),
|
|
@@ -3144,12 +3149,12 @@ function DebugPanel({ trace }) {
|
|
|
3144
3149
|
trace.tools.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
|
|
3145
3150
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-2.5", children: [
|
|
3146
3151
|
/* @__PURE__ */ jsx(Wrench, { size: 13, weight: "duotone", className: "text-gray-400 dark:text-gray-500" }),
|
|
3147
|
-
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-gray-500 dark:text-gray-400", children: t("Slash.DebugToolCalls") }),
|
|
3152
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-gray-500 dark:text-gray-400", children: t("BiChat.Slash.DebugToolCalls") }),
|
|
3148
3153
|
/* @__PURE__ */ jsx("span", { className: "px-1.5 py-0.5 rounded-full bg-gray-100 dark:bg-gray-800 text-[10px] font-mono font-medium text-gray-500 dark:text-gray-400 tabular-nums", children: trace.tools.length })
|
|
3149
3154
|
] }),
|
|
3150
3155
|
/* @__PURE__ */ jsx("div", { className: "space-y-1.5", children: trace.tools.map((tool, idx) => /* @__PURE__ */ jsx(ToolCard, { tool }, `${tool.callId || tool.name}-${idx}`)) })
|
|
3151
3156
|
] })
|
|
3152
|
-
] }) : /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-400 dark:text-gray-500 italic", children: t("Slash.DebugUnavailable") })
|
|
3157
|
+
] }) : /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-400 dark:text-gray-500 italic", children: t("BiChat.Slash.DebugUnavailable") })
|
|
3153
3158
|
] });
|
|
3154
3159
|
}
|
|
3155
3160
|
|
|
@@ -3355,7 +3360,7 @@ function AssistantMessage({
|
|
|
3355
3360
|
)
|
|
3356
3361
|
}
|
|
3357
3362
|
),
|
|
3358
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium", children: t("Assistant.Explanation") })
|
|
3363
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: t("BiChat.Assistant.Explanation") })
|
|
3359
3364
|
]
|
|
3360
3365
|
}
|
|
3361
3366
|
),
|
|
@@ -3381,7 +3386,7 @@ function AssistantMessage({
|
|
|
3381
3386
|
onClick: handleCopyClick,
|
|
3382
3387
|
className: `cursor-pointer ${classes.actionButton} ${isCopied ? "text-green-600 dark:text-green-400" : ""}`,
|
|
3383
3388
|
"aria-label": "Copy message",
|
|
3384
|
-
title: isCopied ? t("Message.Copied") : t("Message.Copy"),
|
|
3389
|
+
title: isCopied ? t("BiChat.Message.Copied") : t("BiChat.Message.Copy"),
|
|
3385
3390
|
children: isCopied ? /* @__PURE__ */ jsx(Check, { size: 14, weight: "bold" }) : /* @__PURE__ */ jsx(Copy, { size: 14, weight: "regular" })
|
|
3386
3391
|
}
|
|
3387
3392
|
),
|
|
@@ -3475,7 +3480,7 @@ function SystemMessage({
|
|
|
3475
3480
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-4 pt-3 pb-2", children: [
|
|
3476
3481
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-gray-400 dark:text-gray-500", children: [
|
|
3477
3482
|
/* @__PURE__ */ jsx(ClockCounterClockwise, { size: 13, weight: "bold" }),
|
|
3478
|
-
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-semibold uppercase tracking-wider", children: t("System.ConversationSummary") })
|
|
3483
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-semibold uppercase tracking-wider", children: t("BiChat.System.ConversationSummary") })
|
|
3479
3484
|
] }),
|
|
3480
3485
|
/* @__PURE__ */ jsx("div", { className: "flex-1" }),
|
|
3481
3486
|
!hideActions && !hideTimestamp && /* @__PURE__ */ jsx("span", { className: "text-[11px] text-gray-400 dark:text-gray-500 tabular-nums", children: timestamp }),
|
|
@@ -3489,7 +3494,7 @@ function SystemMessage({
|
|
|
3489
3494
|
${isCopied ? "text-green-600 dark:text-green-400" : "text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-200/50 dark:hover:bg-gray-700/40"}
|
|
3490
3495
|
`,
|
|
3491
3496
|
"aria-label": "Copy message",
|
|
3492
|
-
title: isCopied ? t("Message.Copied") : t("Message.Copy"),
|
|
3497
|
+
title: isCopied ? t("BiChat.Message.Copied") : t("BiChat.Message.Copy"),
|
|
3493
3498
|
children: isCopied ? /* @__PURE__ */ jsx(Check, { size: 13, weight: "bold" }) : /* @__PURE__ */ jsx(Copy, { size: 13, weight: "regular" })
|
|
3494
3499
|
}
|
|
3495
3500
|
)
|
|
@@ -3507,7 +3512,7 @@ function SystemMessage({
|
|
|
3507
3512
|
{
|
|
3508
3513
|
fallback: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-gray-400 dark:text-gray-500 py-2", children: [
|
|
3509
3514
|
/* @__PURE__ */ jsx("div", { className: "w-3.5 h-3.5 border-[1.5px] border-gray-300 dark:border-gray-600 border-t-transparent rounded-full animate-spin" }),
|
|
3510
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs", children: t("System.LoadingSummary") })
|
|
3515
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs", children: t("BiChat.System.LoadingSummary") })
|
|
3511
3516
|
] }),
|
|
3512
3517
|
children: /* @__PURE__ */ jsx(MarkdownRenderer3, { content, sendDisabled: true })
|
|
3513
3518
|
}
|
|
@@ -3524,7 +3529,7 @@ function SystemMessage({
|
|
|
3524
3529
|
"aria-expanded": isExpanded,
|
|
3525
3530
|
className: "cursor-pointer group/toggle inline-flex items-center gap-1 px-3 py-1 rounded-full text-[11px] font-medium text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-gray-200/60 dark:hover:bg-gray-700/50 transition-colors duration-150",
|
|
3526
3531
|
children: [
|
|
3527
|
-
/* @__PURE__ */ jsx("span", { children: isExpanded ? t("System.ShowLess") : t("System.ShowMore") }),
|
|
3532
|
+
/* @__PURE__ */ jsx("span", { children: isExpanded ? t("BiChat.System.ShowLess") : t("BiChat.System.ShowMore") }),
|
|
3528
3533
|
/* @__PURE__ */ jsx(
|
|
3529
3534
|
CaretDown,
|
|
3530
3535
|
{
|
|
@@ -3888,13 +3893,16 @@ var errorMessageVariants = {
|
|
|
3888
3893
|
}
|
|
3889
3894
|
}
|
|
3890
3895
|
};
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
"
|
|
3896
|
-
"
|
|
3897
|
-
"
|
|
3896
|
+
|
|
3897
|
+
// ui/src/bichat/components/TypingIndicator.tsx
|
|
3898
|
+
init_useTranslation();
|
|
3899
|
+
var THINKING_KEYS = [
|
|
3900
|
+
"BiChat.Thinking.Thinking",
|
|
3901
|
+
"BiChat.Thinking.Processing",
|
|
3902
|
+
"BiChat.Thinking.Analyzing",
|
|
3903
|
+
"BiChat.Thinking.Synthesizing",
|
|
3904
|
+
"BiChat.Thinking.Computing",
|
|
3905
|
+
"BiChat.Thinking.WorkingOnIt"
|
|
3898
3906
|
];
|
|
3899
3907
|
var prefersReducedMotion2 = () => {
|
|
3900
3908
|
if (typeof window === "undefined") return false;
|
|
@@ -3908,10 +3916,15 @@ var getRandomVerb = (verbs, current) => {
|
|
|
3908
3916
|
return available[Math.floor(Math.random() * available.length)];
|
|
3909
3917
|
};
|
|
3910
3918
|
function TypingIndicator({
|
|
3911
|
-
verbs
|
|
3919
|
+
verbs: verbsProp,
|
|
3912
3920
|
rotationInterval = 3e3,
|
|
3913
3921
|
className = ""
|
|
3914
3922
|
}) {
|
|
3923
|
+
const { t } = useTranslation();
|
|
3924
|
+
const verbs = useMemo(() => {
|
|
3925
|
+
if (verbsProp) return verbsProp;
|
|
3926
|
+
return THINKING_KEYS.map((key2) => t(key2));
|
|
3927
|
+
}, [verbsProp, t]);
|
|
3915
3928
|
const [verb, setVerb] = useState(() => verbs[Math.floor(Math.random() * verbs.length)]);
|
|
3916
3929
|
useEffect(() => {
|
|
3917
3930
|
if (prefersReducedMotion2()) return;
|
|
@@ -4096,8 +4109,8 @@ function MessageList({ renderUserTurn, renderAssistantTurn, thinkingVerbs, readO
|
|
|
4096
4109
|
isCompacting && /* @__PURE__ */ jsx(
|
|
4097
4110
|
CompactionDoodle_default,
|
|
4098
4111
|
{
|
|
4099
|
-
title: t("Slash.CompactingTitle"),
|
|
4100
|
-
subtitle: t("Slash.CompactingSubtitle")
|
|
4112
|
+
title: t("BiChat.Slash.CompactingTitle"),
|
|
4113
|
+
subtitle: t("BiChat.Slash.CompactingSubtitle")
|
|
4101
4114
|
}
|
|
4102
4115
|
),
|
|
4103
4116
|
fetching && turns.length === 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-6", "aria-hidden": "true", children: [
|
|
@@ -4198,7 +4211,7 @@ var MessageInput = forwardRef(
|
|
|
4198
4211
|
const [dropSuccess, setDropSuccess] = useState(false);
|
|
4199
4212
|
const [pendingFileCount, setPendingFileCount] = useState(0);
|
|
4200
4213
|
const [viewingImageIndex, setViewingImageIndex] = useState(null);
|
|
4201
|
-
const placeholder = placeholderOverride || t("Input.Placeholder");
|
|
4214
|
+
const placeholder = placeholderOverride || t("BiChat.Input.Placeholder");
|
|
4202
4215
|
const textareaRef = useRef(null);
|
|
4203
4216
|
const fileInputRef = useRef(null);
|
|
4204
4217
|
const containerRef = useRef(null);
|
|
@@ -4209,9 +4222,9 @@ var MessageInput = forwardRef(
|
|
|
4209
4222
|
const commandQuery = message.trimStart().slice(1).split(/\s+/)[0]?.toLowerCase() || "";
|
|
4210
4223
|
const slashCommands = useMemo(
|
|
4211
4224
|
() => [
|
|
4212
|
-
{ name: "/clear", description: t("Slash.ClearDescription") },
|
|
4213
|
-
{ name: "/debug", description: t("Slash.DebugDescription") },
|
|
4214
|
-
{ name: "/compact", description: t("Slash.CompactDescription") }
|
|
4225
|
+
{ name: "/clear", description: t("BiChat.Slash.ClearDescription") },
|
|
4226
|
+
{ name: "/debug", description: t("BiChat.Slash.DebugDescription") },
|
|
4227
|
+
{ name: "/compact", description: t("BiChat.Slash.CompactDescription") }
|
|
4215
4228
|
],
|
|
4216
4229
|
[t]
|
|
4217
4230
|
);
|
|
@@ -4501,12 +4514,12 @@ var MessageInput = forwardRef(
|
|
|
4501
4514
|
onClearCommandError?.();
|
|
4502
4515
|
},
|
|
4503
4516
|
className: "cursor-pointer ml-2 p-1 hover:bg-red-100 dark:hover:bg-red-800 rounded transition-colors",
|
|
4504
|
-
"aria-label": t("Input.DismissError"),
|
|
4517
|
+
"aria-label": t("BiChat.Input.DismissError"),
|
|
4505
4518
|
children: /* @__PURE__ */ jsx(X, { size: 14 })
|
|
4506
4519
|
}
|
|
4507
4520
|
)
|
|
4508
4521
|
] }),
|
|
4509
|
-
messageQueue.length > 0 && /* @__PURE__ */ jsx("div", { className: "mb-3 text-xs text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ jsx("span", { className: "px-2.5 py-1 bg-primary-50 dark:bg-primary-900/30 text-primary-600 dark:text-primary-400 rounded font-medium", children: t("Input.MessagesQueued", { count: messageQueue.length }) }) }),
|
|
4522
|
+
messageQueue.length > 0 && /* @__PURE__ */ jsx("div", { className: "mb-3 text-xs text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ jsx("span", { className: "px-2.5 py-1 bg-primary-50 dark:bg-primary-900/30 text-primary-600 dark:text-primary-400 rounded font-medium", children: t("BiChat.Input.MessagesQueued", { count: messageQueue.length }) }) }),
|
|
4510
4523
|
debugMode && /* @__PURE__ */ jsxs("div", { className: "mb-3 space-y-2 text-xs", children: [
|
|
4511
4524
|
/* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 px-2.5 py-1 bg-amber-100 dark:bg-amber-900/40 text-amber-700 dark:text-amber-300 rounded-full font-medium text-[11px]", children: [
|
|
4512
4525
|
/* @__PURE__ */ jsxs("span", { className: "relative flex h-1.5 w-1.5", "aria-hidden": "true", children: [
|
|
@@ -4514,49 +4527,49 @@ var MessageInput = forwardRef(
|
|
|
4514
4527
|
/* @__PURE__ */ jsx("span", { className: "relative inline-flex rounded-full h-1.5 w-1.5 bg-amber-500" })
|
|
4515
4528
|
] }),
|
|
4516
4529
|
/* @__PURE__ */ jsx(Bug, { size: 12 }),
|
|
4517
|
-
t("Slash.DebugBadge")
|
|
4530
|
+
t("BiChat.Slash.DebugBadge")
|
|
4518
4531
|
] }),
|
|
4519
4532
|
/* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-gray-200/60 dark:border-gray-700/40 bg-gray-50/50 dark:bg-gray-800/30 p-3 space-y-3", children: [
|
|
4520
4533
|
hasUsage ? /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 gap-1.5", children: [
|
|
4521
4534
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1 py-2 rounded-lg bg-white dark:bg-gray-800/60 border border-gray-100 dark:border-gray-700/30", children: [
|
|
4522
4535
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 text-[10px] text-gray-400 dark:text-gray-500", children: [
|
|
4523
4536
|
/* @__PURE__ */ jsx(ArrowUp, { size: 10, weight: "bold", className: "text-blue-500 dark:text-blue-400" }),
|
|
4524
|
-
t("Slash.DebugPromptTokens")
|
|
4537
|
+
t("BiChat.Slash.DebugPromptTokens")
|
|
4525
4538
|
] }),
|
|
4526
4539
|
/* @__PURE__ */ jsx("span", { className: "font-mono font-semibold text-xs text-gray-900 dark:text-gray-100 tabular-nums", children: formatTokens(sessionPromptTokens) })
|
|
4527
4540
|
] }),
|
|
4528
4541
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1 py-2 rounded-lg bg-white dark:bg-gray-800/60 border border-gray-100 dark:border-gray-700/30", children: [
|
|
4529
4542
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 text-[10px] text-gray-400 dark:text-gray-500", children: [
|
|
4530
4543
|
/* @__PURE__ */ jsx(ArrowDown, { size: 10, weight: "bold", className: "text-indigo-500 dark:text-indigo-400" }),
|
|
4531
|
-
t("Slash.DebugCompletionTokens")
|
|
4544
|
+
t("BiChat.Slash.DebugCompletionTokens")
|
|
4532
4545
|
] }),
|
|
4533
4546
|
/* @__PURE__ */ jsx("span", { className: "font-mono font-semibold text-xs text-gray-900 dark:text-gray-100 tabular-nums", children: formatTokens(sessionCompletionTokens) })
|
|
4534
4547
|
] }),
|
|
4535
4548
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1 py-2 rounded-lg bg-white dark:bg-gray-800/60 border border-gray-100 dark:border-gray-700/30", children: [
|
|
4536
4549
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 text-[10px] text-gray-400 dark:text-gray-500", children: [
|
|
4537
4550
|
/* @__PURE__ */ jsx(Stack, { size: 10, weight: "bold", className: "text-violet-500 dark:text-violet-400" }),
|
|
4538
|
-
t("Slash.DebugTotalTokens")
|
|
4551
|
+
t("BiChat.Slash.DebugTotalTokens")
|
|
4539
4552
|
] }),
|
|
4540
4553
|
/* @__PURE__ */ jsx("span", { className: "font-mono font-semibold text-xs text-gray-900 dark:text-gray-100 tabular-nums", children: formatTokens(sessionTotalTokens) })
|
|
4541
4554
|
] })
|
|
4542
|
-
] }) : /* @__PURE__ */ jsx("p", { className: "text-[11px] text-gray-400 dark:text-gray-500 text-center py-1", children: t("Slash.DebugSessionUsageUnavailable") }),
|
|
4555
|
+
] }) : /* @__PURE__ */ jsx("p", { className: "text-[11px] text-gray-400 dark:text-gray-500 text-center py-1", children: t("BiChat.Slash.DebugSessionUsageUnavailable") }),
|
|
4543
4556
|
debugLimits && /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 gap-1.5", children: [
|
|
4544
4557
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 py-2 px-2 rounded-lg bg-white dark:bg-gray-800/60 border border-gray-100 dark:border-gray-700/30", children: [
|
|
4545
|
-
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-gray-400 dark:text-gray-500", children: t("Slash.DebugPolicyMaxContextWindow") }),
|
|
4558
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-gray-400 dark:text-gray-500", children: t("BiChat.Slash.DebugPolicyMaxContextWindow") }),
|
|
4546
4559
|
/* @__PURE__ */ jsx("span", { className: "font-mono font-semibold text-xs text-gray-900 dark:text-gray-100 tabular-nums", children: formatTokens(policyMaxTokens) })
|
|
4547
4560
|
] }),
|
|
4548
4561
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 py-2 px-2 rounded-lg bg-white dark:bg-gray-800/60 border border-gray-100 dark:border-gray-700/30", children: [
|
|
4549
|
-
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-gray-400 dark:text-gray-500", children: t("Slash.DebugModelMaxContextWindow") }),
|
|
4562
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-gray-400 dark:text-gray-500", children: t("BiChat.Slash.DebugModelMaxContextWindow") }),
|
|
4550
4563
|
/* @__PURE__ */ jsx("span", { className: "font-mono font-semibold text-xs text-gray-900 dark:text-gray-100 tabular-nums", children: formatTokens(modelMaxTokens) })
|
|
4551
4564
|
] }),
|
|
4552
4565
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 py-2 px-2 rounded-lg bg-white dark:bg-gray-800/60 border border-gray-100 dark:border-gray-700/30", children: [
|
|
4553
|
-
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-gray-400 dark:text-gray-500", children: t("Slash.DebugEffectiveContextWindow") }),
|
|
4566
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-gray-400 dark:text-gray-500", children: t("BiChat.Slash.DebugEffectiveContextWindow") }),
|
|
4554
4567
|
/* @__PURE__ */ jsx("span", { className: "font-mono font-semibold text-xs text-gray-900 dark:text-gray-100 tabular-nums", children: formatTokens(effectiveMaxTokens) })
|
|
4555
4568
|
] })
|
|
4556
4569
|
] }),
|
|
4557
4570
|
effectiveMaxTokens > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
4558
4571
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
4559
|
-
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-gray-400 dark:text-gray-500", children: t("Slash.DebugContextUsage") }),
|
|
4572
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-gray-400 dark:text-gray-500", children: t("BiChat.Slash.DebugContextUsage") }),
|
|
4560
4573
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4561
4574
|
/* @__PURE__ */ jsxs("span", { className: "font-mono text-[10px] text-gray-400 dark:text-gray-500 tabular-nums", children: [
|
|
4562
4575
|
formatTokens(latestPromptTokens),
|
|
@@ -4606,9 +4619,9 @@ var MessageInput = forwardRef(
|
|
|
4606
4619
|
children: [
|
|
4607
4620
|
isDragging && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-10 bg-primary-50/95 dark:bg-primary-900/90 border-2 border-dashed border-primary-400 rounded-2xl flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
4608
4621
|
/* @__PURE__ */ jsx("div", { className: "w-10 h-10 rounded-full bg-primary-100 dark:bg-primary-800 flex items-center justify-center", children: /* @__PURE__ */ jsx(Paperclip, { size: 20, className: "text-primary-600 dark:text-primary-400" }) }),
|
|
4609
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm text-primary-700 dark:text-primary-300 font-medium", children: t("Input.DropFiles") })
|
|
4622
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-primary-700 dark:text-primary-300 font-medium", children: t("BiChat.Input.DropFiles") })
|
|
4610
4623
|
] }) }),
|
|
4611
|
-
dropSuccess && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-10 bg-green-50/95 dark:bg-green-900/90 border-2 border-green-400 rounded-2xl flex items-center justify-center animate-pulse pointer-events-none", children: /* @__PURE__ */ jsx("span", { className: "text-sm text-green-700 dark:text-green-300 font-medium", children: t("Input.FilesAdded") }) }),
|
|
4624
|
+
dropSuccess && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-10 bg-green-50/95 dark:bg-green-900/90 border-2 border-green-400 rounded-2xl flex items-center justify-center animate-pulse pointer-events-none", children: /* @__PURE__ */ jsx("span", { className: "text-sm text-green-700 dark:text-green-300 font-medium", children: t("BiChat.Input.FilesAdded") }) }),
|
|
4612
4625
|
/* @__PURE__ */ jsxs(
|
|
4613
4626
|
"div",
|
|
4614
4627
|
{
|
|
@@ -4621,8 +4634,8 @@ var MessageInput = forwardRef(
|
|
|
4621
4634
|
onClick: () => fileInputRef.current?.click(),
|
|
4622
4635
|
disabled: loading || disabled || attachments.length >= maxFiles,
|
|
4623
4636
|
className: "cursor-pointer flex-shrink-0 self-center p-2 text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed",
|
|
4624
|
-
"aria-label": t("Input.AttachFiles"),
|
|
4625
|
-
title: t("Input.AttachFiles"),
|
|
4637
|
+
"aria-label": t("BiChat.Input.AttachFiles"),
|
|
4638
|
+
title: t("BiChat.Input.AttachFiles"),
|
|
4626
4639
|
children: /* @__PURE__ */ jsx(Paperclip, { size: 20 })
|
|
4627
4640
|
}
|
|
4628
4641
|
),
|
|
@@ -4635,7 +4648,7 @@ var MessageInput = forwardRef(
|
|
|
4635
4648
|
multiple: true,
|
|
4636
4649
|
onChange: handleFileInputChange,
|
|
4637
4650
|
className: "hidden",
|
|
4638
|
-
"aria-label": t("Input.FileInput")
|
|
4651
|
+
"aria-label": t("BiChat.Input.FileInput")
|
|
4639
4652
|
}
|
|
4640
4653
|
),
|
|
4641
4654
|
/* @__PURE__ */ jsx("div", { className: "flex-1 self-stretch flex items-center", children: /* @__PURE__ */ jsx(
|
|
@@ -4665,7 +4678,7 @@ var MessageInput = forwardRef(
|
|
|
4665
4678
|
rows: 1,
|
|
4666
4679
|
disabled: loading || disabled,
|
|
4667
4680
|
"aria-busy": loading,
|
|
4668
|
-
"aria-label": t("Input.MessageInput")
|
|
4681
|
+
"aria-label": t("BiChat.Input.MessageInput")
|
|
4669
4682
|
}
|
|
4670
4683
|
) }),
|
|
4671
4684
|
/* @__PURE__ */ jsx(
|
|
@@ -4674,15 +4687,15 @@ var MessageInput = forwardRef(
|
|
|
4674
4687
|
type: "submit",
|
|
4675
4688
|
disabled: !canSubmit,
|
|
4676
4689
|
className: "cursor-pointer flex-shrink-0 self-center p-2 rounded-lg bg-primary-600 hover:bg-primary-700 active:bg-primary-800 active:scale-95 text-white shadow-sm transition-all disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-primary-600",
|
|
4677
|
-
"aria-label": loading ? t("Input.Processing") : t("Input.SendMessage"),
|
|
4690
|
+
"aria-label": loading ? t("BiChat.Input.Processing") : t("BiChat.Input.SendMessage"),
|
|
4678
4691
|
children: loading ? /* @__PURE__ */ jsx("div", { className: "w-[18px] h-[18px] border-2 border-white/60 border-t-transparent rounded-full animate-spin" }) : /* @__PURE__ */ jsx(PaperPlaneRight, { size: 18, weight: "fill" })
|
|
4679
4692
|
}
|
|
4680
4693
|
)
|
|
4681
4694
|
]
|
|
4682
4695
|
}
|
|
4683
4696
|
),
|
|
4684
|
-
isFocused && !message && !loading && /* @__PURE__ */ jsx("span", { className: "hidden sm:block absolute -bottom-5 left-14 text-[10px] text-gray-400 dark:text-gray-500 select-none animate-fade-in", children: t("Input.ShiftEnterHint") }),
|
|
4685
|
-
isCommandListVisible && /* @__PURE__ */ jsx("div", { className: "absolute left-0 right-0 bottom-full mb-1.5 z-20 overflow-hidden rounded-lg border border-gray-200/70 bg-white/98 shadow-md backdrop-blur-xl dark:border-gray-700/70 dark:bg-gray-900/98 dark:shadow-black/20", children: filteredCommands.length > 0 ? /* @__PURE__ */ jsx("ul", { role: "listbox", "aria-label": t("Slash.CommandsList"), className: "py-1 px-1", children: filteredCommands.map((command, index) => {
|
|
4697
|
+
isFocused && !message && !loading && /* @__PURE__ */ jsx("span", { className: "hidden sm:block absolute -bottom-5 left-14 text-[10px] text-gray-400 dark:text-gray-500 select-none animate-fade-in", children: t("BiChat.Input.ShiftEnterHint") }),
|
|
4698
|
+
isCommandListVisible && /* @__PURE__ */ jsx("div", { className: "absolute left-0 right-0 bottom-full mb-1.5 z-20 overflow-hidden rounded-lg border border-gray-200/70 bg-white/98 shadow-md backdrop-blur-xl dark:border-gray-700/70 dark:bg-gray-900/98 dark:shadow-black/20", children: filteredCommands.length > 0 ? /* @__PURE__ */ jsx("ul", { role: "listbox", "aria-label": t("BiChat.Slash.CommandsList"), className: "py-1 px-1", children: filteredCommands.map((command, index) => {
|
|
4686
4699
|
const isActive = index === activeCommandIndex;
|
|
4687
4700
|
return /* @__PURE__ */ jsxs(
|
|
4688
4701
|
"li",
|
|
@@ -4708,7 +4721,7 @@ var MessageInput = forwardRef(
|
|
|
4708
4721
|
},
|
|
4709
4722
|
command.name
|
|
4710
4723
|
);
|
|
4711
|
-
}) }) : /* @__PURE__ */ jsx("div", { className: "px-3 py-2.5 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-[11px] text-gray-400 dark:text-gray-500", children: t("Slash.NoMatches") }) }) })
|
|
4724
|
+
}) }) : /* @__PURE__ */ jsx("div", { className: "px-3 py-2.5 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-[11px] text-gray-400 dark:text-gray-500", children: t("BiChat.Slash.NoMatches") }) }) })
|
|
4712
4725
|
]
|
|
4713
4726
|
}
|
|
4714
4727
|
),
|
|
@@ -4732,37 +4745,25 @@ MessageInput.displayName = "MessageInput";
|
|
|
4732
4745
|
|
|
4733
4746
|
// ui/src/bichat/components/WelcomeContent.tsx
|
|
4734
4747
|
init_useTranslation();
|
|
4735
|
-
var
|
|
4736
|
-
{
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
text: "Show me sales trends for the last quarter"
|
|
4740
|
-
},
|
|
4741
|
-
{
|
|
4742
|
-
category: "Reports",
|
|
4743
|
-
icon: FileText,
|
|
4744
|
-
text: "Generate a summary of customer feedback"
|
|
4745
|
-
},
|
|
4746
|
-
{
|
|
4747
|
-
category: "Insights",
|
|
4748
|
-
icon: Lightbulb,
|
|
4749
|
-
text: "What are the top performing products?"
|
|
4750
|
-
}
|
|
4748
|
+
var PROMPT_DEFS = [
|
|
4749
|
+
{ categoryKey: "Welcome.Prompt1Category", textKey: "Welcome.Prompt1Text", icon: ChartBar, defaultCategory: "OSAGO Portfolio", defaultText: "What is the total amount of accrued OSAGO premiums for the reporting period?" },
|
|
4750
|
+
{ categoryKey: "Welcome.Prompt2Category", textKey: "Welcome.Prompt2Text", icon: FileText, defaultCategory: "Regional Analysis", defaultText: "Show me the top 5 regions by collected insurance premiums" },
|
|
4751
|
+
{ categoryKey: "Welcome.Prompt3Category", textKey: "Welcome.Prompt3Text", icon: Lightbulb, defaultCategory: "Loss Analysis", defaultText: "Calculate the loss ratio across the entire OSAGO portfolio" }
|
|
4751
4752
|
];
|
|
4752
|
-
var
|
|
4753
|
-
|
|
4753
|
+
var PROMPT_STYLES = [
|
|
4754
|
+
{
|
|
4754
4755
|
badge: "bg-sky-50 text-sky-600 ring-sky-600/10 dark:bg-sky-400/10 dark:text-sky-400 dark:ring-sky-400/20",
|
|
4755
4756
|
icon: "text-sky-500 dark:text-sky-400"
|
|
4756
4757
|
},
|
|
4757
|
-
|
|
4758
|
+
{
|
|
4758
4759
|
badge: "bg-teal-50 text-teal-600 ring-teal-600/10 dark:bg-teal-400/10 dark:text-teal-400 dark:ring-teal-400/20",
|
|
4759
4760
|
icon: "text-teal-500 dark:text-teal-400"
|
|
4760
4761
|
},
|
|
4761
|
-
|
|
4762
|
+
{
|
|
4762
4763
|
badge: "bg-amber-50 text-amber-600 ring-amber-600/10 dark:bg-amber-400/10 dark:text-amber-400 dark:ring-amber-400/20",
|
|
4763
4764
|
icon: "text-amber-500 dark:text-amber-400"
|
|
4764
4765
|
}
|
|
4765
|
-
|
|
4766
|
+
];
|
|
4766
4767
|
var containerVariants = {
|
|
4767
4768
|
hidden: { opacity: 0 },
|
|
4768
4769
|
visible: {
|
|
@@ -4804,6 +4805,10 @@ var reducedItemVariants = {
|
|
|
4804
4805
|
}
|
|
4805
4806
|
}
|
|
4806
4807
|
};
|
|
4808
|
+
function tOr(t, key2, defaultValue) {
|
|
4809
|
+
const v = t(key2);
|
|
4810
|
+
return v !== key2 ? v : defaultValue;
|
|
4811
|
+
}
|
|
4807
4812
|
function WelcomeContent({
|
|
4808
4813
|
onPromptSelect,
|
|
4809
4814
|
title,
|
|
@@ -4812,8 +4817,13 @@ function WelcomeContent({
|
|
|
4812
4817
|
}) {
|
|
4813
4818
|
const { t } = useTranslation();
|
|
4814
4819
|
const shouldReduceMotion = useReducedMotion();
|
|
4815
|
-
const resolvedTitle = title ||
|
|
4816
|
-
const resolvedDescription = description ||
|
|
4820
|
+
const resolvedTitle = title || "";
|
|
4821
|
+
const resolvedDescription = description || "";
|
|
4822
|
+
const prompts = PROMPT_DEFS.map((def) => ({
|
|
4823
|
+
category: tOr(t, def.categoryKey, def.defaultCategory),
|
|
4824
|
+
text: tOr(t, def.textKey, def.defaultText),
|
|
4825
|
+
icon: def.icon
|
|
4826
|
+
}));
|
|
4817
4827
|
const handlePromptClick = (prompt) => {
|
|
4818
4828
|
if (onPromptSelect && !disabled) {
|
|
4819
4829
|
onPromptSelect(prompt);
|
|
@@ -4829,15 +4839,7 @@ function WelcomeContent({
|
|
|
4829
4839
|
initial: "hidden",
|
|
4830
4840
|
animate: "visible",
|
|
4831
4841
|
children: [
|
|
4832
|
-
/* @__PURE__ */ jsx(
|
|
4833
|
-
"div",
|
|
4834
|
-
{
|
|
4835
|
-
className: "pointer-events-none absolute inset-x-0 -top-8 flex justify-center overflow-hidden h-56",
|
|
4836
|
-
"aria-hidden": true,
|
|
4837
|
-
children: /* @__PURE__ */ jsx("div", { className: "w-[420px] h-[260px] -mt-16 rounded-full bg-primary-300/[0.08] blur-[80px] dark:bg-primary-400/[0.05]" })
|
|
4838
|
-
}
|
|
4839
|
-
),
|
|
4840
|
-
/* @__PURE__ */ jsx(
|
|
4842
|
+
resolvedTitle && /* @__PURE__ */ jsx(
|
|
4841
4843
|
motion.h1,
|
|
4842
4844
|
{
|
|
4843
4845
|
className: "relative text-2xl sm:text-3xl font-semibold text-gray-900 dark:text-white mb-4",
|
|
@@ -4845,7 +4847,7 @@ function WelcomeContent({
|
|
|
4845
4847
|
children: resolvedTitle
|
|
4846
4848
|
}
|
|
4847
4849
|
),
|
|
4848
|
-
/* @__PURE__ */ jsx(
|
|
4850
|
+
resolvedDescription && /* @__PURE__ */ jsx(
|
|
4849
4851
|
motion.p,
|
|
4850
4852
|
{
|
|
4851
4853
|
className: "text-base text-gray-500 dark:text-gray-400 mb-10 max-w-2xl mx-auto leading-relaxed",
|
|
@@ -4856,11 +4858,11 @@ function WelcomeContent({
|
|
|
4856
4858
|
/* @__PURE__ */ jsxs(motion.div, { variants: activeItemVariants, children: [
|
|
4857
4859
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 mb-5", children: [
|
|
4858
4860
|
/* @__PURE__ */ jsx("div", { className: "h-px flex-1 bg-gradient-to-r from-transparent to-gray-200 dark:to-gray-700/70" }),
|
|
4859
|
-
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-semibold uppercase tracking-[0.12em] text-gray-400 dark:text-gray-500 select-none", children: t("Welcome.QuickStart") }),
|
|
4861
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-semibold uppercase tracking-[0.12em] text-gray-400 dark:text-gray-500 select-none", children: t("BiChat.Welcome.QuickStart") }),
|
|
4860
4862
|
/* @__PURE__ */ jsx("div", { className: "h-px flex-1 bg-gradient-to-l from-transparent to-gray-200 dark:to-gray-700/70" })
|
|
4861
4863
|
] }),
|
|
4862
|
-
/* @__PURE__ */ jsx("div", { className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-3", children:
|
|
4863
|
-
const style =
|
|
4864
|
+
/* @__PURE__ */ jsx("div", { className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-3", children: prompts.map((prompt, index) => {
|
|
4865
|
+
const style = PROMPT_STYLES[index];
|
|
4864
4866
|
return /* @__PURE__ */ jsxs(
|
|
4865
4867
|
motion.button,
|
|
4866
4868
|
{
|
|
@@ -4990,8 +4992,8 @@ function SessionArtifactList({
|
|
|
4990
4992
|
return /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col items-center justify-center gap-3 px-4 py-12 text-center", children: [
|
|
4991
4993
|
/* @__PURE__ */ jsx("div", { className: "flex h-12 w-12 items-center justify-center rounded-xl bg-gray-100 dark:bg-gray-800", children: /* @__PURE__ */ jsx(Package, { className: "h-6 w-6 text-gray-400 dark:text-gray-500", weight: "duotone" }) }),
|
|
4992
4994
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
4993
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-gray-500 dark:text-gray-400", children: t("Artifacts.Empty") }),
|
|
4994
|
-
/* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs text-gray-400 dark:text-gray-500", children: t("Artifacts.EmptySubtitle") })
|
|
4995
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-gray-500 dark:text-gray-400", children: t("BiChat.Artifacts.Empty") }),
|
|
4996
|
+
/* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs text-gray-400 dark:text-gray-500", children: t("BiChat.Artifacts.EmptySubtitle") })
|
|
4995
4997
|
] })
|
|
4996
4998
|
] });
|
|
4997
4999
|
}
|
|
@@ -5103,7 +5105,7 @@ function ArtifactActions({ url }) {
|
|
|
5103
5105
|
className: "inline-flex items-center gap-2 rounded-lg border border-gray-200 px-3 py-1.5 text-xs font-medium text-gray-700 transition-colors hover:bg-gray-50 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-800",
|
|
5104
5106
|
children: [
|
|
5105
5107
|
/* @__PURE__ */ jsx(ArrowSquareOut, { className: "h-3.5 w-3.5", weight: "bold" }),
|
|
5106
|
-
t("Artifacts.OpenInNewTab")
|
|
5108
|
+
t("BiChat.Artifacts.OpenInNewTab")
|
|
5107
5109
|
]
|
|
5108
5110
|
}
|
|
5109
5111
|
),
|
|
@@ -5117,7 +5119,7 @@ function ArtifactActions({ url }) {
|
|
|
5117
5119
|
className: "inline-flex items-center gap-2 rounded-lg bg-primary-600 px-3 py-1.5 text-xs font-medium text-white shadow-sm transition-colors hover:bg-primary-700",
|
|
5118
5120
|
children: [
|
|
5119
5121
|
/* @__PURE__ */ jsx(DownloadSimple, { className: "h-3.5 w-3.5", weight: "bold" }),
|
|
5120
|
-
t("Artifacts.Download")
|
|
5122
|
+
t("BiChat.Artifacts.Download")
|
|
5121
5123
|
]
|
|
5122
5124
|
}
|
|
5123
5125
|
)
|
|
@@ -5132,7 +5134,7 @@ function TextArtifactPreview({ artifact }) {
|
|
|
5132
5134
|
useEffect(() => {
|
|
5133
5135
|
if (!artifact.url) {
|
|
5134
5136
|
setLoading(false);
|
|
5135
|
-
setError(t("Artifacts.TextPreviewFailed"));
|
|
5137
|
+
setError(t("BiChat.Artifacts.TextPreviewFailed"));
|
|
5136
5138
|
return;
|
|
5137
5139
|
}
|
|
5138
5140
|
const controller = new AbortController();
|
|
@@ -5155,7 +5157,7 @@ function TextArtifactPreview({ artifact }) {
|
|
|
5155
5157
|
if (err instanceof Error && err.name === "AbortError") {
|
|
5156
5158
|
return;
|
|
5157
5159
|
}
|
|
5158
|
-
setError(t("Artifacts.TextPreviewFailed"));
|
|
5160
|
+
setError(t("BiChat.Artifacts.TextPreviewFailed"));
|
|
5159
5161
|
}).finally(() => {
|
|
5160
5162
|
setLoading(false);
|
|
5161
5163
|
});
|
|
@@ -5166,15 +5168,15 @@ function TextArtifactPreview({ artifact }) {
|
|
|
5166
5168
|
if (loading) {
|
|
5167
5169
|
return /* @__PURE__ */ jsxs("div", { className: "flex min-h-[320px] items-center justify-center rounded-xl border border-gray-200 bg-gray-50 text-sm text-gray-500 dark:border-gray-700/60 dark:bg-gray-800/30 dark:text-gray-400", children: [
|
|
5168
5170
|
/* @__PURE__ */ jsx(SpinnerGap, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
5169
|
-
t("Artifacts.PreviewLoading")
|
|
5171
|
+
t("BiChat.Artifacts.PreviewLoading")
|
|
5170
5172
|
] });
|
|
5171
5173
|
}
|
|
5172
5174
|
if (error) {
|
|
5173
5175
|
return /* @__PURE__ */ jsx(WarningBox, { message: error });
|
|
5174
5176
|
}
|
|
5175
5177
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
5176
|
-
/* @__PURE__ */ jsx("pre", { className: "max-h-[70vh] overflow-auto rounded-xl border border-gray-200 bg-gray-50 p-3 text-xs leading-relaxed text-gray-800 dark:border-gray-700/60 dark:bg-gray-900 dark:text-gray-100", children: content || t("Artifacts.PreviewUnavailable") }),
|
|
5177
|
-
truncated && /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: t("Artifacts.TextPreviewTruncated") })
|
|
5178
|
+
/* @__PURE__ */ jsx("pre", { className: "max-h-[70vh] overflow-auto rounded-xl border border-gray-200 bg-gray-50 p-3 text-xs leading-relaxed text-gray-800 dark:border-gray-700/60 dark:bg-gray-900 dark:text-gray-100", children: content || t("BiChat.Artifacts.PreviewUnavailable") }),
|
|
5179
|
+
truncated && /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: t("BiChat.Artifacts.TextPreviewTruncated") })
|
|
5178
5180
|
] });
|
|
5179
5181
|
}
|
|
5180
5182
|
function SessionArtifactPreview({ artifact }) {
|
|
@@ -5190,11 +5192,11 @@ function SessionArtifactPreview({ artifact }) {
|
|
|
5190
5192
|
if (chartData) {
|
|
5191
5193
|
return /* @__PURE__ */ jsx(ChartCard, { chartData });
|
|
5192
5194
|
}
|
|
5193
|
-
return /* @__PURE__ */ jsx(WarningBox, { message: t("Artifacts.ChartUnavailable") });
|
|
5195
|
+
return /* @__PURE__ */ jsx(WarningBox, { message: t("BiChat.Artifacts.ChartUnavailable") });
|
|
5194
5196
|
}
|
|
5195
5197
|
if (isImageArtifact2(artifact)) {
|
|
5196
5198
|
if (!artifact.url) {
|
|
5197
|
-
return /* @__PURE__ */ jsx(WarningBox, { message: t("Artifacts.ImageUnavailable") });
|
|
5199
|
+
return /* @__PURE__ */ jsx(WarningBox, { message: t("BiChat.Artifacts.ImageUnavailable") });
|
|
5198
5200
|
}
|
|
5199
5201
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
5200
5202
|
/* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-xl border border-gray-200/80 bg-gray-50/50 dark:border-gray-700/60 dark:bg-gray-800/30", children: /* @__PURE__ */ jsx(
|
|
@@ -5211,7 +5213,7 @@ function SessionArtifactPreview({ artifact }) {
|
|
|
5211
5213
|
}
|
|
5212
5214
|
if (isPDFArtifact(artifact)) {
|
|
5213
5215
|
if (!artifact.url) {
|
|
5214
|
-
return /* @__PURE__ */ jsx(WarningBox, { message: t("Artifacts.DownloadUnavailable") });
|
|
5216
|
+
return /* @__PURE__ */ jsx(WarningBox, { message: t("BiChat.Artifacts.DownloadUnavailable") });
|
|
5215
5217
|
}
|
|
5216
5218
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
5217
5219
|
/* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-xl border border-gray-200/80 bg-gray-50 dark:border-gray-700/60 dark:bg-gray-900", children: /* @__PURE__ */ jsx(
|
|
@@ -5227,7 +5229,7 @@ function SessionArtifactPreview({ artifact }) {
|
|
|
5227
5229
|
}
|
|
5228
5230
|
if (isOfficeDocumentArtifact(artifact)) {
|
|
5229
5231
|
if (!artifact.url) {
|
|
5230
|
-
return /* @__PURE__ */ jsx(WarningBox, { message: t("Artifacts.DownloadUnavailable") });
|
|
5232
|
+
return /* @__PURE__ */ jsx(WarningBox, { message: t("BiChat.Artifacts.DownloadUnavailable") });
|
|
5231
5233
|
}
|
|
5232
5234
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
5233
5235
|
officeViewerURL ? /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-xl border border-gray-200/80 bg-gray-50 dark:border-gray-700/60 dark:bg-gray-900", children: /* @__PURE__ */ jsx(
|
|
@@ -5237,7 +5239,7 @@ function SessionArtifactPreview({ artifact }) {
|
|
|
5237
5239
|
title: artifact.name,
|
|
5238
5240
|
className: "h-[72vh] w-full"
|
|
5239
5241
|
}
|
|
5240
|
-
) }) : /* @__PURE__ */ jsx(WarningBox, { message: t("Artifacts.OfficePreviewUnavailable") }),
|
|
5242
|
+
) }) : /* @__PURE__ */ jsx(WarningBox, { message: t("BiChat.Artifacts.OfficePreviewUnavailable") }),
|
|
5241
5243
|
/* @__PURE__ */ jsx(ArtifactActions, { url: artifact.url })
|
|
5242
5244
|
] });
|
|
5243
5245
|
}
|
|
@@ -5251,13 +5253,13 @@ function SessionArtifactPreview({ artifact }) {
|
|
|
5251
5253
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
5252
5254
|
/* @__PURE__ */ jsxs("div", { className: "flex min-h-[240px] flex-col items-center justify-center rounded-xl border border-gray-200/80 bg-gray-50/60 p-6 text-center dark:border-gray-700/60 dark:bg-gray-900", children: [
|
|
5253
5255
|
/* @__PURE__ */ jsx(FileText, { className: "h-8 w-8 text-gray-400 dark:text-gray-500", weight: "duotone" }),
|
|
5254
|
-
/* @__PURE__ */ jsx("p", { className: "mt-3 text-sm font-medium text-gray-800 dark:text-gray-100", children: t("Artifacts.PreviewUnavailable") }),
|
|
5255
|
-
/* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-gray-500 dark:text-gray-400", children: t("Artifacts.PreviewNotSupported") })
|
|
5256
|
+
/* @__PURE__ */ jsx("p", { className: "mt-3 text-sm font-medium text-gray-800 dark:text-gray-100", children: t("BiChat.Artifacts.PreviewUnavailable") }),
|
|
5257
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-gray-500 dark:text-gray-400", children: t("BiChat.Artifacts.PreviewNotSupported") })
|
|
5256
5258
|
] }),
|
|
5257
5259
|
/* @__PURE__ */ jsx(ArtifactActions, { url: artifact.url })
|
|
5258
5260
|
] });
|
|
5259
5261
|
}
|
|
5260
|
-
return /* @__PURE__ */ jsx(WarningBox, { message: t("Artifacts.DownloadUnavailable") });
|
|
5262
|
+
return /* @__PURE__ */ jsx(WarningBox, { message: t("BiChat.Artifacts.DownloadUnavailable") });
|
|
5261
5263
|
}
|
|
5262
5264
|
function SessionArtifactPreviewModal({
|
|
5263
5265
|
isOpen,
|
|
@@ -5303,7 +5305,7 @@ function SessionArtifactPreviewModal({
|
|
|
5303
5305
|
await onRename(artifact, nextName);
|
|
5304
5306
|
setIsEditingName(false);
|
|
5305
5307
|
} catch (err) {
|
|
5306
|
-
setError(err instanceof Error ? err.message : t("Artifacts.RenameFailed"));
|
|
5308
|
+
setError(err instanceof Error ? err.message : t("BiChat.Artifacts.RenameFailed"));
|
|
5307
5309
|
} finally {
|
|
5308
5310
|
setSubmittingRename(false);
|
|
5309
5311
|
}
|
|
@@ -5312,7 +5314,7 @@ function SessionArtifactPreviewModal({
|
|
|
5312
5314
|
if (!artifact || !onDelete) {
|
|
5313
5315
|
return;
|
|
5314
5316
|
}
|
|
5315
|
-
if (!window.confirm(t("Artifacts.DeleteConfirm"))) {
|
|
5317
|
+
if (!window.confirm(t("BiChat.Artifacts.DeleteConfirm"))) {
|
|
5316
5318
|
return;
|
|
5317
5319
|
}
|
|
5318
5320
|
setSubmittingDelete(true);
|
|
@@ -5321,7 +5323,7 @@ function SessionArtifactPreviewModal({
|
|
|
5321
5323
|
await onDelete(artifact);
|
|
5322
5324
|
onClose();
|
|
5323
5325
|
} catch (err) {
|
|
5324
|
-
setError(err instanceof Error ? err.message : t("Artifacts.DeleteFailed"));
|
|
5326
|
+
setError(err instanceof Error ? err.message : t("BiChat.Artifacts.DeleteFailed"));
|
|
5325
5327
|
} finally {
|
|
5326
5328
|
setSubmittingDelete(false);
|
|
5327
5329
|
}
|
|
@@ -5352,7 +5354,7 @@ function SessionArtifactPreviewModal({
|
|
|
5352
5354
|
}
|
|
5353
5355
|
},
|
|
5354
5356
|
className: "w-full rounded-lg border border-gray-300 px-3 py-1.5 text-sm text-gray-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100",
|
|
5355
|
-
"aria-label": t("Artifacts.Rename"),
|
|
5357
|
+
"aria-label": t("BiChat.Artifacts.Rename"),
|
|
5356
5358
|
autoFocus: true
|
|
5357
5359
|
}
|
|
5358
5360
|
),
|
|
@@ -5367,7 +5369,7 @@ function SessionArtifactPreviewModal({
|
|
|
5367
5369
|
className: "cursor-pointer inline-flex items-center gap-1 rounded-lg bg-primary-600 px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-primary-700 disabled:cursor-not-allowed disabled:opacity-60",
|
|
5368
5370
|
children: [
|
|
5369
5371
|
/* @__PURE__ */ jsx(FloppyDisk, { className: "h-3.5 w-3.5", weight: "bold" }),
|
|
5370
|
-
t("Message.Save")
|
|
5372
|
+
t("BiChat.Message.Save")
|
|
5371
5373
|
]
|
|
5372
5374
|
}
|
|
5373
5375
|
),
|
|
@@ -5381,7 +5383,7 @@ function SessionArtifactPreviewModal({
|
|
|
5381
5383
|
},
|
|
5382
5384
|
disabled: submittingRename,
|
|
5383
5385
|
className: "cursor-pointer rounded-lg border border-gray-200 px-2.5 py-1.5 text-xs font-medium text-gray-700 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-800",
|
|
5384
|
-
children: t("Message.Cancel")
|
|
5386
|
+
children: t("BiChat.Message.Cancel")
|
|
5385
5387
|
}
|
|
5386
5388
|
)
|
|
5387
5389
|
] }) : /* @__PURE__ */ jsx("h2", { className: "truncate text-base font-semibold text-gray-900 dark:text-gray-100", children: artifact.name }),
|
|
@@ -5397,8 +5399,8 @@ function SessionArtifactPreviewModal({
|
|
|
5397
5399
|
setIsEditingName(true);
|
|
5398
5400
|
},
|
|
5399
5401
|
className: "cursor-pointer rounded-lg border border-gray-200 p-2 text-gray-600 transition-colors hover:bg-gray-50 hover:text-gray-900 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100",
|
|
5400
|
-
"aria-label": t("Artifacts.Rename"),
|
|
5401
|
-
title: t("Artifacts.Rename"),
|
|
5402
|
+
"aria-label": t("BiChat.Artifacts.Rename"),
|
|
5403
|
+
title: t("BiChat.Artifacts.Rename"),
|
|
5402
5404
|
children: /* @__PURE__ */ jsx(PencilSimple, { className: "h-4 w-4", weight: "regular" })
|
|
5403
5405
|
}
|
|
5404
5406
|
),
|
|
@@ -5411,8 +5413,8 @@ function SessionArtifactPreviewModal({
|
|
|
5411
5413
|
},
|
|
5412
5414
|
disabled: submittingDelete,
|
|
5413
5415
|
className: "cursor-pointer rounded-lg border border-red-200 p-2 text-red-600 transition-colors hover:bg-red-50 hover:text-red-700 disabled:cursor-not-allowed disabled:opacity-60 dark:border-red-900/60 dark:text-red-400 dark:hover:bg-red-950/30 dark:hover:text-red-300",
|
|
5414
|
-
"aria-label": t("Artifacts.Delete"),
|
|
5415
|
-
title: t("Artifacts.Delete"),
|
|
5416
|
+
"aria-label": t("BiChat.Artifacts.Delete"),
|
|
5417
|
+
title: t("BiChat.Artifacts.Delete"),
|
|
5416
5418
|
children: /* @__PURE__ */ jsx(Trash, { className: "h-4 w-4", weight: "regular" })
|
|
5417
5419
|
}
|
|
5418
5420
|
),
|
|
@@ -5422,8 +5424,8 @@ function SessionArtifactPreviewModal({
|
|
|
5422
5424
|
type: "button",
|
|
5423
5425
|
onClick: handleClose,
|
|
5424
5426
|
className: "cursor-pointer rounded-lg border border-gray-200 p-2 text-gray-600 transition-colors hover:bg-gray-50 hover:text-gray-900 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100",
|
|
5425
|
-
"aria-label": t("Common.Close"),
|
|
5426
|
-
title: t("Common.Close"),
|
|
5427
|
+
"aria-label": t("BiChat.Common.Close"),
|
|
5428
|
+
title: t("BiChat.Common.Close"),
|
|
5427
5429
|
children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4", weight: "bold" })
|
|
5428
5430
|
}
|
|
5429
5431
|
)
|
|
@@ -5527,7 +5529,7 @@ function SessionArtifactsPanel({
|
|
|
5527
5529
|
if (requestID !== requestSeq.current) {
|
|
5528
5530
|
return;
|
|
5529
5531
|
}
|
|
5530
|
-
setError(err instanceof Error ? err.message : tRef.current("Artifacts.FailedToLoad"));
|
|
5532
|
+
setError(err instanceof Error ? err.message : tRef.current("BiChat.Artifacts.FailedToLoad"));
|
|
5531
5533
|
} finally {
|
|
5532
5534
|
if (requestID === requestSeq.current) {
|
|
5533
5535
|
setFetching(false);
|
|
@@ -5642,7 +5644,7 @@ function SessionArtifactsPanel({
|
|
|
5642
5644
|
}
|
|
5643
5645
|
setError(null);
|
|
5644
5646
|
} catch (err) {
|
|
5645
|
-
setError(err instanceof Error ? err.message : tRef.current("Artifacts.FailedToLoad"));
|
|
5647
|
+
setError(err instanceof Error ? err.message : tRef.current("BiChat.Artifacts.FailedToLoad"));
|
|
5646
5648
|
}
|
|
5647
5649
|
}, [canDropFiles, dataSource, fetchArtifacts, hasDragFiles, sessionId, setDropSuccessState]);
|
|
5648
5650
|
const canRenameArtifacts = typeof dataSource.renameSessionArtifact === "function";
|
|
@@ -5691,7 +5693,7 @@ function SessionArtifactsPanel({
|
|
|
5691
5693
|
isDragging ? "bg-primary-50/40 dark:bg-primary-950/20" : "",
|
|
5692
5694
|
className
|
|
5693
5695
|
].join(" "),
|
|
5694
|
-
"aria-label": t("Artifacts.Title"),
|
|
5696
|
+
"aria-label": t("BiChat.Artifacts.Title"),
|
|
5695
5697
|
onDragEnter: handleDragEnter,
|
|
5696
5698
|
onDragOver: handleDragOver,
|
|
5697
5699
|
onDragLeave: handleDragLeave,
|
|
@@ -5706,18 +5708,18 @@ function SessionArtifactsPanel({
|
|
|
5706
5708
|
].join(" "),
|
|
5707
5709
|
children: [
|
|
5708
5710
|
/* @__PURE__ */ jsx(Paperclip, { className: "h-5 w-5", weight: "bold" }),
|
|
5709
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: dropSuccess ? t("Input.FilesAdded") : t("Input.DropFiles") })
|
|
5711
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: dropSuccess ? t("BiChat.Input.FilesAdded") : t("BiChat.Input.DropFiles") })
|
|
5710
5712
|
]
|
|
5711
5713
|
}
|
|
5712
5714
|
) }),
|
|
5713
5715
|
/* @__PURE__ */ jsx("header", { className: "flex items-center justify-between border-b border-gray-200 px-3 py-2 dark:border-gray-700/80", children: /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsxs("h2", { className: "truncate text-sm font-semibold text-gray-900 dark:text-gray-100", children: [
|
|
5714
|
-
t("Artifacts.Title"),
|
|
5716
|
+
t("BiChat.Artifacts.Title"),
|
|
5715
5717
|
" (",
|
|
5716
5718
|
artifacts.length,
|
|
5717
5719
|
")"
|
|
5718
5720
|
] }) }) }),
|
|
5719
|
-
/* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-y-auto px-3 py-3", children: fetching ? /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center text-sm text-gray-500 dark:text-gray-400", children: t("Artifacts.Loading") }) : error ? /* @__PURE__ */ jsxs("div", { className: "space-y-3 rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-900/70 dark:bg-red-950/30", children: [
|
|
5720
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-red-800 dark:text-red-300", children: t("Artifacts.FailedToLoad") }),
|
|
5721
|
+
/* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-y-auto px-3 py-3", children: fetching ? /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center text-sm text-gray-500 dark:text-gray-400", children: t("BiChat.Artifacts.Loading") }) : error ? /* @__PURE__ */ jsxs("div", { className: "space-y-3 rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-900/70 dark:bg-red-950/30", children: [
|
|
5722
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-red-800 dark:text-red-300", children: t("BiChat.Artifacts.FailedToLoad") }),
|
|
5721
5723
|
/* @__PURE__ */ jsx("p", { className: "text-xs text-red-700 dark:text-red-400", children: error }),
|
|
5722
5724
|
/* @__PURE__ */ jsx(
|
|
5723
5725
|
"button",
|
|
@@ -5727,10 +5729,10 @@ function SessionArtifactsPanel({
|
|
|
5727
5729
|
void fetchArtifacts({ reset: true, manual: true });
|
|
5728
5730
|
},
|
|
5729
5731
|
className: "cursor-pointer rounded-md border border-red-300 px-2 py-1 text-xs font-medium text-red-700 hover:bg-red-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-400/50 dark:border-red-800 dark:text-red-300 dark:hover:bg-red-900/40",
|
|
5730
|
-
children: t("Alert.Retry")
|
|
5732
|
+
children: t("BiChat.Alert.Retry")
|
|
5731
5733
|
}
|
|
5732
5734
|
)
|
|
5733
|
-
] }) : !canFetchArtifacts ? /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800 dark:border-amber-900/70 dark:bg-amber-950/30 dark:text-amber-200", children: t("Artifacts.Unsupported") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5735
|
+
] }) : !canFetchArtifacts ? /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800 dark:border-amber-900/70 dark:bg-amber-950/30 dark:text-amber-200", children: t("BiChat.Artifacts.Unsupported") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5734
5736
|
/* @__PURE__ */ jsx(
|
|
5735
5737
|
SessionArtifactList,
|
|
5736
5738
|
{
|
|
@@ -5748,7 +5750,7 @@ function SessionArtifactsPanel({
|
|
|
5748
5750
|
},
|
|
5749
5751
|
disabled: loadingMore || refreshing || fetching,
|
|
5750
5752
|
className: "cursor-pointer rounded-md border border-gray-200 px-3 py-1.5 text-xs font-medium text-gray-700 transition-colors hover:bg-gray-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/50 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-800",
|
|
5751
|
-
children: loadingMore ? t("Artifacts.LoadingMore") : t("Artifacts.LoadMore")
|
|
5753
|
+
children: loadingMore ? t("BiChat.Artifacts.LoadingMore") : t("BiChat.Artifacts.LoadMore")
|
|
5752
5754
|
}
|
|
5753
5755
|
) })
|
|
5754
5756
|
] }) }),
|
|
@@ -5873,11 +5875,11 @@ function ChatSessionCore({
|
|
|
5873
5875
|
};
|
|
5874
5876
|
}, [isResizingArtifactsPanel, artifactsPanelStorageKey]);
|
|
5875
5877
|
if (fetching) {
|
|
5876
|
-
return /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "text-gray-500 dark:text-gray-400", children: t("Input.Processing") }) });
|
|
5878
|
+
return /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "text-gray-500 dark:text-gray-400", children: t("BiChat.Input.Processing") }) });
|
|
5877
5879
|
}
|
|
5878
5880
|
if (error) {
|
|
5879
5881
|
return /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "text-red-500 dark:text-red-400", children: [
|
|
5880
|
-
t("Error.Generic"),
|
|
5882
|
+
t("BiChat.Error.Generic"),
|
|
5881
5883
|
": ",
|
|
5882
5884
|
error
|
|
5883
5885
|
] }) });
|
|
@@ -5913,11 +5915,11 @@ function ChatSessionCore({
|
|
|
5913
5915
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/50",
|
|
5914
5916
|
artifactsPanelExpanded ? "bg-primary-50 text-primary-700 hover:bg-primary-100 dark:bg-primary-950/30 dark:text-primary-300 dark:hover:bg-primary-900/40" : "text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200"
|
|
5915
5917
|
].join(" "),
|
|
5916
|
-
"aria-label": artifactsPanelExpanded ? t("Artifacts.ToggleHide") : t("Artifacts.ToggleShow"),
|
|
5917
|
-
title: artifactsPanelExpanded ? t("Artifacts.ToggleHide") : t("Artifacts.ToggleShow"),
|
|
5918
|
+
"aria-label": artifactsPanelExpanded ? t("BiChat.Artifacts.ToggleHide") : t("BiChat.Artifacts.ToggleShow"),
|
|
5919
|
+
title: artifactsPanelExpanded ? t("BiChat.Artifacts.ToggleHide") : t("BiChat.Artifacts.ToggleShow"),
|
|
5918
5920
|
children: [
|
|
5919
5921
|
/* @__PURE__ */ jsx(Sidebar, { className: "h-4 w-4", weight: artifactsPanelExpanded ? "duotone" : "regular" }),
|
|
5920
|
-
t("Artifacts.Title")
|
|
5922
|
+
t("BiChat.Artifacts.Title")
|
|
5921
5923
|
]
|
|
5922
5924
|
}
|
|
5923
5925
|
),
|
|
@@ -5965,7 +5967,7 @@ function ChatSessionCore({
|
|
|
5965
5967
|
formClassName: "mx-auto"
|
|
5966
5968
|
}
|
|
5967
5969
|
),
|
|
5968
|
-
/* @__PURE__ */ jsx("p", { className: "mt-4 pb-1 text-center text-xs text-gray-500 dark:text-gray-400", children: t("Welcome.Disclaimer") })
|
|
5970
|
+
/* @__PURE__ */ jsx("p", { className: "mt-4 pb-1 text-center text-xs text-gray-500 dark:text-gray-400", children: t("BiChat.Welcome.Disclaimer") })
|
|
5969
5971
|
] }) }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5970
5972
|
/* @__PURE__ */ jsx(
|
|
5971
5973
|
MessageList,
|
|
@@ -6015,7 +6017,7 @@ function ChatSessionCore({
|
|
|
6015
6017
|
"div",
|
|
6016
6018
|
{
|
|
6017
6019
|
role: "separator",
|
|
6018
|
-
"aria-label": t("Artifacts.Resize"),
|
|
6020
|
+
"aria-label": t("BiChat.Artifacts.Resize"),
|
|
6019
6021
|
onMouseDown: handleArtifactsResizeStart,
|
|
6020
6022
|
className: "relative flex shrink-0 cursor-col-resize touch-none items-center justify-center w-2 transition-colors lg:flex group/resize after:absolute after:inset-y-0 after:left-0 after:w-0.5 after:bg-gray-300 dark:after:bg-gray-600 after:transition-colors group-hover/resize:after:bg-primary-400 dark:group-hover/resize:after:bg-primary-500",
|
|
6021
6023
|
children: /* @__PURE__ */ jsx("span", { className: "absolute h-10 w-1.5 cursor-col-resize rounded-full bg-gray-400 transition-colors group-hover/resize:bg-primary-400 dark:bg-gray-500 dark:group-hover/resize:bg-primary-500" })
|
|
@@ -6056,7 +6058,7 @@ function ChatSessionCore({
|
|
|
6056
6058
|
animate: { opacity: 1 },
|
|
6057
6059
|
exit: { opacity: 0 },
|
|
6058
6060
|
onClick: handleToggleArtifactsPanel,
|
|
6059
|
-
"aria-label": t("Common.Close")
|
|
6061
|
+
"aria-label": t("BiChat.Common.Close")
|
|
6060
6062
|
}
|
|
6061
6063
|
),
|
|
6062
6064
|
/* @__PURE__ */ jsx(
|
|
@@ -6170,6 +6172,9 @@ function EmptyState({
|
|
|
6170
6172
|
}
|
|
6171
6173
|
var MemoizedEmptyState = memo(EmptyState);
|
|
6172
6174
|
MemoizedEmptyState.displayName = "EmptyState";
|
|
6175
|
+
|
|
6176
|
+
// ui/src/bichat/components/EditableText.tsx
|
|
6177
|
+
init_useTranslation();
|
|
6173
6178
|
var sizeClasses2 = {
|
|
6174
6179
|
sm: "text-sm",
|
|
6175
6180
|
md: "text-base",
|
|
@@ -6186,6 +6191,7 @@ var EditableText = forwardRef(
|
|
|
6186
6191
|
inputClassName = "",
|
|
6187
6192
|
size = "sm"
|
|
6188
6193
|
}, ref) => {
|
|
6194
|
+
const { t } = useTranslation();
|
|
6189
6195
|
const [isEditing, setIsEditing] = useState(false);
|
|
6190
6196
|
const [editValue, setEditValue] = useState(value);
|
|
6191
6197
|
const inputRef = useRef(null);
|
|
@@ -6261,7 +6267,7 @@ var EditableText = forwardRef(
|
|
|
6261
6267
|
maxLength,
|
|
6262
6268
|
placeholder,
|
|
6263
6269
|
className: `flex-1 px-2 py-1 ${sizeClass} bg-white dark:bg-gray-700 border border-primary-500 dark:border-primary-600 rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/50 dark:focus-visible:ring-primary-600/30 text-gray-900 dark:text-white ${inputClassName}`,
|
|
6264
|
-
"aria-label": "
|
|
6270
|
+
"aria-label": t("BiChat.EditableText.AriaLabel")
|
|
6265
6271
|
}
|
|
6266
6272
|
)
|
|
6267
6273
|
}
|
|
@@ -6273,7 +6279,7 @@ var EditableText = forwardRef(
|
|
|
6273
6279
|
{
|
|
6274
6280
|
onDoubleClick: handleDoubleClick,
|
|
6275
6281
|
className: `${sizeClass} font-medium truncate flex-1 cursor-pointer select-none hover:text-primary-600 dark:hover:text-primary-400 transition-colors ${className}`,
|
|
6276
|
-
title: "
|
|
6282
|
+
title: t("BiChat.EditableText.DoubleClickToEdit"),
|
|
6277
6283
|
role: "button",
|
|
6278
6284
|
tabIndex: 0,
|
|
6279
6285
|
onKeyDown: (e) => {
|
|
@@ -6292,6 +6298,9 @@ var EditableText = forwardRef(
|
|
|
6292
6298
|
);
|
|
6293
6299
|
EditableText.displayName = "EditableText";
|
|
6294
6300
|
var MemoizedEditableText = memo(EditableText);
|
|
6301
|
+
|
|
6302
|
+
// ui/src/bichat/components/SearchInput.tsx
|
|
6303
|
+
init_useTranslation();
|
|
6295
6304
|
var sizeClasses3 = {
|
|
6296
6305
|
sm: {
|
|
6297
6306
|
container: "py-1.5 pl-8 pr-8 text-xs",
|
|
@@ -6321,6 +6330,7 @@ function SearchInput({
|
|
|
6321
6330
|
disabled = false,
|
|
6322
6331
|
ariaLabel = "Search"
|
|
6323
6332
|
}) {
|
|
6333
|
+
const { t } = useTranslation();
|
|
6324
6334
|
const inputRef = useRef(null);
|
|
6325
6335
|
const sizes = sizeClasses3[size];
|
|
6326
6336
|
useEffect(() => {
|
|
@@ -6375,8 +6385,8 @@ function SearchInput({
|
|
|
6375
6385
|
type: "button",
|
|
6376
6386
|
onClick: handleClear,
|
|
6377
6387
|
className: `cursor-pointer absolute inset-y-0 right-2 flex items-center ${sizes.clearBtn} rounded-lg hover:bg-gray-200 dark:hover:bg-gray-700 transition-all duration-200 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300`,
|
|
6378
|
-
"aria-label": "Clear
|
|
6379
|
-
title: "Clear
|
|
6388
|
+
"aria-label": t("BiChat.Search.Clear"),
|
|
6389
|
+
title: t("BiChat.Search.Clear"),
|
|
6380
6390
|
children: /* @__PURE__ */ jsx(X, { size: sizes.icon - 2, weight: "bold" })
|
|
6381
6391
|
}
|
|
6382
6392
|
)
|
|
@@ -6911,12 +6921,16 @@ function useLongPress(options) {
|
|
|
6911
6921
|
isPressed
|
|
6912
6922
|
};
|
|
6913
6923
|
}
|
|
6924
|
+
|
|
6925
|
+
// ui/src/bichat/components/TouchContextMenu.tsx
|
|
6926
|
+
init_useTranslation();
|
|
6914
6927
|
var TouchContextMenu = ({
|
|
6915
6928
|
items,
|
|
6916
6929
|
isOpen,
|
|
6917
6930
|
onClose,
|
|
6918
6931
|
anchorRect
|
|
6919
6932
|
}) => {
|
|
6933
|
+
const { t } = useTranslation();
|
|
6920
6934
|
const [focusedIndex, setFocusedIndex] = useState(-1);
|
|
6921
6935
|
const menuRef = useRef(null);
|
|
6922
6936
|
const itemRefs = useRef([]);
|
|
@@ -7000,7 +7014,7 @@ var TouchContextMenu = ({
|
|
|
7000
7014
|
{
|
|
7001
7015
|
ref: menuRef,
|
|
7002
7016
|
role: "menu",
|
|
7003
|
-
"aria-label": "
|
|
7017
|
+
"aria-label": t("BiChat.ContextMenu"),
|
|
7004
7018
|
initial: { opacity: 0, scale: 0.95 },
|
|
7005
7019
|
animate: { opacity: 1, scale: 1 },
|
|
7006
7020
|
exit: { opacity: 0, scale: 0.95 },
|
|
@@ -7068,8 +7082,8 @@ var SessionItem = memo(
|
|
|
7068
7082
|
useEffect(() => {
|
|
7069
7083
|
setIsTouch("ontouchend" in document);
|
|
7070
7084
|
}, []);
|
|
7071
|
-
const isTitleGenerating = !session.title || session.title === t("Chat.NewChat");
|
|
7072
|
-
const displayTitle = isTitleGenerating ? t("Common.Generating") : session.title ?? t("Common.Untitled");
|
|
7085
|
+
const isTitleGenerating = !session.title || session.title === t("BiChat.Chat.NewChat");
|
|
7086
|
+
const displayTitle = isTitleGenerating ? t("BiChat.Common.Generating") : session.title ?? t("BiChat.Common.Untitled");
|
|
7073
7087
|
const { handlers: longPressHandlers } = useLongPress({
|
|
7074
7088
|
delay: 500,
|
|
7075
7089
|
onLongPress: (e) => {
|
|
@@ -7098,45 +7112,45 @@ var SessionItem = memo(
|
|
|
7098
7112
|
const contextMenuItems = mode === "archived" ? [
|
|
7099
7113
|
...onRestore ? [{
|
|
7100
7114
|
id: "restore",
|
|
7101
|
-
label: t("Archived.RestoreButton"),
|
|
7115
|
+
label: t("BiChat.Archived.RestoreButton"),
|
|
7102
7116
|
icon: /* @__PURE__ */ jsx(ArrowUUpLeft, { size: 20 }),
|
|
7103
7117
|
onClick: () => onRestore()
|
|
7104
7118
|
}] : [],
|
|
7105
7119
|
...onRename ? [{
|
|
7106
7120
|
id: "rename",
|
|
7107
|
-
label: t("Sidebar.RenameChat"),
|
|
7121
|
+
label: t("BiChat.Sidebar.RenameChat"),
|
|
7108
7122
|
icon: /* @__PURE__ */ jsx(PencilSimple, { size: 20 }),
|
|
7109
7123
|
onClick: () => editableTitleRef.current?.startEditing()
|
|
7110
7124
|
}] : []
|
|
7111
7125
|
] : [
|
|
7112
7126
|
...onPin ? [{
|
|
7113
7127
|
id: "pin",
|
|
7114
|
-
label: session.pinned ? t("Sidebar.UnpinChat") : t("Sidebar.PinChat"),
|
|
7128
|
+
label: session.pinned ? t("BiChat.Sidebar.UnpinChat") : t("BiChat.Sidebar.PinChat"),
|
|
7115
7129
|
icon: session.pinned ? /* @__PURE__ */ jsx(Check, { size: 20 }) : /* @__PURE__ */ jsx(Bookmark, { size: 20 }),
|
|
7116
7130
|
onClick: () => onPin()
|
|
7117
7131
|
}] : [],
|
|
7118
7132
|
...onRename ? [{
|
|
7119
7133
|
id: "rename",
|
|
7120
|
-
label: t("Sidebar.RenameChat"),
|
|
7134
|
+
label: t("BiChat.Sidebar.RenameChat"),
|
|
7121
7135
|
icon: /* @__PURE__ */ jsx(PencilSimple, { size: 20 }),
|
|
7122
7136
|
onClick: () => editableTitleRef.current?.startEditing()
|
|
7123
7137
|
}] : [],
|
|
7124
7138
|
...onRegenerateTitle ? [{
|
|
7125
7139
|
id: "regenerate",
|
|
7126
|
-
label: t("Sidebar.RegenerateTitle"),
|
|
7140
|
+
label: t("BiChat.Sidebar.RegenerateTitle"),
|
|
7127
7141
|
icon: /* @__PURE__ */ jsx(ArrowsClockwise, { size: 20 }),
|
|
7128
7142
|
onClick: () => onRegenerateTitle()
|
|
7129
7143
|
}] : [],
|
|
7130
7144
|
...onArchive ? [{
|
|
7131
7145
|
id: "archive",
|
|
7132
|
-
label: t("Sidebar.ArchiveChat"),
|
|
7146
|
+
label: t("BiChat.Sidebar.ArchiveChat"),
|
|
7133
7147
|
icon: /* @__PURE__ */ jsx(Archive, { size: 20 }),
|
|
7134
7148
|
onClick: () => onArchive(),
|
|
7135
7149
|
variant: "danger"
|
|
7136
7150
|
}] : [],
|
|
7137
7151
|
...onDelete ? [{
|
|
7138
7152
|
id: "delete",
|
|
7139
|
-
label: t("Sidebar.DeleteChat"),
|
|
7153
|
+
label: t("BiChat.Sidebar.DeleteChat"),
|
|
7140
7154
|
icon: /* @__PURE__ */ jsx(Trash, { size: 20 }),
|
|
7141
7155
|
onClick: () => onDelete(),
|
|
7142
7156
|
variant: "danger"
|
|
@@ -7153,11 +7167,18 @@ var SessionItem = memo(
|
|
|
7153
7167
|
whileHover: "hover",
|
|
7154
7168
|
exit: "exit",
|
|
7155
7169
|
children: /* @__PURE__ */ jsx(
|
|
7156
|
-
"
|
|
7170
|
+
"div",
|
|
7157
7171
|
{
|
|
7158
|
-
|
|
7172
|
+
role: "button",
|
|
7173
|
+
tabIndex: 0,
|
|
7159
7174
|
ref: itemRef,
|
|
7160
7175
|
onClick: () => onSelect(session.id),
|
|
7176
|
+
onKeyDown: (e) => {
|
|
7177
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
7178
|
+
e.preventDefault();
|
|
7179
|
+
onSelect(session.id);
|
|
7180
|
+
}
|
|
7181
|
+
},
|
|
7161
7182
|
className: `block w-full text-left px-3 py-2 rounded-lg transition-smooth group relative touch-tap cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/50 ${isActive ? "bg-primary-50/50 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 border-l-4 border-primary-400 dark:border-primary-600" : "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 border-l-4 border-transparent"} ${className}`,
|
|
7162
7183
|
"aria-current": isActive ? "page" : void 0,
|
|
7163
7184
|
"data-session-item": true,
|
|
@@ -7182,7 +7203,7 @@ var SessionItem = memo(
|
|
|
7182
7203
|
e.stopPropagation();
|
|
7183
7204
|
},
|
|
7184
7205
|
className: "opacity-0 group-hover:opacity-100 p-1.5 rounded hover:bg-gray-200 dark:hover:bg-gray-700 transition-smooth flex-shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/50",
|
|
7185
|
-
"aria-label": t("Sidebar.ChatOptions"),
|
|
7206
|
+
"aria-label": t("BiChat.Sidebar.ChatOptions"),
|
|
7186
7207
|
"data-testid": `${testIdPrefix}-session-options-${session.id}`,
|
|
7187
7208
|
children: /* @__PURE__ */ jsx(DotsThree, { size: 16, className: "w-4 h-4", weight: "bold" })
|
|
7188
7209
|
}
|
|
@@ -7202,11 +7223,11 @@ var SessionItem = memo(
|
|
|
7202
7223
|
onPin();
|
|
7203
7224
|
},
|
|
7204
7225
|
className: `cursor-pointer flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium text-gray-700 dark:text-gray-200 transition-smooth ${focus ? "bg-gray-100 dark:bg-gray-800/70 ring-1 ring-gray-200/80 dark:ring-gray-700/80" : "hover:bg-gray-50 dark:hover:bg-gray-800"}`,
|
|
7205
|
-
"aria-label": session.pinned ? t("Sidebar.UnpinChat") : t("Sidebar.PinChat"),
|
|
7226
|
+
"aria-label": session.pinned ? t("BiChat.Sidebar.UnpinChat") : t("BiChat.Sidebar.PinChat"),
|
|
7206
7227
|
"data-testid": `${testIdPrefix}-session-pin-${session.id}`,
|
|
7207
7228
|
children: [
|
|
7208
7229
|
session.pinned ? /* @__PURE__ */ jsx(Check, { size: 16, className: "w-4 h-4" }) : /* @__PURE__ */ jsx(Bookmark, { size: 16, className: "w-4 h-4" }),
|
|
7209
|
-
session.pinned ? t("Sidebar.UnpinChat") : t("Sidebar.PinChat")
|
|
7230
|
+
session.pinned ? t("BiChat.Sidebar.UnpinChat") : t("BiChat.Sidebar.PinChat")
|
|
7210
7231
|
]
|
|
7211
7232
|
}
|
|
7212
7233
|
) }),
|
|
@@ -7220,11 +7241,11 @@ var SessionItem = memo(
|
|
|
7220
7241
|
close();
|
|
7221
7242
|
},
|
|
7222
7243
|
className: `cursor-pointer flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium text-gray-700 dark:text-gray-200 transition-smooth ${focus ? "bg-gray-100 dark:bg-gray-800/70 ring-1 ring-gray-200/80 dark:ring-gray-700/80" : "hover:bg-gray-50 dark:hover:bg-gray-800"}`,
|
|
7223
|
-
"aria-label": t("Sidebar.RenameChat"),
|
|
7244
|
+
"aria-label": t("BiChat.Sidebar.RenameChat"),
|
|
7224
7245
|
"data-testid": `${testIdPrefix}-session-rename-${session.id}`,
|
|
7225
7246
|
children: [
|
|
7226
7247
|
/* @__PURE__ */ jsx(PencilSimple, { size: 16, className: "w-4 h-4" }),
|
|
7227
|
-
t("Sidebar.RenameChat")
|
|
7248
|
+
t("BiChat.Sidebar.RenameChat")
|
|
7228
7249
|
]
|
|
7229
7250
|
}
|
|
7230
7251
|
) }),
|
|
@@ -7238,11 +7259,11 @@ var SessionItem = memo(
|
|
|
7238
7259
|
close();
|
|
7239
7260
|
},
|
|
7240
7261
|
className: `cursor-pointer flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium text-gray-700 dark:text-gray-200 transition-smooth ${focus ? "bg-gray-100 dark:bg-gray-800/70 ring-1 ring-gray-200/80 dark:ring-gray-700/80" : "hover:bg-gray-50 dark:hover:bg-gray-800"}`,
|
|
7241
|
-
"aria-label": t("Sidebar.RegenerateTitle"),
|
|
7262
|
+
"aria-label": t("BiChat.Sidebar.RegenerateTitle"),
|
|
7242
7263
|
"data-testid": `${testIdPrefix}-session-regenerate-${session.id}`,
|
|
7243
7264
|
children: [
|
|
7244
7265
|
/* @__PURE__ */ jsx(ArrowsClockwise, { size: 16, className: "w-4 h-4" }),
|
|
7245
|
-
t("Sidebar.RegenerateTitle")
|
|
7266
|
+
t("BiChat.Sidebar.RegenerateTitle")
|
|
7246
7267
|
]
|
|
7247
7268
|
}
|
|
7248
7269
|
) }),
|
|
@@ -7255,11 +7276,11 @@ var SessionItem = memo(
|
|
|
7255
7276
|
onRestore();
|
|
7256
7277
|
},
|
|
7257
7278
|
className: `cursor-pointer flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium transition-smooth ${focus ? "text-green-700 dark:text-green-300 bg-green-50 dark:bg-green-900/20 ring-1 ring-green-200/70 dark:ring-green-500/30" : "text-green-700 dark:text-green-300 hover:bg-green-50/70 dark:hover:bg-green-900/10"}`,
|
|
7258
|
-
"aria-label": t("Archived.RestoreButton"),
|
|
7279
|
+
"aria-label": t("BiChat.Archived.RestoreButton"),
|
|
7259
7280
|
"data-testid": `${testIdPrefix}-session-restore-${session.id}`,
|
|
7260
7281
|
children: [
|
|
7261
7282
|
/* @__PURE__ */ jsx(ArrowUUpLeft, { size: 16, className: "w-4 h-4" }),
|
|
7262
|
-
t("Archived.RestoreButton")
|
|
7283
|
+
t("BiChat.Archived.RestoreButton")
|
|
7263
7284
|
]
|
|
7264
7285
|
}
|
|
7265
7286
|
) }),
|
|
@@ -7272,11 +7293,11 @@ var SessionItem = memo(
|
|
|
7272
7293
|
onArchive();
|
|
7273
7294
|
},
|
|
7274
7295
|
className: `cursor-pointer flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium transition-smooth ${focus ? "text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/20 ring-1 ring-amber-200/70 dark:ring-amber-500/30" : "text-amber-600 dark:text-amber-400 hover:bg-amber-50/70 dark:hover:bg-amber-900/10"}`,
|
|
7275
|
-
"aria-label": t("Sidebar.ArchiveChat"),
|
|
7296
|
+
"aria-label": t("BiChat.Sidebar.ArchiveChat"),
|
|
7276
7297
|
"data-testid": `${testIdPrefix}-session-archive-${session.id}`,
|
|
7277
7298
|
children: [
|
|
7278
7299
|
/* @__PURE__ */ jsx(Archive, { size: 16, className: "w-4 h-4" }),
|
|
7279
|
-
t("Sidebar.ArchiveChat")
|
|
7300
|
+
t("BiChat.Sidebar.ArchiveChat")
|
|
7280
7301
|
]
|
|
7281
7302
|
}
|
|
7282
7303
|
) }),
|
|
@@ -7289,11 +7310,11 @@ var SessionItem = memo(
|
|
|
7289
7310
|
onDelete();
|
|
7290
7311
|
},
|
|
7291
7312
|
className: `cursor-pointer flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium transition-smooth ${focus ? "text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/20 ring-1 ring-red-200/70 dark:ring-red-500/30" : "text-red-600 dark:text-red-400 hover:bg-red-50/70 dark:hover:bg-red-900/10"}`,
|
|
7292
|
-
"aria-label": t("Sidebar.DeleteChat"),
|
|
7313
|
+
"aria-label": t("BiChat.Sidebar.DeleteChat"),
|
|
7293
7314
|
"data-testid": `${testIdPrefix}-session-delete-${session.id}`,
|
|
7294
7315
|
children: [
|
|
7295
7316
|
/* @__PURE__ */ jsx(Trash, { size: 16, className: "w-4 h-4" }),
|
|
7296
|
-
t("Sidebar.DeleteChat")
|
|
7317
|
+
t("BiChat.Sidebar.DeleteChat")
|
|
7297
7318
|
]
|
|
7298
7319
|
}
|
|
7299
7320
|
) })
|
|
@@ -7369,7 +7390,7 @@ function TabBar({ tabs, activeTab, onTabChange }) {
|
|
|
7369
7390
|
"div",
|
|
7370
7391
|
{
|
|
7371
7392
|
ref: tablistRef,
|
|
7372
|
-
className: "flex gap-1 px-4 pt-4 pb-2 border-b border-gray-200 dark:border-gray-700",
|
|
7393
|
+
className: "flex justify-center gap-1 px-4 pt-4 pb-2 border-b border-gray-200 dark:border-gray-700",
|
|
7373
7394
|
role: "tablist",
|
|
7374
7395
|
onKeyDown: handleKeyDown,
|
|
7375
7396
|
children: tabs.map((tab) => /* @__PURE__ */ jsx(
|
|
@@ -7434,7 +7455,7 @@ function UserFilter({ users, selectedUser, onUserChange, loading }) {
|
|
|
7434
7455
|
disabled:opacity-50 disabled:cursor-not-allowed
|
|
7435
7456
|
flex items-center justify-between gap-2
|
|
7436
7457
|
`,
|
|
7437
|
-
"aria-label": t("
|
|
7458
|
+
"aria-label": t("BiChat.AllChats.AllUsers"),
|
|
7438
7459
|
children: [
|
|
7439
7460
|
selectedUser ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 min-w-0 flex-1", children: [
|
|
7440
7461
|
/* @__PURE__ */ jsx(
|
|
@@ -7451,7 +7472,7 @@ function UserFilter({ users, selectedUser, onUserChange, loading }) {
|
|
|
7451
7472
|
" ",
|
|
7452
7473
|
selectedUser.lastName
|
|
7453
7474
|
] })
|
|
7454
|
-
] }) : /* @__PURE__ */ jsx("span", { className: "text-gray-500 dark:text-gray-400", children: loading ? t("
|
|
7475
|
+
] }) : /* @__PURE__ */ jsx("span", { className: "text-gray-500 dark:text-gray-400", children: loading ? t("BiChat.AllChats.LoadingUsers") : t("BiChat.AllChats.AllUsers") }),
|
|
7455
7476
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 flex-shrink-0", children: [
|
|
7456
7477
|
selectedUser && /* @__PURE__ */ jsx(
|
|
7457
7478
|
"button",
|
|
@@ -7462,7 +7483,7 @@ function UserFilter({ users, selectedUser, onUserChange, loading }) {
|
|
|
7462
7483
|
onUserChange(null);
|
|
7463
7484
|
},
|
|
7464
7485
|
className: "cursor-pointer p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600 transition-smooth",
|
|
7465
|
-
"aria-label": t("Common.Clear"),
|
|
7486
|
+
"aria-label": t("BiChat.Common.Clear"),
|
|
7466
7487
|
children: /* @__PURE__ */ jsx(X, { size: 14, className: "w-3.5 h-3.5 text-gray-600 dark:text-gray-400" })
|
|
7467
7488
|
}
|
|
7468
7489
|
),
|
|
@@ -7493,7 +7514,7 @@ function UserFilter({ users, selectedUser, onUserChange, loading }) {
|
|
|
7493
7514
|
${focus ? "bg-gray-100 dark:bg-gray-700" : "hover:bg-gray-50 dark:hover:bg-gray-750"}
|
|
7494
7515
|
${!selectedUser ? "text-primary-700 dark:text-primary-400 font-medium" : "text-gray-900 dark:text-gray-100"}
|
|
7495
7516
|
`,
|
|
7496
|
-
children: t("
|
|
7517
|
+
children: t("BiChat.AllChats.AllUsers")
|
|
7497
7518
|
}
|
|
7498
7519
|
) }),
|
|
7499
7520
|
users.length > 0 && /* @__PURE__ */ jsx("div", { className: "border-t border-gray-200 dark:border-gray-700 my-1" }),
|
|
@@ -7526,7 +7547,7 @@ function UserFilter({ users, selectedUser, onUserChange, loading }) {
|
|
|
7526
7547
|
]
|
|
7527
7548
|
}
|
|
7528
7549
|
) }, user.id)),
|
|
7529
|
-
users.length === 0 && /* @__PURE__ */ jsx("div", { className: "px-3 py-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-
|
|
7550
|
+
users.length === 0 && /* @__PURE__ */ jsx("div", { className: "px-3 py-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-700 dark:text-gray-300", children: t("BiChat.AllChats.NoUsersFound") }) })
|
|
7530
7551
|
]
|
|
7531
7552
|
}
|
|
7532
7553
|
)
|
|
@@ -7591,7 +7612,7 @@ function AllChatsList({ dataSource, onSessionSelect, activeSessionId }) {
|
|
|
7591
7612
|
}
|
|
7592
7613
|
}).catch(() => {
|
|
7593
7614
|
if (!cancelled) {
|
|
7594
|
-
setError(t("
|
|
7615
|
+
setError(t("BiChat.AllChats.FailedToLoad"));
|
|
7595
7616
|
setFetching(false);
|
|
7596
7617
|
}
|
|
7597
7618
|
});
|
|
@@ -7657,12 +7678,12 @@ function AllChatsList({ dataSource, onSessionSelect, activeSessionId }) {
|
|
|
7657
7678
|
),
|
|
7658
7679
|
/* @__PURE__ */ jsxs("span", { className: "text-sm text-gray-700 dark:text-gray-300 flex items-center gap-1.5", children: [
|
|
7659
7680
|
/* @__PURE__ */ jsx(Archive, { size: 16, className: "w-4 h-4" }),
|
|
7660
|
-
t("
|
|
7681
|
+
t("BiChat.AllChats.IncludeArchived")
|
|
7661
7682
|
] })
|
|
7662
7683
|
] }),
|
|
7663
|
-
totalCount > 0 && /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: totalCount === 1 ? t("
|
|
7684
|
+
totalCount > 0 && /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: totalCount === 1 ? t("BiChat.AllChats.ChatFound", { count: totalCount }) : t("BiChat.AllChats.ChatsFound", { count: totalCount }) })
|
|
7664
7685
|
] }),
|
|
7665
|
-
/* @__PURE__ */ jsxs("nav", { className: "flex-1 overflow-y-auto px-2 pb-4 hide-scrollbar", "aria-label": t("
|
|
7686
|
+
/* @__PURE__ */ jsxs("nav", { className: "flex-1 overflow-y-auto px-2 pb-4 hide-scrollbar", "aria-label": t("BiChat.AllChats.OrganizationChats"), children: [
|
|
7666
7687
|
fetching && chats.length === 0 ? /* @__PURE__ */ jsx(SessionSkeleton, { count: 5 }) : /* @__PURE__ */ jsx(Fragment, { children: chats.length > 0 ? /* @__PURE__ */ jsxs(
|
|
7667
7688
|
motion.div,
|
|
7668
7689
|
{
|
|
@@ -7671,7 +7692,7 @@ function AllChatsList({ dataSource, onSessionSelect, activeSessionId }) {
|
|
|
7671
7692
|
initial: "hidden",
|
|
7672
7693
|
animate: "visible",
|
|
7673
7694
|
role: "list",
|
|
7674
|
-
"aria-label": t("
|
|
7695
|
+
"aria-label": t("BiChat.AllChats.OrganizationChatSessions"),
|
|
7675
7696
|
children: [
|
|
7676
7697
|
chats.map((chat) => /* @__PURE__ */ jsx(
|
|
7677
7698
|
motion.div,
|
|
@@ -7707,7 +7728,7 @@ function AllChatsList({ dataSource, onSessionSelect, activeSessionId }) {
|
|
|
7707
7728
|
}
|
|
7708
7729
|
),
|
|
7709
7730
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
7710
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium truncate", children: chat.title || t("Common.Untitled") }),
|
|
7731
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium truncate", children: chat.title || t("BiChat.Common.Untitled") }),
|
|
7711
7732
|
/* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-500 dark:text-gray-400 truncate", children: [
|
|
7712
7733
|
chat.owner.firstName,
|
|
7713
7734
|
" ",
|
|
@@ -7715,7 +7736,7 @@ function AllChatsList({ dataSource, onSessionSelect, activeSessionId }) {
|
|
|
7715
7736
|
] }),
|
|
7716
7737
|
chat.status === "archived" && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 mt-1 px-2 py-0.5 bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 rounded-full text-xs", children: [
|
|
7717
7738
|
/* @__PURE__ */ jsx(Archive, { size: 12, className: "w-3 h-3" }),
|
|
7718
|
-
t("Chat.Archived")
|
|
7739
|
+
t("BiChat.Chat.Archived")
|
|
7719
7740
|
] })
|
|
7720
7741
|
] })
|
|
7721
7742
|
] })
|
|
@@ -7729,7 +7750,7 @@ function AllChatsList({ dataSource, onSessionSelect, activeSessionId }) {
|
|
|
7729
7750
|
{
|
|
7730
7751
|
onClick: handleLoadMore,
|
|
7731
7752
|
className: "text-sm text-primary-600 dark:text-primary-400 hover:underline",
|
|
7732
|
-
children: t("
|
|
7753
|
+
children: t("BiChat.AllChats.LoadMore")
|
|
7733
7754
|
}
|
|
7734
7755
|
) })
|
|
7735
7756
|
]
|
|
@@ -7737,8 +7758,8 @@ function AllChatsList({ dataSource, onSessionSelect, activeSessionId }) {
|
|
|
7737
7758
|
) : /* @__PURE__ */ jsx(
|
|
7738
7759
|
MemoizedEmptyState,
|
|
7739
7760
|
{
|
|
7740
|
-
title: t("
|
|
7741
|
-
description: selectedUser ? t("
|
|
7761
|
+
title: t("BiChat.AllChats.NoChatsFound"),
|
|
7762
|
+
description: selectedUser ? t("BiChat.AllChats.NoChatsFromUser", { firstName: selectedUser.firstName, lastName: selectedUser.lastName }) : includeArchived ? t("BiChat.AllChats.NoChatsInOrg") : t("BiChat.AllChats.NoActiveChatsInOrg")
|
|
7742
7763
|
}
|
|
7743
7764
|
) }),
|
|
7744
7765
|
error && /* @__PURE__ */ jsx("div", { className: "mx-2 mt-4 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-red-600 dark:text-red-400", children: error }) })
|
|
@@ -7782,11 +7803,11 @@ function groupSessionsByDate(sessions, t) {
|
|
|
7782
7803
|
const today = startOfDay(now);
|
|
7783
7804
|
const translate = t || ((key2) => key2);
|
|
7784
7805
|
const dateLabels = {
|
|
7785
|
-
"Today": translate("DateGroup.Today"),
|
|
7786
|
-
"Yesterday": translate("DateGroup.Yesterday"),
|
|
7787
|
-
"Last 7 Days": translate("DateGroup.Last7Days"),
|
|
7788
|
-
"Last 30 Days": translate("DateGroup.Last30Days"),
|
|
7789
|
-
"Older": translate("DateGroup.Older")
|
|
7806
|
+
"Today": translate("BiChat.DateGroup.Today"),
|
|
7807
|
+
"Yesterday": translate("BiChat.DateGroup.Yesterday"),
|
|
7808
|
+
"Last 7 Days": translate("BiChat.DateGroup.Last7Days"),
|
|
7809
|
+
"Last 30 Days": translate("BiChat.DateGroup.Last30Days"),
|
|
7810
|
+
"Older": translate("BiChat.DateGroup.Older")
|
|
7790
7811
|
};
|
|
7791
7812
|
const groupMap = /* @__PURE__ */ new Map([
|
|
7792
7813
|
["Today", []],
|
|
@@ -7850,9 +7871,9 @@ function Sidebar2({
|
|
|
7850
7871
|
const [showConfirm, setShowConfirm] = useState(false);
|
|
7851
7872
|
const [sessionToArchive, setSessionToArchive] = useState(null);
|
|
7852
7873
|
const tabs = useMemo(() => {
|
|
7853
|
-
const items = [{ id: "my-chats", label: t("Sidebar.MyChats") }];
|
|
7874
|
+
const items = [{ id: "my-chats", label: t("BiChat.Sidebar.MyChats") }];
|
|
7854
7875
|
if (showAllChatsTab) {
|
|
7855
|
-
items.push({ id: "all-chats", label: t("Sidebar.AllChats") });
|
|
7876
|
+
items.push({ id: "all-chats", label: t("BiChat.Sidebar.AllChats") });
|
|
7856
7877
|
}
|
|
7857
7878
|
return items;
|
|
7858
7879
|
}, [showAllChatsTab, t]);
|
|
@@ -7864,7 +7885,7 @@ function Sidebar2({
|
|
|
7864
7885
|
setSessions(result.sessions);
|
|
7865
7886
|
} catch (err) {
|
|
7866
7887
|
console.error("Failed to load sessions:", err);
|
|
7867
|
-
setError(t("Sidebar.FailedToLoadSessions"));
|
|
7888
|
+
setError(t("BiChat.Sidebar.FailedToLoadSessions"));
|
|
7868
7889
|
} finally {
|
|
7869
7890
|
setLoading(false);
|
|
7870
7891
|
}
|
|
@@ -7873,7 +7894,7 @@ function Sidebar2({
|
|
|
7873
7894
|
fetchSessions();
|
|
7874
7895
|
}, [fetchSessions, refreshKey]);
|
|
7875
7896
|
const hasPlaceholderTitles = useMemo(() => {
|
|
7876
|
-
const newChatLabel = t("Chat.NewChat");
|
|
7897
|
+
const newChatLabel = t("BiChat.Chat.NewChat");
|
|
7877
7898
|
return Array.isArray(sessions) && sessions.some((s) => s && (!s.title || s.title === newChatLabel));
|
|
7878
7899
|
}, [sessions, t]);
|
|
7879
7900
|
useEffect(() => {
|
|
@@ -7909,7 +7930,7 @@ function Sidebar2({
|
|
|
7909
7930
|
}
|
|
7910
7931
|
} catch (err) {
|
|
7911
7932
|
console.error("Failed to archive session:", err);
|
|
7912
|
-
toast.error(t("Sidebar.FailedToArchiveChat"));
|
|
7933
|
+
toast.error(t("BiChat.Sidebar.FailedToArchiveChat"));
|
|
7913
7934
|
} finally {
|
|
7914
7935
|
setShowConfirm(false);
|
|
7915
7936
|
setSessionToArchive(null);
|
|
@@ -7925,27 +7946,27 @@ function Sidebar2({
|
|
|
7925
7946
|
setRefreshKey((k) => k + 1);
|
|
7926
7947
|
} catch (err) {
|
|
7927
7948
|
console.error("Failed to toggle pin:", err);
|
|
7928
|
-
toast.error(t("Sidebar.FailedToTogglePin"));
|
|
7949
|
+
toast.error(t("BiChat.Sidebar.FailedToTogglePin"));
|
|
7929
7950
|
}
|
|
7930
7951
|
};
|
|
7931
7952
|
const handleRenameSession = async (sessionId, newTitle) => {
|
|
7932
7953
|
try {
|
|
7933
7954
|
await dataSource.renameSession(sessionId, newTitle);
|
|
7934
|
-
toast.success(t("Sidebar.ChatRenamedSuccessfully"));
|
|
7955
|
+
toast.success(t("BiChat.Sidebar.ChatRenamedSuccessfully"));
|
|
7935
7956
|
setRefreshKey((k) => k + 1);
|
|
7936
7957
|
} catch (err) {
|
|
7937
7958
|
console.error("Failed to update session title:", err);
|
|
7938
|
-
toast.error(t("Sidebar.FailedToRenameChat"));
|
|
7959
|
+
toast.error(t("BiChat.Sidebar.FailedToRenameChat"));
|
|
7939
7960
|
}
|
|
7940
7961
|
};
|
|
7941
7962
|
const handleRegenerateTitle = async (sessionId) => {
|
|
7942
7963
|
try {
|
|
7943
7964
|
await dataSource.regenerateSessionTitle(sessionId);
|
|
7944
|
-
toast.success(t("Sidebar.TitleRegenerated"));
|
|
7965
|
+
toast.success(t("BiChat.Sidebar.TitleRegenerated"));
|
|
7945
7966
|
setRefreshKey((k) => k + 1);
|
|
7946
7967
|
} catch (err) {
|
|
7947
7968
|
console.error("Failed to regenerate title:", err);
|
|
7948
|
-
toast.error(t("Sidebar.FailedToRegenerateTitle"));
|
|
7969
|
+
toast.error(t("BiChat.Sidebar.FailedToRegenerateTitle"));
|
|
7949
7970
|
}
|
|
7950
7971
|
};
|
|
7951
7972
|
const filteredSessions = useMemo(() => {
|
|
@@ -8010,17 +8031,17 @@ function Sidebar2({
|
|
|
8010
8031
|
{
|
|
8011
8032
|
className: `w-64 bg-surface-300 dark:bg-gray-900 border-r border-gray-200 dark:border-gray-700 h-full min-h-0 flex flex-col overflow-hidden ${className}`,
|
|
8012
8033
|
role: "navigation",
|
|
8013
|
-
"aria-label": t("Sidebar.ChatSessions"),
|
|
8034
|
+
"aria-label": t("BiChat.Sidebar.ChatSessions"),
|
|
8014
8035
|
children: [
|
|
8015
|
-
/* @__PURE__ */ jsxs("div", { className: "p-4 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between", children: [
|
|
8036
|
+
(headerSlot || onClose) && /* @__PURE__ */ jsxs("div", { className: "p-4 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between", children: [
|
|
8016
8037
|
headerSlot,
|
|
8017
8038
|
onClose && /* @__PURE__ */ jsx(
|
|
8018
8039
|
motion.button,
|
|
8019
8040
|
{
|
|
8020
8041
|
onClick: onClose,
|
|
8021
8042
|
className: "cursor-pointer p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-smooth text-gray-600 dark:text-gray-400",
|
|
8022
|
-
title: t("Sidebar.CloseSidebar"),
|
|
8023
|
-
"aria-label": t("Sidebar.CloseSidebar"),
|
|
8043
|
+
title: t("BiChat.Sidebar.CloseSidebar"),
|
|
8044
|
+
"aria-label": t("BiChat.Sidebar.CloseSidebar"),
|
|
8024
8045
|
whileHover: "hover",
|
|
8025
8046
|
whileTap: "tap",
|
|
8026
8047
|
variants: buttonVariants,
|
|
@@ -8044,12 +8065,12 @@ function Sidebar2({
|
|
|
8044
8065
|
activeSessionId
|
|
8045
8066
|
}
|
|
8046
8067
|
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8047
|
-
/* @__PURE__ */ jsx("div", { className: "mt-3", children: /* @__PURE__ */ jsx(
|
|
8068
|
+
/* @__PURE__ */ jsx("div", { className: "mt-3 px-4", children: /* @__PURE__ */ jsx(
|
|
8048
8069
|
SearchInput_default,
|
|
8049
8070
|
{
|
|
8050
8071
|
value: searchQuery,
|
|
8051
8072
|
onChange: setSearchQuery,
|
|
8052
|
-
placeholder: t("Sidebar.SearchChats")
|
|
8073
|
+
placeholder: t("BiChat.Sidebar.SearchChats")
|
|
8053
8074
|
}
|
|
8054
8075
|
) }),
|
|
8055
8076
|
/* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsx(
|
|
@@ -8058,13 +8079,13 @@ function Sidebar2({
|
|
|
8058
8079
|
onClick: onNewChat,
|
|
8059
8080
|
disabled: creating || loading,
|
|
8060
8081
|
className: "cursor-pointer w-full px-4 py-3 bg-primary-600 dark:bg-primary-700 text-white rounded-lg hover:bg-primary-700 dark:hover:bg-primary-800 transition-smooth font-medium disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",
|
|
8061
|
-
title: t("Chat.NewChat"),
|
|
8062
|
-
"aria-label": t("Sidebar.CreateNewChat"),
|
|
8082
|
+
title: t("BiChat.Chat.NewChat"),
|
|
8083
|
+
"aria-label": t("BiChat.Sidebar.CreateNewChat"),
|
|
8063
8084
|
whileHover: shouldReduceMotion ? {} : { scale: 1.02 },
|
|
8064
8085
|
whileTap: shouldReduceMotion ? {} : { scale: 0.95 },
|
|
8065
8086
|
children: creating ? /* @__PURE__ */ jsx(LoadingSpinner_default, { variant: "spinner", size: "sm" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8066
8087
|
/* @__PURE__ */ jsx(Plus, { size: 20, className: "w-5 h-5" }),
|
|
8067
|
-
/* @__PURE__ */ jsx("span", { className: "ml-2", children: t("Chat.NewChat") })
|
|
8088
|
+
/* @__PURE__ */ jsx("span", { className: "ml-2", children: t("BiChat.Chat.NewChat") })
|
|
8068
8089
|
] })
|
|
8069
8090
|
}
|
|
8070
8091
|
) }),
|
|
@@ -8073,10 +8094,10 @@ function Sidebar2({
|
|
|
8073
8094
|
{
|
|
8074
8095
|
onClick: onArchivedView,
|
|
8075
8096
|
className: "cursor-pointer flex items-center gap-2 px-3 py-2 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-smooth text-sm font-medium w-full",
|
|
8076
|
-
title: t("Sidebar.ArchivedChats"),
|
|
8097
|
+
title: t("BiChat.Sidebar.ArchivedChats"),
|
|
8077
8098
|
children: [
|
|
8078
8099
|
/* @__PURE__ */ jsx(Archive, { size: 18, className: "w-4.5 h-4.5" }),
|
|
8079
|
-
/* @__PURE__ */ jsx("span", { children: t("Sidebar.ArchivedChats") })
|
|
8100
|
+
/* @__PURE__ */ jsx("span", { children: t("BiChat.Sidebar.ArchivedChats") })
|
|
8080
8101
|
]
|
|
8081
8102
|
}
|
|
8082
8103
|
) }),
|
|
@@ -8085,7 +8106,7 @@ function Sidebar2({
|
|
|
8085
8106
|
{
|
|
8086
8107
|
ref: sessionListRef,
|
|
8087
8108
|
className: "flex-1 overflow-y-auto px-2 pb-4 hide-scrollbar",
|
|
8088
|
-
"aria-label": "
|
|
8109
|
+
"aria-label": t("BiChat.Sidebar.ChatHistory"),
|
|
8089
8110
|
onKeyDown: handleSessionListKeyDown,
|
|
8090
8111
|
children: [
|
|
8091
8112
|
loading && sessions.length === 0 ? /* @__PURE__ */ jsx(SessionSkeleton, { count: 5 }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -8093,7 +8114,7 @@ function Sidebar2({
|
|
|
8093
8114
|
/* @__PURE__ */ jsx(
|
|
8094
8115
|
DateGroupHeader,
|
|
8095
8116
|
{
|
|
8096
|
-
groupName: t("Common.Pinned"),
|
|
8117
|
+
groupName: t("BiChat.Common.Pinned"),
|
|
8097
8118
|
count: pinnedSessions.length
|
|
8098
8119
|
}
|
|
8099
8120
|
),
|
|
@@ -8105,7 +8126,7 @@ function Sidebar2({
|
|
|
8105
8126
|
initial: "hidden",
|
|
8106
8127
|
animate: "visible",
|
|
8107
8128
|
role: "list",
|
|
8108
|
-
"aria-label": t("Sidebar.PinnedChats"),
|
|
8129
|
+
"aria-label": t("BiChat.Sidebar.PinnedChats"),
|
|
8109
8130
|
children: pinnedSessions.map((session) => /* @__PURE__ */ jsx(
|
|
8110
8131
|
SessionItem_default,
|
|
8111
8132
|
{
|
|
@@ -8159,14 +8180,14 @@ function Sidebar2({
|
|
|
8159
8180
|
filteredSessions.length === 0 && !loading && /* @__PURE__ */ jsx(
|
|
8160
8181
|
MemoizedEmptyState,
|
|
8161
8182
|
{
|
|
8162
|
-
title: searchQuery ? t("Sidebar.NoChatsFound", { query: searchQuery }) : t("Sidebar.NoChatsYet"),
|
|
8163
|
-
description: searchQuery ? void 0 : t("Sidebar.CreateOneToGetStarted"),
|
|
8183
|
+
title: searchQuery ? t("BiChat.Sidebar.NoChatsFound", { query: searchQuery }) : t("BiChat.Sidebar.NoChatsYet"),
|
|
8184
|
+
description: searchQuery ? void 0 : t("BiChat.Sidebar.CreateOneToGetStarted"),
|
|
8164
8185
|
action: searchQuery ? /* @__PURE__ */ jsx(
|
|
8165
8186
|
"button",
|
|
8166
8187
|
{
|
|
8167
8188
|
onClick: () => setSearchQuery(""),
|
|
8168
8189
|
className: "cursor-pointer text-sm text-primary-600 dark:text-primary-400 hover:underline",
|
|
8169
|
-
children: t("Common.Clear")
|
|
8190
|
+
children: t("BiChat.Common.Clear")
|
|
8170
8191
|
}
|
|
8171
8192
|
) : void 0
|
|
8172
8193
|
}
|
|
@@ -8185,11 +8206,11 @@ function Sidebar2({
|
|
|
8185
8206
|
ConfirmModal_default,
|
|
8186
8207
|
{
|
|
8187
8208
|
isOpen: showConfirm,
|
|
8188
|
-
title: t("Sidebar.ArchiveChatSession"),
|
|
8189
|
-
message: t("Sidebar.ArchiveChatMessage"),
|
|
8190
|
-
confirmText: t("Sidebar.ArchiveButton"),
|
|
8191
|
-
cancelText: t("Common.Cancel"),
|
|
8192
|
-
isDanger:
|
|
8209
|
+
title: t("BiChat.Sidebar.ArchiveChatSession"),
|
|
8210
|
+
message: t("BiChat.Sidebar.ArchiveChatMessage"),
|
|
8211
|
+
confirmText: t("BiChat.Sidebar.ArchiveButton"),
|
|
8212
|
+
cancelText: t("BiChat.Common.Cancel"),
|
|
8213
|
+
isDanger: true,
|
|
8193
8214
|
onConfirm: confirmArchive,
|
|
8194
8215
|
onCancel: () => {
|
|
8195
8216
|
setShowConfirm(false);
|
|
@@ -8245,10 +8266,10 @@ function ArchivedChatList({
|
|
|
8245
8266
|
try {
|
|
8246
8267
|
await dataSource.unarchiveSession(sessionToRestore);
|
|
8247
8268
|
setRefreshKey((k) => k + 1);
|
|
8248
|
-
toast.success(t("Archived.ChatRestoredSuccessfully"));
|
|
8269
|
+
toast.success(t("BiChat.Archived.ChatRestoredSuccessfully"));
|
|
8249
8270
|
} catch (err) {
|
|
8250
8271
|
console.error("Failed to restore session:", err);
|
|
8251
|
-
toast.error(t("Archived.FailedToRestoreChat"));
|
|
8272
|
+
toast.error(t("BiChat.Archived.FailedToRestoreChat"));
|
|
8252
8273
|
} finally {
|
|
8253
8274
|
setShowConfirm(false);
|
|
8254
8275
|
setSessionToRestore(null);
|
|
@@ -8257,11 +8278,11 @@ function ArchivedChatList({
|
|
|
8257
8278
|
const handleRenameSession = async (sessionId, newTitle) => {
|
|
8258
8279
|
try {
|
|
8259
8280
|
await dataSource.renameSession(sessionId, newTitle);
|
|
8260
|
-
toast.success(t("Sidebar.ChatRenamedSuccessfully"));
|
|
8281
|
+
toast.success(t("BiChat.Sidebar.ChatRenamedSuccessfully"));
|
|
8261
8282
|
setRefreshKey((k) => k + 1);
|
|
8262
8283
|
} catch (err) {
|
|
8263
8284
|
console.error("Failed to update session title:", err);
|
|
8264
|
-
toast.error(t("Sidebar.FailedToRenameChat"));
|
|
8285
|
+
toast.error(t("BiChat.Sidebar.FailedToRenameChat"));
|
|
8265
8286
|
}
|
|
8266
8287
|
};
|
|
8267
8288
|
const filteredSessions = useMemo(() => {
|
|
@@ -8289,10 +8310,10 @@ function ArchivedChatList({
|
|
|
8289
8310
|
{
|
|
8290
8311
|
onClick: onBack,
|
|
8291
8312
|
className: "inline-flex items-center gap-2 px-3 py-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors text-gray-600 dark:text-gray-400",
|
|
8292
|
-
"aria-label": t("Archived.BackToChats"),
|
|
8313
|
+
"aria-label": t("BiChat.Archived.BackToChats"),
|
|
8293
8314
|
children: [
|
|
8294
8315
|
/* @__PURE__ */ jsx(ArrowLeft, { size: 20, className: "w-5 h-5" }),
|
|
8295
|
-
t("Common.Back")
|
|
8316
|
+
t("BiChat.Common.Back")
|
|
8296
8317
|
]
|
|
8297
8318
|
}
|
|
8298
8319
|
) }),
|
|
@@ -8304,14 +8325,14 @@ function ArchivedChatList({
|
|
|
8304
8325
|
className: "w-6 h-6 text-gray-600 dark:text-gray-400"
|
|
8305
8326
|
}
|
|
8306
8327
|
),
|
|
8307
|
-
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: t("Archived.Title") })
|
|
8328
|
+
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: t("BiChat.Archived.Title") })
|
|
8308
8329
|
] }),
|
|
8309
8330
|
/* @__PURE__ */ jsx(
|
|
8310
8331
|
SearchInput_default,
|
|
8311
8332
|
{
|
|
8312
8333
|
value: searchQuery,
|
|
8313
8334
|
onChange: setSearchQuery,
|
|
8314
|
-
placeholder: t("Archived.SearchArchivedChats")
|
|
8335
|
+
placeholder: t("BiChat.Archived.SearchArchivedChats")
|
|
8315
8336
|
}
|
|
8316
8337
|
)
|
|
8317
8338
|
] }),
|
|
@@ -8325,8 +8346,8 @@ function ArchivedChatList({
|
|
|
8325
8346
|
className: "text-gray-400 dark:text-gray-500"
|
|
8326
8347
|
}
|
|
8327
8348
|
),
|
|
8328
|
-
title: t("Archived.NoArchivedChats"),
|
|
8329
|
-
description: t("Archived.NoArchivedChatsDescription")
|
|
8349
|
+
title: t("BiChat.Archived.NoArchivedChats"),
|
|
8350
|
+
description: t("BiChat.Archived.NoArchivedChatsDescription")
|
|
8330
8351
|
}
|
|
8331
8352
|
) }) : isEmptyAfterSearch ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-full px-6", children: /* @__PURE__ */ jsx(
|
|
8332
8353
|
MemoizedEmptyState,
|
|
@@ -8338,8 +8359,8 @@ function ArchivedChatList({
|
|
|
8338
8359
|
className: "text-gray-400 dark:text-gray-500"
|
|
8339
8360
|
}
|
|
8340
8361
|
),
|
|
8341
|
-
title: t("Archived.NoResults"),
|
|
8342
|
-
description: t("Archived.NoResultsDescription", {
|
|
8362
|
+
title: t("BiChat.Archived.NoResults"),
|
|
8363
|
+
description: t("BiChat.Archived.NoResultsDescription", {
|
|
8343
8364
|
query: searchQuery
|
|
8344
8365
|
})
|
|
8345
8366
|
}
|
|
@@ -8377,10 +8398,10 @@ function ArchivedChatList({
|
|
|
8377
8398
|
ConfirmModal_default,
|
|
8378
8399
|
{
|
|
8379
8400
|
isOpen: showConfirm,
|
|
8380
|
-
title: t("Archived.RestoreChat"),
|
|
8381
|
-
message: t("Archived.RestoreChatMessage"),
|
|
8382
|
-
confirmText: t("Archived.RestoreButton"),
|
|
8383
|
-
cancelText: t("Common.Cancel"),
|
|
8401
|
+
title: t("BiChat.Archived.RestoreChat"),
|
|
8402
|
+
message: t("BiChat.Archived.RestoreChatMessage"),
|
|
8403
|
+
confirmText: t("BiChat.Archived.RestoreButton"),
|
|
8404
|
+
cancelText: t("BiChat.Common.Cancel"),
|
|
8384
8405
|
isDanger: false,
|
|
8385
8406
|
onConfirm: confirmRestore,
|
|
8386
8407
|
onCancel: () => {
|
|
@@ -8466,7 +8487,7 @@ function Alert({
|
|
|
8466
8487
|
{
|
|
8467
8488
|
onClick: onRetry,
|
|
8468
8489
|
className: `mt-2 text-xs px-3 py-1.5 rounded ${styles.retryButton} transition-colors font-medium`,
|
|
8469
|
-
children: t("Chat.Retry")
|
|
8490
|
+
children: t("BiChat.Chat.Retry")
|
|
8470
8491
|
}
|
|
8471
8492
|
)
|
|
8472
8493
|
] })
|
|
@@ -8476,7 +8497,7 @@ function Alert({
|
|
|
8476
8497
|
{
|
|
8477
8498
|
onClick: onDismiss,
|
|
8478
8499
|
className: `${styles.button} transition-colors flex-shrink-0`,
|
|
8479
|
-
"aria-label": t("Chat.DismissNotification"),
|
|
8500
|
+
"aria-label": t("BiChat.Chat.DismissNotification"),
|
|
8480
8501
|
children: /* @__PURE__ */ jsx(X, { size: 20, className: "w-5 h-5" })
|
|
8481
8502
|
}
|
|
8482
8503
|
)
|
|
@@ -8485,12 +8506,14 @@ function Alert({
|
|
|
8485
8506
|
) });
|
|
8486
8507
|
}
|
|
8487
8508
|
var Alert_default = memo(Alert);
|
|
8509
|
+
init_useTranslation();
|
|
8488
8510
|
function ArchiveBanner({
|
|
8489
8511
|
show = true,
|
|
8490
8512
|
onRestore,
|
|
8491
8513
|
restoring = false,
|
|
8492
8514
|
onRestoreComplete
|
|
8493
8515
|
}) {
|
|
8516
|
+
const { t } = useTranslation();
|
|
8494
8517
|
const [error, setError] = useState(null);
|
|
8495
8518
|
const handleRestore = async () => {
|
|
8496
8519
|
try {
|
|
@@ -8502,7 +8525,7 @@ function ArchiveBanner({
|
|
|
8502
8525
|
onRestoreComplete();
|
|
8503
8526
|
}
|
|
8504
8527
|
} catch (err) {
|
|
8505
|
-
const message = err instanceof Error ? err.message : "
|
|
8528
|
+
const message = err instanceof Error ? err.message : t("BiChat.Archive.RestoreFailed");
|
|
8506
8529
|
setError(message);
|
|
8507
8530
|
}
|
|
8508
8531
|
};
|
|
@@ -8516,11 +8539,11 @@ function ArchiveBanner({
|
|
|
8516
8539
|
exit: "exit",
|
|
8517
8540
|
className: "border-t border border-blue-200 bg-blue-50 dark:bg-blue-900/20 px-4 py-3",
|
|
8518
8541
|
role: "region",
|
|
8519
|
-
"aria-label": "Archive
|
|
8542
|
+
"aria-label": t("BiChat.Archive.Banner"),
|
|
8520
8543
|
children: /* @__PURE__ */ jsxs("div", { className: "w-full flex items-start justify-between px-4", children: [
|
|
8521
8544
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 flex-1", children: [
|
|
8522
8545
|
/* @__PURE__ */ jsx(Archive, { size: 20, className: "w-5 h-5 text-blue-600 dark:text-blue-400 flex-shrink-0 mt-0.5" }),
|
|
8523
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-blue-700 dark:text-blue-400", children: "
|
|
8546
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-blue-700 dark:text-blue-400", children: t("BiChat.Archive.Archived") }) })
|
|
8524
8547
|
] }),
|
|
8525
8548
|
/* @__PURE__ */ jsx(
|
|
8526
8549
|
"button",
|
|
@@ -8528,11 +8551,11 @@ function ArchiveBanner({
|
|
|
8528
8551
|
onClick: handleRestore,
|
|
8529
8552
|
disabled: restoring,
|
|
8530
8553
|
className: "ml-2 flex-shrink-0 px-3 py-1.5 text-xs font-medium bg-blue-600 dark:bg-blue-700 hover:bg-blue-700 dark:hover:bg-blue-800 text-white rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-1.5",
|
|
8531
|
-
"aria-label": "Restore
|
|
8554
|
+
"aria-label": t("BiChat.Archive.Restore"),
|
|
8532
8555
|
children: restoring ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8533
8556
|
/* @__PURE__ */ jsx(Spinner, { size: 16, className: "w-4 h-4 animate-spin" }),
|
|
8534
|
-
"Restoring
|
|
8535
|
-
] }) : "Restore"
|
|
8557
|
+
t("BiChat.Archive.Restoring")
|
|
8558
|
+
] }) : t("BiChat.Archive.Restore")
|
|
8536
8559
|
}
|
|
8537
8560
|
)
|
|
8538
8561
|
] })
|
|
@@ -8543,7 +8566,7 @@ function ArchiveBanner({
|
|
|
8543
8566
|
{
|
|
8544
8567
|
variant: "error",
|
|
8545
8568
|
message: error,
|
|
8546
|
-
title: "
|
|
8569
|
+
title: t("BiChat.Archive.RestoreFailed"),
|
|
8547
8570
|
onDismiss: () => setError(null),
|
|
8548
8571
|
dismissible: true
|
|
8549
8572
|
}
|
|
@@ -8583,17 +8606,17 @@ var RetryActionArea = memo(function RetryActionArea2({
|
|
|
8583
8606
|
weight: "fill"
|
|
8584
8607
|
}
|
|
8585
8608
|
),
|
|
8586
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm text-gray-700 dark:text-gray-300", children: t("Retry.
|
|
8609
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-gray-700 dark:text-gray-300", children: t("BiChat.Retry.Subtitle") })
|
|
8587
8610
|
] }),
|
|
8588
8611
|
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxs(
|
|
8589
8612
|
"button",
|
|
8590
8613
|
{
|
|
8591
8614
|
onClick: onRetry,
|
|
8592
8615
|
className: "cursor-pointer inline-flex items-center gap-1.5 px-4 py-2 text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 dark:bg-primary-700 dark:hover:bg-primary-600 rounded-lg transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/50 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-gray-800",
|
|
8593
|
-
"aria-label": t("Retry.Title"),
|
|
8616
|
+
"aria-label": t("BiChat.Retry.Title"),
|
|
8594
8617
|
children: [
|
|
8595
8618
|
/* @__PURE__ */ jsx(ArrowClockwise, { size: 16, className: "w-4 h-4" }),
|
|
8596
|
-
t("Retry.Button")
|
|
8619
|
+
t("BiChat.Retry.Button")
|
|
8597
8620
|
]
|
|
8598
8621
|
}
|
|
8599
8622
|
) })
|
|
@@ -8631,7 +8654,7 @@ function StreamError({
|
|
|
8631
8654
|
}
|
|
8632
8655
|
),
|
|
8633
8656
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
8634
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-red-800 dark:text-red-200", children: t("Error.Generic") }),
|
|
8657
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-red-800 dark:text-red-200", children: t("BiChat.Error.Generic") }),
|
|
8635
8658
|
/* @__PURE__ */ jsx("p", { className: "text-sm text-red-600 dark:text-red-300 break-words", children: error })
|
|
8636
8659
|
] }),
|
|
8637
8660
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-shrink-0", children: [
|
|
@@ -8643,7 +8666,7 @@ function StreamError({
|
|
|
8643
8666
|
type: "button",
|
|
8644
8667
|
children: [
|
|
8645
8668
|
/* @__PURE__ */ jsx(ArrowClockwise, { className: "w-4 h-4" }),
|
|
8646
|
-
t("
|
|
8669
|
+
t("BiChat.StreamError.Retry")
|
|
8647
8670
|
]
|
|
8648
8671
|
}
|
|
8649
8672
|
),
|
|
@@ -8655,7 +8678,7 @@ function StreamError({
|
|
|
8655
8678
|
type: "button",
|
|
8656
8679
|
children: [
|
|
8657
8680
|
/* @__PURE__ */ jsx(ArrowsCounterClockwise, { className: "w-4 h-4" }),
|
|
8658
|
-
t("
|
|
8681
|
+
t("BiChat.StreamError.Regenerate")
|
|
8659
8682
|
]
|
|
8660
8683
|
}
|
|
8661
8684
|
)
|
|
@@ -8664,6 +8687,7 @@ function StreamError({
|
|
|
8664
8687
|
}
|
|
8665
8688
|
);
|
|
8666
8689
|
}
|
|
8690
|
+
init_useTranslation();
|
|
8667
8691
|
function MessageActions({
|
|
8668
8692
|
message,
|
|
8669
8693
|
onCopy,
|
|
@@ -8673,14 +8697,15 @@ function MessageActions({
|
|
|
8673
8697
|
const [copying, setCopying] = useState(false);
|
|
8674
8698
|
const [regenerating, setRegenerating] = useState(false);
|
|
8675
8699
|
const toast = useToast();
|
|
8700
|
+
const { t } = useTranslation();
|
|
8676
8701
|
const isUser = message.role === "user" /* User */;
|
|
8677
8702
|
const handleCopy = async () => {
|
|
8678
8703
|
setCopying(true);
|
|
8679
8704
|
try {
|
|
8680
8705
|
await onCopy(message.content);
|
|
8681
|
-
toast.success("
|
|
8706
|
+
toast.success(t("BiChat.Message.CopiedToClipboard"));
|
|
8682
8707
|
} catch {
|
|
8683
|
-
toast.error("
|
|
8708
|
+
toast.error(t("BiChat.Message.FailedToCopy"));
|
|
8684
8709
|
} finally {
|
|
8685
8710
|
setCopying(false);
|
|
8686
8711
|
}
|
|
@@ -8700,9 +8725,9 @@ function MessageActions({
|
|
|
8700
8725
|
{
|
|
8701
8726
|
onClick: handleCopy,
|
|
8702
8727
|
disabled: copying,
|
|
8703
|
-
title: copying ? "Copying
|
|
8728
|
+
title: copying ? t("BiChat.Message.Copying") : t("BiChat.Message.CopyMessage"),
|
|
8704
8729
|
className: "cursor-pointer text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-700 dark:hover:text-gray-300 rounded-md transition-colors disabled:opacity-50 p-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/50",
|
|
8705
|
-
"aria-label": copying ? "Copying
|
|
8730
|
+
"aria-label": copying ? t("BiChat.Message.Copying") : t("BiChat.Message.CopyMessage"),
|
|
8706
8731
|
children: copying ? /* @__PURE__ */ jsx(LoadingSpinner_default, { variant: "spinner", size: "sm" }) : /* @__PURE__ */ jsx(Copy, { size: 16, className: "w-4 h-4" })
|
|
8707
8732
|
}
|
|
8708
8733
|
),
|
|
@@ -8711,9 +8736,9 @@ function MessageActions({
|
|
|
8711
8736
|
{
|
|
8712
8737
|
onClick: handleRegenerate,
|
|
8713
8738
|
disabled: regenerating,
|
|
8714
|
-
title: regenerating ? "Regenerating
|
|
8739
|
+
title: regenerating ? t("BiChat.Message.Regenerating") : t("BiChat.Message.Regenerate"),
|
|
8715
8740
|
className: "cursor-pointer text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-700 dark:hover:text-gray-300 rounded-md transition-colors disabled:opacity-50 p-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/50",
|
|
8716
|
-
"aria-label": regenerating ? "Regenerating
|
|
8741
|
+
"aria-label": regenerating ? t("BiChat.Message.Regenerating") : t("BiChat.Message.Regenerate"),
|
|
8717
8742
|
children: regenerating ? /* @__PURE__ */ jsx(LoadingSpinner_default, { variant: "spinner", size: "sm" }) : /* @__PURE__ */ jsx(ArrowClockwise, { size: 16, className: "w-4 h-4" })
|
|
8718
8743
|
}
|
|
8719
8744
|
),
|
|
@@ -8721,16 +8746,18 @@ function MessageActions({
|
|
|
8721
8746
|
"button",
|
|
8722
8747
|
{
|
|
8723
8748
|
onClick: () => onEdit(message),
|
|
8724
|
-
title: "
|
|
8749
|
+
title: t("BiChat.Message.EditMessage"),
|
|
8725
8750
|
className: "cursor-pointer text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-700 dark:hover:text-gray-300 rounded-md transition-colors p-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/50",
|
|
8726
|
-
"aria-label": "
|
|
8751
|
+
"aria-label": t("BiChat.Message.EditMessage"),
|
|
8727
8752
|
children: /* @__PURE__ */ jsx(PencilSimple, { size: 16, className: "w-4 h-4" })
|
|
8728
8753
|
}
|
|
8729
8754
|
)
|
|
8730
8755
|
] });
|
|
8731
8756
|
}
|
|
8732
8757
|
memo(MessageActions);
|
|
8758
|
+
init_useTranslation();
|
|
8733
8759
|
var AttachmentPreview = memo(({ attachment, onRemove, onClick, readonly = false }) => {
|
|
8760
|
+
const { t } = useTranslation();
|
|
8734
8761
|
const [isImageLoaded, setIsImageLoaded] = useState(false);
|
|
8735
8762
|
const [imageError, setImageError] = useState(false);
|
|
8736
8763
|
const previewUrl = attachment.preview || createDataUrl(attachment.base64Data, attachment.mimeType);
|
|
@@ -8762,7 +8789,7 @@ var AttachmentPreview = memo(({ attachment, onRemove, onClick, readonly = false
|
|
|
8762
8789
|
children: [
|
|
8763
8790
|
/* @__PURE__ */ jsxs("div", { className: "relative mb-2 overflow-hidden rounded-md bg-gray-100 dark:bg-gray-700 aspect-square", children: [
|
|
8764
8791
|
!isImageLoaded && !imageError && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 animate-pulse bg-gray-200 dark:bg-gray-600" }),
|
|
8765
|
-
imageError && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-gray-100 dark:bg-gray-700", children: /* @__PURE__ */ jsx("span", { className: "text-xs text-gray-500 dark:text-gray-400", children: "
|
|
8792
|
+
imageError && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-gray-100 dark:bg-gray-700", children: /* @__PURE__ */ jsx("span", { className: "text-xs text-gray-500 dark:text-gray-400", children: t("BiChat.Attachment.PreviewUnavailable") }) }),
|
|
8766
8793
|
/* @__PURE__ */ jsx(
|
|
8767
8794
|
"img",
|
|
8768
8795
|
{
|
|
@@ -8798,7 +8825,7 @@ var AttachmentPreview = memo(({ attachment, onRemove, onClick, readonly = false
|
|
|
8798
8825
|
},
|
|
8799
8826
|
className: "absolute top-1 right-1 flex items-center justify-center bg-red-500 hover:bg-red-600 dark:bg-red-600 dark:hover:bg-red-700 text-white rounded-full transition-all duration-200 shadow-sm hover:shadow-md active:scale-90 w-6 h-6",
|
|
8800
8827
|
"aria-label": `Remove ${attachment.filename}`,
|
|
8801
|
-
title: "Remove
|
|
8828
|
+
title: t("BiChat.Attachment.Remove"),
|
|
8802
8829
|
children: /* @__PURE__ */ jsx(X, { size: 14, className: "w-3.5 h-3.5", weight: "bold" })
|
|
8803
8830
|
}
|
|
8804
8831
|
)
|
|
@@ -8827,7 +8854,7 @@ var AttachmentUpload = memo(
|
|
|
8827
8854
|
setIsLoading(true);
|
|
8828
8855
|
try {
|
|
8829
8856
|
if (files.length > maxAttachments) {
|
|
8830
|
-
toast.error(t("Error.MaxFiles", { max: maxAttachments, selected: files.length }));
|
|
8857
|
+
toast.error(t("BiChat.Error.MaxFiles", { max: maxAttachments, selected: files.length }));
|
|
8831
8858
|
setIsLoading(false);
|
|
8832
8859
|
return;
|
|
8833
8860
|
}
|
|
@@ -8867,10 +8894,10 @@ var AttachmentUpload = memo(
|
|
|
8867
8894
|
}
|
|
8868
8895
|
if (attachments.length > 0) {
|
|
8869
8896
|
onAttachmentsSelected(attachments);
|
|
8870
|
-
const message = attachments.length === 1 ? t("Attachment.FileAdded", { size: formatFileSize(attachments[0].sizeBytes) }) : t("Attachment.FileAdded", { size: `${attachments.length} files` });
|
|
8897
|
+
const message = attachments.length === 1 ? t("BiChat.Attachment.FileAdded", { size: formatFileSize(attachments[0].sizeBytes) }) : t("BiChat.Attachment.FileAdded", { size: `${attachments.length} files` });
|
|
8871
8898
|
toast.success(message);
|
|
8872
8899
|
} else if (errors.length > 0) {
|
|
8873
|
-
toast.error(t("Attachment.InvalidFile"));
|
|
8900
|
+
toast.error(t("BiChat.Attachment.InvalidFile"));
|
|
8874
8901
|
}
|
|
8875
8902
|
} finally {
|
|
8876
8903
|
setIsLoading(false);
|
|
@@ -8893,7 +8920,7 @@ var AttachmentUpload = memo(
|
|
|
8893
8920
|
onChange: handleFileSelect,
|
|
8894
8921
|
disabled: isDisabled,
|
|
8895
8922
|
className: "sr-only",
|
|
8896
|
-
"aria-label": t("Attachment.SelectFiles")
|
|
8923
|
+
"aria-label": t("BiChat.Attachment.SelectFiles")
|
|
8897
8924
|
}
|
|
8898
8925
|
),
|
|
8899
8926
|
/* @__PURE__ */ jsx(
|
|
@@ -8903,7 +8930,7 @@ var AttachmentUpload = memo(
|
|
|
8903
8930
|
onClick: handleClick,
|
|
8904
8931
|
disabled: isDisabled,
|
|
8905
8932
|
className: "\n flex items-center justify-center\n w-8 h-8\n text-gray-600 dark:text-gray-400\n hover:text-gray-800 dark:hover:text-gray-200\n hover:bg-gray-100 dark:hover:bg-gray-700\n disabled:text-gray-400 dark:disabled:text-gray-600\n disabled:opacity-50 disabled:cursor-not-allowed\n rounded-lg\n transition-all\n duration-200\n active:scale-95\n focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/50\n ",
|
|
8906
|
-
"aria-label": t("Attachment.SelectFiles"),
|
|
8933
|
+
"aria-label": t("BiChat.Attachment.SelectFiles"),
|
|
8907
8934
|
"aria-busy": isLoading,
|
|
8908
8935
|
children: isLoading ? /* @__PURE__ */ jsx(CircleNotch, { size: 20, className: "w-5 h-5 animate-spin", weight: "fill" }) : /* @__PURE__ */ jsx(Paperclip, { size: 20, className: "w-5 h-5", weight: "fill" })
|
|
8909
8936
|
}
|
|
@@ -8950,7 +8977,7 @@ function SkipLink() {
|
|
|
8950
8977
|
{
|
|
8951
8978
|
href: "#main-content",
|
|
8952
8979
|
className: "sr-only focus-visible:not-sr-only focus-visible:absolute focus-visible:top-4 focus-visible:left-4 focus-visible:z-50 focus-visible:bg-primary-600 focus-visible:text-white focus-visible:px-4 focus-visible:py-2 focus-visible:rounded-lg focus-visible:shadow-lg",
|
|
8953
|
-
children: t("
|
|
8980
|
+
children: t("BiChat.SkipLink.Label")
|
|
8954
8981
|
}
|
|
8955
8982
|
);
|
|
8956
8983
|
}
|
|
@@ -8991,7 +9018,7 @@ function QuestionStep({
|
|
|
8991
9018
|
};
|
|
8992
9019
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
8993
9020
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mb-2", children: question.text }) }),
|
|
8994
|
-
isMultiSelect && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 dark:text-gray-500 italic", children: t("Question.SelectMulti") }),
|
|
9021
|
+
isMultiSelect && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 dark:text-gray-500 italic", children: t("BiChat.Question.SelectMulti") }),
|
|
8995
9022
|
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2", children: (question.options || []).map((option) => {
|
|
8996
9023
|
const isSelected = selectedOptions.includes(option.label);
|
|
8997
9024
|
return /* @__PURE__ */ jsx(
|
|
@@ -9031,7 +9058,7 @@ function QuestionStep({
|
|
|
9031
9058
|
}) }),
|
|
9032
9059
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
9033
9060
|
/* @__PURE__ */ jsxs("label", { htmlFor: "other-input", className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2", children: [
|
|
9034
|
-
t("Question.SpecifyOther"),
|
|
9061
|
+
t("BiChat.Question.SpecifyOther"),
|
|
9035
9062
|
":"
|
|
9036
9063
|
] }),
|
|
9037
9064
|
/* @__PURE__ */ jsx(
|
|
@@ -9040,7 +9067,7 @@ function QuestionStep({
|
|
|
9040
9067
|
id: "other-input",
|
|
9041
9068
|
value: otherText,
|
|
9042
9069
|
onChange: (e) => handleOtherTextChange(e.target.value),
|
|
9043
|
-
placeholder: t("Question.
|
|
9070
|
+
placeholder: t("BiChat.Question.OtherOption"),
|
|
9044
9071
|
rows: 3,
|
|
9045
9072
|
className: "w-full px-4 py-3 border-2 border-gray-200 dark:border-gray-700 rounded-lg\n bg-white dark:bg-gray-800 text-gray-900 dark:text-white\n placeholder-gray-400 dark:placeholder-gray-500\n focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500\n resize-none"
|
|
9046
9073
|
}
|
|
@@ -9058,8 +9085,8 @@ function ConfirmationStep({
|
|
|
9058
9085
|
const { t } = useTranslation();
|
|
9059
9086
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
9060
9087
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
9061
|
-
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: t("
|
|
9062
|
-
/* @__PURE__ */ jsx("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: t("
|
|
9088
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: t("BiChat.QuestionForm.ReviewTitle") }),
|
|
9089
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: t("BiChat.QuestionForm.ReviewDescription") })
|
|
9063
9090
|
] }),
|
|
9064
9091
|
/* @__PURE__ */ jsx("div", { className: "space-y-4", children: questions.map((question) => {
|
|
9065
9092
|
const answerData = answers[question.id] || { options: [] };
|
|
@@ -9083,12 +9110,12 @@ function ConfirmationStep({
|
|
|
9083
9110
|
)),
|
|
9084
9111
|
customText && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center px-3 py-1 rounded-lg text-sm font-medium border border-amber-500 bg-amber-500/10 text-amber-600 dark:border-amber-400 dark:bg-amber-400/10 dark:text-amber-400", children: [
|
|
9085
9112
|
/* @__PURE__ */ jsxs("span", { className: "font-semibold mr-1", children: [
|
|
9086
|
-
t("Question.
|
|
9113
|
+
t("BiChat.Question.OtherOption"),
|
|
9087
9114
|
":"
|
|
9088
9115
|
] }),
|
|
9089
9116
|
/* @__PURE__ */ jsx("span", { className: "italic", children: customText })
|
|
9090
9117
|
] })
|
|
9091
|
-
] }) : /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-400 dark:text-gray-500 italic", children: t("
|
|
9118
|
+
] }) : /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-400 dark:text-gray-500 italic", children: t("BiChat.QuestionForm.Skip") })
|
|
9092
9119
|
]
|
|
9093
9120
|
},
|
|
9094
9121
|
question.id
|
|
@@ -9105,12 +9132,12 @@ function isQuestionAnswered(data) {
|
|
|
9105
9132
|
function validateAnswers(questions, answers, t) {
|
|
9106
9133
|
const allAnswered = questions.every((q) => isQuestionAnswered(answers[q.id]));
|
|
9107
9134
|
if (!allAnswered) {
|
|
9108
|
-
return t ? t("Error.AllQuestionsRequired") : "Please answer all questions before submitting";
|
|
9135
|
+
return t ? t("BiChat.Error.AllQuestionsRequired") : "Please answer all questions before submitting";
|
|
9109
9136
|
}
|
|
9110
9137
|
for (const q of questions) {
|
|
9111
9138
|
const data = answers[q.id];
|
|
9112
9139
|
if (data && (data.options?.length ?? 0) === 0 && data.customText === "") {
|
|
9113
|
-
return t ? t("Error.CustomTextRequired", { question: q.text }) : `Please enter custom text for question: ${q.text}`;
|
|
9140
|
+
return t ? t("BiChat.Error.CustomTextRequired", { question: q.text }) : `Please enter custom text for question: ${q.text}`;
|
|
9114
9141
|
}
|
|
9115
9142
|
}
|
|
9116
9143
|
return null;
|
|
@@ -9163,24 +9190,24 @@ function QuestionForm({
|
|
|
9163
9190
|
try {
|
|
9164
9191
|
await onSubmit(answers);
|
|
9165
9192
|
} catch (err) {
|
|
9166
|
-
const errorMessage = err instanceof Error ? err.message : t("Error.Generic");
|
|
9193
|
+
const errorMessage = err instanceof Error ? err.message : t("BiChat.Error.Generic");
|
|
9167
9194
|
setError(errorMessage);
|
|
9168
9195
|
setIsSubmitting(false);
|
|
9169
9196
|
}
|
|
9170
9197
|
};
|
|
9171
9198
|
const totalSteps = questions.length + 1;
|
|
9172
|
-
const progressText = isConfirmationStep ? t("
|
|
9199
|
+
const progressText = isConfirmationStep ? t("BiChat.QuestionForm.Step", { current: totalSteps, total: totalSteps }) : t("BiChat.QuestionForm.Step", { current: currentStep + 1, total: totalSteps });
|
|
9173
9200
|
return /* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto", children: [
|
|
9174
9201
|
/* @__PURE__ */ jsxs("div", { className: "border-b border-gray-200 dark:border-gray-700 p-6", children: [
|
|
9175
9202
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-4", children: [
|
|
9176
|
-
/* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: t("
|
|
9203
|
+
/* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: t("BiChat.QuestionForm.Title") }),
|
|
9177
9204
|
/* @__PURE__ */ jsx(
|
|
9178
9205
|
"button",
|
|
9179
9206
|
{
|
|
9180
9207
|
onClick: onCancel,
|
|
9181
9208
|
disabled: isSubmitting,
|
|
9182
9209
|
className: "cursor-pointer text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-50",
|
|
9183
|
-
"aria-label": t("Common.Close"),
|
|
9210
|
+
"aria-label": t("BiChat.Common.Close"),
|
|
9184
9211
|
children: /* @__PURE__ */ jsx(X, { className: "w-6 h-6" })
|
|
9185
9212
|
}
|
|
9186
9213
|
)
|
|
@@ -9214,7 +9241,7 @@ function QuestionForm({
|
|
|
9214
9241
|
onClick: handleBack,
|
|
9215
9242
|
disabled: isSubmitting,
|
|
9216
9243
|
className: "cursor-pointer px-6 py-2 text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 disabled:opacity-50 font-medium transition-colors",
|
|
9217
|
-
children: t("
|
|
9244
|
+
children: t("BiChat.QuestionForm.Back")
|
|
9218
9245
|
}
|
|
9219
9246
|
),
|
|
9220
9247
|
/* @__PURE__ */ jsx("div", { className: "flex-1" }),
|
|
@@ -9225,7 +9252,7 @@ function QuestionForm({
|
|
|
9225
9252
|
onClick: onCancel,
|
|
9226
9253
|
disabled: isSubmitting,
|
|
9227
9254
|
className: "cursor-pointer px-6 py-2 text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 font-medium transition-colors",
|
|
9228
|
-
children: t("Message.Cancel")
|
|
9255
|
+
children: t("BiChat.Message.Cancel")
|
|
9229
9256
|
}
|
|
9230
9257
|
),
|
|
9231
9258
|
/* @__PURE__ */ jsxs(
|
|
@@ -9236,7 +9263,7 @@ function QuestionForm({
|
|
|
9236
9263
|
className: "cursor-pointer px-6 py-2 bg-primary-600 hover:bg-primary-700 disabled:opacity-50 text-white rounded-lg font-medium transition-colors flex items-center gap-2",
|
|
9237
9264
|
children: [
|
|
9238
9265
|
isSubmitting && /* @__PURE__ */ jsx(MemoizedLoadingSpinner, { size: "sm" }),
|
|
9239
|
-
isSubmitting ? t("
|
|
9266
|
+
isSubmitting ? t("BiChat.QuestionForm.Submitting") : t("BiChat.QuestionForm.Confirm")
|
|
9240
9267
|
]
|
|
9241
9268
|
}
|
|
9242
9269
|
)
|
|
@@ -9248,7 +9275,7 @@ function QuestionForm({
|
|
|
9248
9275
|
onClick: handleNext,
|
|
9249
9276
|
disabled: !currentQuestionAnswered || isSubmitting,
|
|
9250
9277
|
className: "cursor-pointer px-6 py-2 bg-primary-600 hover:bg-primary-700 disabled:opacity-50 text-white rounded-lg font-medium transition-colors",
|
|
9251
|
-
children: t("
|
|
9278
|
+
children: t("BiChat.QuestionForm.Next")
|
|
9252
9279
|
}
|
|
9253
9280
|
)
|
|
9254
9281
|
)
|
|
@@ -10721,12 +10748,63 @@ function toDownloadArtifact(artifact) {
|
|
|
10721
10748
|
description: artifact.description
|
|
10722
10749
|
};
|
|
10723
10750
|
}
|
|
10751
|
+
function extractChartDataFromToolCalls(toolCalls) {
|
|
10752
|
+
if (!toolCalls) return void 0;
|
|
10753
|
+
for (const tc of toolCalls) {
|
|
10754
|
+
if (tc.name === "draw_chart" && tc.result) {
|
|
10755
|
+
const parsed = parseChartDataFromJsonString(tc.result);
|
|
10756
|
+
if (parsed) return parsed;
|
|
10757
|
+
}
|
|
10758
|
+
}
|
|
10759
|
+
return void 0;
|
|
10760
|
+
}
|
|
10761
|
+
var EXPORT_TOOL_NAMES = {
|
|
10762
|
+
export_query_to_excel: "excel",
|
|
10763
|
+
export_data_to_excel: "excel",
|
|
10764
|
+
export_to_pdf: "pdf"
|
|
10765
|
+
};
|
|
10766
|
+
function extractDownloadArtifactsFromToolCalls(toolCalls) {
|
|
10767
|
+
if (!toolCalls) return [];
|
|
10768
|
+
const artifacts = [];
|
|
10769
|
+
for (const tc of toolCalls) {
|
|
10770
|
+
const type = EXPORT_TOOL_NAMES[tc.name];
|
|
10771
|
+
if (!type || !tc.result) continue;
|
|
10772
|
+
let parsed;
|
|
10773
|
+
try {
|
|
10774
|
+
parsed = JSON.parse(tc.result);
|
|
10775
|
+
} catch {
|
|
10776
|
+
continue;
|
|
10777
|
+
}
|
|
10778
|
+
if (!isRecord(parsed) || typeof parsed.url !== "string" || !parsed.url) continue;
|
|
10779
|
+
const filename = typeof parsed.filename === "string" && parsed.filename ? parsed.filename : parsed.url.split("/").pop() || "download";
|
|
10780
|
+
const sizeKB = typeof parsed.file_size_kb === "number" ? parsed.file_size_kb : void 0;
|
|
10781
|
+
const sizeBytes = typeof parsed.size === "number" ? parsed.size : sizeKB != null ? sizeKB * 1024 : void 0;
|
|
10782
|
+
artifacts.push({
|
|
10783
|
+
type,
|
|
10784
|
+
filename,
|
|
10785
|
+
url: parsed.url,
|
|
10786
|
+
sizeReadable: sizeBytes != null ? formatSizeReadable(sizeBytes) : void 0,
|
|
10787
|
+
rowCount: parseRowCount(parsed),
|
|
10788
|
+
description: typeof parsed.description === "string" ? parsed.description : void 0
|
|
10789
|
+
});
|
|
10790
|
+
}
|
|
10791
|
+
return artifacts;
|
|
10792
|
+
}
|
|
10724
10793
|
function normalizeAssistantTurn(turn) {
|
|
10794
|
+
const existingArtifacts = turn.artifacts || [];
|
|
10795
|
+
const fromToolCalls = extractDownloadArtifactsFromToolCalls(turn.toolCalls);
|
|
10796
|
+
const merged = [...existingArtifacts];
|
|
10797
|
+
for (const a of fromToolCalls) {
|
|
10798
|
+
if (!merged.some((e) => e.url === a.url && e.filename === a.filename)) {
|
|
10799
|
+
merged.push(a);
|
|
10800
|
+
}
|
|
10801
|
+
}
|
|
10725
10802
|
return {
|
|
10726
10803
|
...turn,
|
|
10727
10804
|
role: turn.role || "assistant" /* Assistant */,
|
|
10805
|
+
chartData: turn.chartData || extractChartDataFromToolCalls(turn.toolCalls),
|
|
10728
10806
|
citations: turn.citations || [],
|
|
10729
|
-
artifacts:
|
|
10807
|
+
artifacts: merged,
|
|
10730
10808
|
codeOutputs: turn.codeOutputs || []
|
|
10731
10809
|
};
|
|
10732
10810
|
}
|