@aigentyc/chat-sdk 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/aigentyc.mjs +14 -8
- package/bin/lib/add.mjs +1 -1
- package/bin/lib/doctor.mjs +1 -1
- package/bin/lib/skill.mjs +84 -0
- package/claude-skill/README.md +32 -0
- package/claude-skill/aigentyc-chat-sdk/SKILL.md +339 -0
- package/context7.json +1 -1
- package/dist/ChatInterface-B0zbA3Lm.d.cts +64 -0
- package/dist/ChatInterface-f8ftS56n.d.ts +64 -0
- package/dist/{SlotsContext-CBtt36al.d.ts → SlotsContext-BjiX1mRx.d.ts} +17 -2
- package/dist/{SlotsContext-CHvISDJT.d.cts → SlotsContext-CEOBjzfh.d.cts} +17 -2
- package/dist/ai-elements.cjs +114 -393
- package/dist/ai-elements.cjs.map +1 -1
- package/dist/ai-elements.d.cts +2 -31
- package/dist/ai-elements.d.ts +2 -31
- package/dist/ai-elements.js +9 -291
- package/dist/ai-elements.js.map +1 -1
- package/dist/{chunk-5QSXB6UL.cjs → chunk-3HGOLNGG.cjs} +13 -4
- package/dist/chunk-3HGOLNGG.cjs.map +1 -0
- package/dist/{chunk-KVEJAPWA.js → chunk-3KSMOHNY.js} +48 -62
- package/dist/chunk-3KSMOHNY.js.map +1 -0
- package/dist/chunk-4WOBNRRB.cjs +540 -0
- package/dist/chunk-4WOBNRRB.cjs.map +1 -0
- package/dist/chunk-7AZMWPKX.cjs +35 -0
- package/dist/chunk-7AZMWPKX.cjs.map +1 -0
- package/dist/chunk-B27JIQ4Z.js +528 -0
- package/dist/chunk-B27JIQ4Z.js.map +1 -0
- package/dist/{chunk-J2K7EJYP.cjs → chunk-BPV66QNM.cjs} +6 -4
- package/dist/chunk-BPV66QNM.cjs.map +1 -0
- package/dist/{chunk-FYPJSHCL.js → chunk-FPQ3UCCJ.js} +6 -4
- package/dist/chunk-FPQ3UCCJ.js.map +1 -0
- package/dist/{chunk-7L4FS6G7.js → chunk-JHWSG5IB.js} +17 -3
- package/dist/chunk-JHWSG5IB.js.map +1 -0
- package/dist/{chunk-4FBVV64J.js → chunk-M4YRNNGB.js} +13 -4
- package/dist/chunk-M4YRNNGB.js.map +1 -0
- package/dist/{chunk-QDFPJJ5Y.cjs → chunk-OU5OZKYH.cjs} +50 -65
- package/dist/chunk-OU5OZKYH.cjs.map +1 -0
- package/dist/{chunk-MC6QDYB6.cjs → chunk-PPCGZ5MP.cjs} +166 -67
- package/dist/chunk-PPCGZ5MP.cjs.map +1 -0
- package/dist/{chunk-U3FXVLUK.js → chunk-PQCGQ32Q.js} +84 -4
- package/dist/chunk-PQCGQ32Q.js.map +1 -0
- package/dist/{chunk-FOZXDUSZ.js → chunk-SWKWHBBN.js} +151 -54
- package/dist/chunk-SWKWHBBN.js.map +1 -0
- package/dist/{chunk-DMGYQ6NN.cjs → chunk-TLGZSXTU.cjs} +86 -6
- package/dist/chunk-TLGZSXTU.cjs.map +1 -0
- package/dist/{chunk-C24QG43M.cjs → chunk-TZ7EM3EG.cjs} +17 -2
- package/dist/chunk-TZ7EM3EG.cjs.map +1 -0
- package/dist/chunk-XEAAB5ZM.js +32 -0
- package/dist/chunk-XEAAB5ZM.js.map +1 -0
- package/dist/components.cjs +31 -52
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +4 -34
- package/dist/components.d.ts +4 -34
- package/dist/components.js +18 -42
- package/dist/components.js.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/hooks.cjs +6 -6
- package/dist/hooks.d.cts +2 -2
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +2 -2
- package/dist/i18n.d.cts +1 -1
- package/dist/i18n.d.ts +1 -1
- package/dist/index.cjs +45 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +51 -6
- package/dist/index.d.ts +51 -6
- package/dist/index.js +17 -10
- package/dist/index.js.map +1 -1
- package/dist/llms-full.txt +194 -14
- package/dist/message-feedback-BFh3-qym.d.cts +92 -0
- package/dist/message-feedback-cWR0NVok.d.ts +92 -0
- package/dist/normalize-KzCLLqpU.d.cts +42 -0
- package/dist/normalize-KzCLLqpU.d.ts +42 -0
- package/dist/styles.css +1 -1
- package/dist/theme.d.cts +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/tools.cjs +14 -5
- package/dist/tools.d.cts +3 -2
- package/dist/tools.d.ts +3 -2
- package/dist/tools.js +3 -2
- package/dist/{types-DKJ_-nbG.d.cts → types-DlNwk-bG.d.cts} +33 -3
- package/dist/{types-DKJ_-nbG.d.ts → types-DlNwk-bG.d.ts} +33 -3
- package/dist/ui.cjs +45 -45
- package/dist/ui.js +2 -2
- package/llms.txt +175 -5
- package/package.json +2 -1
- package/dist/chunk-4FBVV64J.js.map +0 -1
- package/dist/chunk-5QSXB6UL.cjs.map +0 -1
- package/dist/chunk-7L4FS6G7.js.map +0 -1
- package/dist/chunk-A7PCSWIK.js +0 -219
- package/dist/chunk-A7PCSWIK.js.map +0 -1
- package/dist/chunk-C24QG43M.cjs.map +0 -1
- package/dist/chunk-DMGYQ6NN.cjs.map +0 -1
- package/dist/chunk-FOZXDUSZ.js.map +0 -1
- package/dist/chunk-FYPJSHCL.js.map +0 -1
- package/dist/chunk-J2K7EJYP.cjs.map +0 -1
- package/dist/chunk-KVEJAPWA.js.map +0 -1
- package/dist/chunk-MC6QDYB6.cjs.map +0 -1
- package/dist/chunk-QDFPJJ5Y.cjs.map +0 -1
- package/dist/chunk-RTVEBPAJ.cjs +0 -230
- package/dist/chunk-RTVEBPAJ.cjs.map +0 -1
- package/dist/chunk-U3FXVLUK.js.map +0 -1
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
var chunkNYQSM3EB_cjs = require('./chunk-NYQSM3EB.cjs');
|
|
5
5
|
var chunkP3RPAI4F_cjs = require('./chunk-P3RPAI4F.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunk4WOBNRRB_cjs = require('./chunk-4WOBNRRB.cjs');
|
|
7
7
|
var chunk3MP2EGEJ_cjs = require('./chunk-3MP2EGEJ.cjs');
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var chunkTLGZSXTU_cjs = require('./chunk-TLGZSXTU.cjs');
|
|
9
|
+
var chunkBPV66QNM_cjs = require('./chunk-BPV66QNM.cjs');
|
|
10
10
|
var chunk525KS5HM_cjs = require('./chunk-525KS5HM.cjs');
|
|
11
11
|
var react = require('react');
|
|
12
12
|
var lucideReact = require('lucide-react');
|
|
@@ -31,7 +31,7 @@ var ChatHeader = react.memo(function ChatHeader2({
|
|
|
31
31
|
onCartClick
|
|
32
32
|
}) {
|
|
33
33
|
const { t, direction } = chunk3MP2EGEJ_cjs.useI18n();
|
|
34
|
-
const ctx =
|
|
34
|
+
const ctx = chunkBPV66QNM_cjs.useChatContext();
|
|
35
35
|
const displayName = clientName || ctx.config.clientName || "AI Assistant";
|
|
36
36
|
const LogoOrIcon = () => {
|
|
37
37
|
if (logoUrl) {
|
|
@@ -761,6 +761,78 @@ function CartDrawer({ storeOrigin, isOpen, onClose, onCartUpdate }) {
|
|
|
761
761
|
] })
|
|
762
762
|
] }) });
|
|
763
763
|
}
|
|
764
|
+
var TRANSLATIONS = {
|
|
765
|
+
operator_joined: "\u05D4\u05E0\u05E6\u05D9\u05D2 \u05D4\u05E6\u05D8\u05E8\u05E3 \u05DC\u05E9\u05D9\u05D7\u05D4",
|
|
766
|
+
chat_ended: "\u05D4\u05E9\u05D9\u05D7\u05D4 \u05D4\u05E1\u05EA\u05D9\u05D9\u05DE\u05D4",
|
|
767
|
+
handed_to_ai: "\u05D4\u05E9\u05D9\u05D7\u05D4 \u05D4\u05D5\u05E2\u05D1\u05E8\u05D4 \u05D7\u05D6\u05E8\u05D4 \u05DC\u05E2\u05D5\u05D6\u05E8 AI",
|
|
768
|
+
operator_disconnected: "\u05D4\u05E0\u05E6\u05D9\u05D2 \u05D4\u05EA\u05E0\u05EA\u05E7. \u05DE\u05DE\u05EA\u05D9\u05DF \u05DC\u05D7\u05D9\u05D1\u05D5\u05E8 \u05DE\u05D7\u05D3\u05E9...",
|
|
769
|
+
operator_offline: "\u05D4\u05E0\u05E6\u05D9\u05D2 \u05DC\u05D0 \u05D6\u05DE\u05D9\u05DF \u05DB\u05E8\u05D2\u05E2",
|
|
770
|
+
operator_online: "\u05D4\u05E0\u05E6\u05D9\u05D2 \u05D7\u05D6\u05E8 \u05DC\u05E9\u05D9\u05D7\u05D4",
|
|
771
|
+
reassigned: "\u05D4\u05E9\u05D9\u05D7\u05D4 \u05D4\u05D5\u05E2\u05D1\u05E8\u05D4 \u05DC\u05E0\u05E6\u05D9\u05D2 \u05D0\u05D7\u05E8",
|
|
772
|
+
idle_warning: "\u05D4\u05E0\u05E6\u05D9\u05D2 \u05DC\u05D0 \u05E4\u05E2\u05D9\u05DC \u05DB\u05E8\u05D2\u05E2"
|
|
773
|
+
};
|
|
774
|
+
function translateMessage(message, type) {
|
|
775
|
+
if (type && TRANSLATIONS[type]) {
|
|
776
|
+
const nameMatch = message.match(/^([A-Za-z\u0590-\u05FF\s]+?) (joined|left|ended|disconnected)/);
|
|
777
|
+
if (nameMatch && type === "operator_joined") {
|
|
778
|
+
return `${nameMatch[1]} \u05D4\u05E6\u05D8\u05E8\u05E3/\u05D4 \u05DC\u05E9\u05D9\u05D7\u05D4`;
|
|
779
|
+
}
|
|
780
|
+
return TRANSLATIONS[type];
|
|
781
|
+
}
|
|
782
|
+
return message;
|
|
783
|
+
}
|
|
784
|
+
function SystemMessage({ message, type }) {
|
|
785
|
+
const displayMessage = translateMessage(message, type);
|
|
786
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center my-3", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] text-muted-foreground bg-muted px-4 py-1.5 rounded-full border border-border/50", children: displayMessage }) });
|
|
787
|
+
}
|
|
788
|
+
var ChatErrorBoundary = class extends react.Component {
|
|
789
|
+
state = { error: null };
|
|
790
|
+
static getDerivedStateFromError(error) {
|
|
791
|
+
return { error };
|
|
792
|
+
}
|
|
793
|
+
componentDidCatch(error, info) {
|
|
794
|
+
this.props.onError?.(error, info);
|
|
795
|
+
if (process.env.NODE_ENV !== "production") {
|
|
796
|
+
console.error(
|
|
797
|
+
`[aigentyc-chat-sdk] ${this.props.label || "component"} threw:`,
|
|
798
|
+
error,
|
|
799
|
+
info
|
|
800
|
+
);
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
reset = () => {
|
|
804
|
+
this.setState({ error: null });
|
|
805
|
+
};
|
|
806
|
+
render() {
|
|
807
|
+
if (this.state.error) {
|
|
808
|
+
if (this.props.fallback) {
|
|
809
|
+
return this.props.fallback(this.state.error, this.reset);
|
|
810
|
+
}
|
|
811
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
812
|
+
"div",
|
|
813
|
+
{
|
|
814
|
+
role: "alert",
|
|
815
|
+
className: "my-2 rounded-md border border-destructive/30 bg-destructive/10 p-3 text-xs",
|
|
816
|
+
style: { color: "var(--ac-destructive, #dc2626)" },
|
|
817
|
+
children: [
|
|
818
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium", children: this.props.label ? `Failed to render ${this.props.label}` : "Something went wrong" }),
|
|
819
|
+
process.env.NODE_ENV !== "production" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 opacity-80 font-mono truncate", children: this.state.error.message }),
|
|
820
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
821
|
+
"button",
|
|
822
|
+
{
|
|
823
|
+
type: "button",
|
|
824
|
+
onClick: this.reset,
|
|
825
|
+
className: "mt-1 underline text-xs opacity-80 hover:opacity-100",
|
|
826
|
+
children: "Retry"
|
|
827
|
+
}
|
|
828
|
+
)
|
|
829
|
+
]
|
|
830
|
+
}
|
|
831
|
+
);
|
|
832
|
+
}
|
|
833
|
+
return this.props.children;
|
|
834
|
+
}
|
|
835
|
+
};
|
|
764
836
|
function extractKbSources(parts) {
|
|
765
837
|
if (!Array.isArray(parts)) return [];
|
|
766
838
|
const out = [];
|
|
@@ -791,12 +863,42 @@ function extractKbSources(parts) {
|
|
|
791
863
|
}
|
|
792
864
|
return deduped;
|
|
793
865
|
}
|
|
866
|
+
function DefaultAssistantMessage({ text }) {
|
|
867
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
868
|
+
"div",
|
|
869
|
+
{
|
|
870
|
+
className: "flex gap-[10px] items-start rounded-2xl",
|
|
871
|
+
style: {
|
|
872
|
+
backgroundColor: "var(--ac-assistant-bubble-bg, transparent)",
|
|
873
|
+
padding: "var(--ac-assistant-bubble-padding, 0)",
|
|
874
|
+
color: "var(--ac-assistant-bubble-text, var(--ac-text))"
|
|
875
|
+
},
|
|
876
|
+
children: [
|
|
877
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.SparklesIcon, { className: "mt-[2px] w-4 h-4 shrink-0", style: { color: "var(--ac-primary)" } }),
|
|
878
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-w-0 whitespace-pre-wrap", children: text })
|
|
879
|
+
]
|
|
880
|
+
}
|
|
881
|
+
);
|
|
882
|
+
}
|
|
883
|
+
function DefaultUserMessage({ text }) {
|
|
884
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
885
|
+
"div",
|
|
886
|
+
{
|
|
887
|
+
className: "inline-block rounded-2xl px-3 py-2 max-w-[85%]",
|
|
888
|
+
style: {
|
|
889
|
+
backgroundColor: "var(--ac-user-bubble-bg, var(--ac-primary))",
|
|
890
|
+
color: "var(--ac-primary-foreground, #fff)"
|
|
891
|
+
},
|
|
892
|
+
children: text
|
|
893
|
+
}
|
|
894
|
+
);
|
|
895
|
+
}
|
|
794
896
|
function ChatInterface(props) {
|
|
795
897
|
const { showSources = false } = props;
|
|
796
|
-
const { messages, status, sendMessage, sessionId, config, clearMessages } =
|
|
898
|
+
const { messages, status, sendMessage, sessionId, config, clearMessages } = chunkBPV66QNM_cjs.useChatContext();
|
|
797
899
|
const { t, direction } = chunk3MP2EGEJ_cjs.useI18n();
|
|
798
900
|
chunkP3RPAI4F_cjs.useTheme();
|
|
799
|
-
const slots =
|
|
901
|
+
const slots = chunkBPV66QNM_cjs.useSlots();
|
|
800
902
|
let liveChat = null;
|
|
801
903
|
try {
|
|
802
904
|
liveChat = chunkNYQSM3EB_cjs.useLiveChat();
|
|
@@ -812,6 +914,7 @@ function ChatInterface(props) {
|
|
|
812
914
|
const isProcessing = status === "streaming";
|
|
813
915
|
react.useEffect(() => {
|
|
814
916
|
if (messages.length > 0 && showWelcome) setShowWelcome(false);
|
|
917
|
+
if (messages.length === 0 && !showWelcome) setShowWelcome(true);
|
|
815
918
|
}, [messages.length, showWelcome]);
|
|
816
919
|
const handleSubmit = react.useCallback(
|
|
817
920
|
(text) => {
|
|
@@ -869,8 +972,8 @@ function ChatInterface(props) {
|
|
|
869
972
|
);
|
|
870
973
|
if (showWelcome && messages.length === 0) {
|
|
871
974
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col", dir: direction, style: { backgroundColor: "var(--ac-background)" }, children: [
|
|
872
|
-
!props.hideHeader &&
|
|
873
|
-
|
|
975
|
+
!props.hideHeader && chunkBPV66QNM_cjs.renderSlot("header", headerProps, ChatHeader, slots),
|
|
976
|
+
chunkBPV66QNM_cjs.renderSlot(
|
|
874
977
|
"welcomePage",
|
|
875
978
|
{
|
|
876
979
|
onSelectCategory: handleSelectCategory,
|
|
@@ -889,18 +992,18 @@ function ChatInterface(props) {
|
|
|
889
992
|
slots
|
|
890
993
|
),
|
|
891
994
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "shrink-0 px-[15px] md:px-[40px]", style: { backgroundColor: "var(--ac-background)" }, children: [
|
|
892
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto z-40 w-full", children:
|
|
995
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto z-40 w-full", children: chunkBPV66QNM_cjs.renderSlot(
|
|
893
996
|
"input",
|
|
894
997
|
{ value: input, onChange: setInput, onSubmit: handleSubmit, isProcessing },
|
|
895
998
|
ChatInput,
|
|
896
999
|
slots
|
|
897
1000
|
) }),
|
|
898
|
-
|
|
1001
|
+
chunkBPV66QNM_cjs.renderSlot("footer", { footerText: props.footerText }, ChatFooter, slots)
|
|
899
1002
|
] })
|
|
900
1003
|
] });
|
|
901
1004
|
}
|
|
902
1005
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col", dir: direction, style: { backgroundColor: "var(--ac-background)" }, children: [
|
|
903
|
-
!props.hideHeader &&
|
|
1006
|
+
!props.hideHeader && chunkBPV66QNM_cjs.renderSlot("header", headerProps, ChatHeader, slots),
|
|
904
1007
|
storeOrigin && /* @__PURE__ */ jsxRuntime.jsx(
|
|
905
1008
|
CartDrawer,
|
|
906
1009
|
{
|
|
@@ -910,49 +1013,29 @@ function ChatInterface(props) {
|
|
|
910
1013
|
onCartUpdate: (count) => setCartCount(count)
|
|
911
1014
|
}
|
|
912
1015
|
),
|
|
913
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1016
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunk4WOBNRRB_cjs.Conversation, { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsxs(chunk4WOBNRRB_cjs.ConversationContent, { className: "px-[15px] md:px-[40px] py-6 sm:py-8 w-full space-y-6", children: [
|
|
1017
|
+
messages.length === 0 && chunkBPV66QNM_cjs.renderSlot("emptyState", {}, chunk4WOBNRRB_cjs.ConversationEmptyState, slots),
|
|
914
1018
|
messages.map((message, messageIndex) => {
|
|
915
1019
|
if (hideFirstUserMessage && messageIndex === 0 && message.role === "user") return null;
|
|
1020
|
+
if (message.role === "system") {
|
|
1021
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { children: chunkBPV66QNM_cjs.renderSlot("systemMessage", { message: message.content }, SystemMessage, slots) }, message.id);
|
|
1022
|
+
}
|
|
916
1023
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
917
1024
|
"div",
|
|
918
1025
|
{
|
|
919
1026
|
className: `group ${message.role === "assistant" ? "is-assistant" : "is-user"}`,
|
|
920
1027
|
children: [
|
|
921
|
-
[...message.parts || []].sort((a, b) => {
|
|
922
|
-
|
|
923
|
-
if (a.type
|
|
1028
|
+
(props.messagePartOrder === "stream-order" ? message.parts || [] : [...message.parts || []].sort((a, b) => {
|
|
1029
|
+
const textFirst = props.messagePartOrder !== "tools-first";
|
|
1030
|
+
if (a.type === "text" && b.type !== "text") return textFirst ? -1 : 1;
|
|
1031
|
+
if (a.type !== "text" && b.type === "text") return textFirst ? 1 : -1;
|
|
924
1032
|
return 0;
|
|
925
|
-
}).map((part, i) => {
|
|
1033
|
+
})).map((part, i) => {
|
|
926
1034
|
if (part.type === "text") {
|
|
927
1035
|
if (message.role === "assistant") {
|
|
928
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { children:
|
|
929
|
-
"div",
|
|
930
|
-
{
|
|
931
|
-
className: "flex gap-[10px] items-start rounded-2xl",
|
|
932
|
-
style: {
|
|
933
|
-
backgroundColor: "var(--ac-assistant-bubble-bg, transparent)",
|
|
934
|
-
padding: "var(--ac-assistant-bubble-padding, 0)",
|
|
935
|
-
color: "var(--ac-assistant-bubble-text, var(--ac-text))"
|
|
936
|
-
},
|
|
937
|
-
children: [
|
|
938
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.SparklesIcon, { className: "mt-[2px] w-4 h-4 shrink-0", style: { color: "var(--ac-primary)" } }),
|
|
939
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-w-0 whitespace-pre-wrap", children: part.text })
|
|
940
|
-
]
|
|
941
|
-
}
|
|
942
|
-
) }, `${message.id}-${i}`);
|
|
1036
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { children: chunkBPV66QNM_cjs.renderSlot("assistantMessage", { message, partIndex: i, text: part.text || "" }, DefaultAssistantMessage, slots) }, `${message.id}-${i}`);
|
|
943
1037
|
}
|
|
944
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
945
|
-
"div",
|
|
946
|
-
{
|
|
947
|
-
className: "inline-block rounded-2xl px-3 py-2 max-w-[85%]",
|
|
948
|
-
style: {
|
|
949
|
-
backgroundColor: "var(--ac-user-bubble-bg, var(--ac-primary))",
|
|
950
|
-
color: "var(--ac-primary-foreground, #fff)"
|
|
951
|
-
},
|
|
952
|
-
children: part.text
|
|
953
|
-
},
|
|
954
|
-
`${message.id}-${i}`
|
|
955
|
-
);
|
|
1038
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { children: chunkBPV66QNM_cjs.renderSlot("userMessage", { message, partIndex: i, text: part.text || "" }, DefaultUserMessage, slots) }, `${message.id}-${i}`);
|
|
956
1039
|
}
|
|
957
1040
|
if (part.type.startsWith("tool-")) {
|
|
958
1041
|
const toolName = part.type.replace("tool-", "");
|
|
@@ -966,14 +1049,20 @@ function ChatInterface(props) {
|
|
|
966
1049
|
}
|
|
967
1050
|
const result = output && typeof output === "object" && !Array.isArray(output) && ("data" in output || "uiRenderMode" in output) ? output : { data: output };
|
|
968
1051
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
969
|
-
|
|
1052
|
+
ChatErrorBoundary,
|
|
970
1053
|
{
|
|
971
|
-
toolName
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
1054
|
+
label: `tool "${toolName}"`,
|
|
1055
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1056
|
+
chunkTLGZSXTU_cjs.ToolRenderer,
|
|
1057
|
+
{
|
|
1058
|
+
toolName,
|
|
1059
|
+
state: part.state ?? "output-available",
|
|
1060
|
+
args: part.input ?? {},
|
|
1061
|
+
result,
|
|
1062
|
+
onSendMessage: handleSubmit,
|
|
1063
|
+
isProcessing
|
|
1064
|
+
}
|
|
1065
|
+
)
|
|
977
1066
|
},
|
|
978
1067
|
`${message.id}-tool-${i}`
|
|
979
1068
|
);
|
|
@@ -983,10 +1072,10 @@ function ChatInterface(props) {
|
|
|
983
1072
|
showSources && message.role === "assistant" && (() => {
|
|
984
1073
|
const kbSources = extractKbSources(message.parts);
|
|
985
1074
|
if (kbSources.length === 0) return null;
|
|
986
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
987
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
988
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
989
|
-
|
|
1075
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(chunk4WOBNRRB_cjs.Sources, { children: [
|
|
1076
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunk4WOBNRRB_cjs.SourcesTrigger, { count: kbSources.length }),
|
|
1077
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunk4WOBNRRB_cjs.SourcesContent, { children: kbSources.map((s, idx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1078
|
+
chunk4WOBNRRB_cjs.Source,
|
|
990
1079
|
{
|
|
991
1080
|
href: s.sourceUrl ?? "#",
|
|
992
1081
|
title: s.documentName || s.pageTitle || `Source ${idx + 1}`
|
|
@@ -994,7 +1083,15 @@ function ChatInterface(props) {
|
|
|
994
1083
|
`${message.id}-src-${idx}`
|
|
995
1084
|
)) })
|
|
996
1085
|
] });
|
|
997
|
-
})()
|
|
1086
|
+
})(),
|
|
1087
|
+
message.role === "assistant" && chunkBPV66QNM_cjs.renderSlot("feedback", {
|
|
1088
|
+
messageId: message.id,
|
|
1089
|
+
projectId: config.projectId,
|
|
1090
|
+
sessionId,
|
|
1091
|
+
apiKey: config.apiKey,
|
|
1092
|
+
apiEndpoint: config.apiEndpoint,
|
|
1093
|
+
textContent: (message.parts || []).filter((p) => p.type === "text").map((p) => p.text || "").join("\n") || (typeof message.content === "string" ? message.content : "")
|
|
1094
|
+
}, chunk4WOBNRRB_cjs.MessageFeedback, slots)
|
|
998
1095
|
]
|
|
999
1096
|
},
|
|
1000
1097
|
message.id
|
|
@@ -1008,7 +1105,7 @@ function ChatInterface(props) {
|
|
|
1008
1105
|
);
|
|
1009
1106
|
const allToolsComplete = (lastMessage.parts || []).filter((p) => p.type.startsWith("tool-")).every((p) => p.state === "output-available");
|
|
1010
1107
|
return allToolsComplete && !hasText;
|
|
1011
|
-
})() && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1108
|
+
})() && /* @__PURE__ */ jsxRuntime.jsx(chunk4WOBNRRB_cjs.Loader, { text: t("thinking") })
|
|
1012
1109
|
] }) }),
|
|
1013
1110
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "shrink-0 px-[15px] md:px-[40px] pb-2", style: { backgroundColor: "var(--ac-background)" }, children: [
|
|
1014
1111
|
props.pageQuestions && props.pageQuestions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1021,7 +1118,7 @@ function ChatInterface(props) {
|
|
|
1021
1118
|
}
|
|
1022
1119
|
),
|
|
1023
1120
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto z-40 w-full flex items-end gap-2", children: [
|
|
1024
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children:
|
|
1121
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: chunkBPV66QNM_cjs.renderSlot(
|
|
1025
1122
|
"input",
|
|
1026
1123
|
{ value: input, onChange: setInput, onSubmit: () => handleSubmit(input), isProcessing },
|
|
1027
1124
|
ChatInput,
|
|
@@ -1038,7 +1135,7 @@ function ChatInterface(props) {
|
|
|
1038
1135
|
}
|
|
1039
1136
|
)
|
|
1040
1137
|
] }),
|
|
1041
|
-
|
|
1138
|
+
chunkBPV66QNM_cjs.renderSlot("footer", { footerText: props.footerText }, ChatFooter, slots)
|
|
1042
1139
|
] }),
|
|
1043
1140
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-session-id": sessionId, className: "hidden" })
|
|
1044
1141
|
] });
|
|
@@ -1105,7 +1202,7 @@ function FloatingButton({
|
|
|
1105
1202
|
"div",
|
|
1106
1203
|
{
|
|
1107
1204
|
dir: isRtl ? "rtl" : "ltr",
|
|
1108
|
-
className: `relative bg-
|
|
1205
|
+
className: `relative bg-card rounded-sm animate-fadeIn ${isBottom ? "mb-1" : "mt-1"}`,
|
|
1109
1206
|
style: {
|
|
1110
1207
|
animation: "fadeIn 0.3s ease-out",
|
|
1111
1208
|
boxShadow: "0 4px 16px rgba(0, 0, 0, 0.12)",
|
|
@@ -1128,7 +1225,7 @@ function FloatingButton({
|
|
|
1128
1225
|
style: {
|
|
1129
1226
|
width: "14px",
|
|
1130
1227
|
height: "14px",
|
|
1131
|
-
background: "
|
|
1228
|
+
background: "var(--ac-card)",
|
|
1132
1229
|
transform: "translateY(-50%) rotate(45deg)",
|
|
1133
1230
|
boxShadow: "2px -2px 4px rgba(0, 0, 0, 0.06)",
|
|
1134
1231
|
...isRightSide ? { right: "-7px" } : { left: "-7px" }
|
|
@@ -1481,12 +1578,12 @@ function ChatView() {
|
|
|
1481
1578
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1482
1579
|
"div",
|
|
1483
1580
|
{
|
|
1484
|
-
className: `rounded-2xl px-3.5 py-2.5 text-[14px] leading-relaxed ${isOperator ? "bg-
|
|
1581
|
+
className: `rounded-2xl px-3.5 py-2.5 text-[14px] leading-relaxed ${isOperator ? "bg-card border border-border text-foreground rounded-bl-md" : "text-white rounded-br-md"}`,
|
|
1485
1582
|
style: !isOperator ? { backgroundColor: "var(--ac-primary, #2f80ed)" } : void 0,
|
|
1486
1583
|
children: msg.content
|
|
1487
1584
|
}
|
|
1488
1585
|
),
|
|
1489
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: `text-[10px] text-
|
|
1586
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: `text-[10px] text-muted-foreground mt-0.5 px-1 ${isOperator ? "" : "text-end"}`, children: timeStr })
|
|
1490
1587
|
] })
|
|
1491
1588
|
]
|
|
1492
1589
|
},
|
|
@@ -1495,7 +1592,7 @@ function ChatView() {
|
|
|
1495
1592
|
}),
|
|
1496
1593
|
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: messagesEndRef })
|
|
1497
1594
|
] }),
|
|
1498
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 border-t bg-
|
|
1595
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 border-t bg-background p-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1499
1596
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1500
1597
|
"input",
|
|
1501
1598
|
{
|
|
@@ -1560,7 +1657,7 @@ function EndedView() {
|
|
|
1560
1657
|
{
|
|
1561
1658
|
type: "button",
|
|
1562
1659
|
onClick: () => setSelected("positive"),
|
|
1563
|
-
className: `p-3 rounded-full transition-colors ${selected === "positive" ? "bg-green-100 text-green-600" : "hover:bg-
|
|
1660
|
+
className: `p-3 rounded-full transition-colors ${selected === "positive" ? "bg-green-100 text-green-600" : "hover:bg-muted text-muted-foreground"}`,
|
|
1564
1661
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ThumbsUp, { className: "h-6 w-6" })
|
|
1565
1662
|
}
|
|
1566
1663
|
),
|
|
@@ -1569,7 +1666,7 @@ function EndedView() {
|
|
|
1569
1666
|
{
|
|
1570
1667
|
type: "button",
|
|
1571
1668
|
onClick: () => setSelected("negative"),
|
|
1572
|
-
className: `p-3 rounded-full transition-colors ${selected === "negative" ? "bg-red-100 text-red-600" : "hover:bg-
|
|
1669
|
+
className: `p-3 rounded-full transition-colors ${selected === "negative" ? "bg-red-100 text-red-600" : "hover:bg-muted text-muted-foreground"}`,
|
|
1573
1670
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ThumbsDown, { className: "h-6 w-6" })
|
|
1574
1671
|
}
|
|
1575
1672
|
)
|
|
@@ -1677,6 +1774,7 @@ function PreviewEmbedPanel({ isOpen, isRightSide, zIndex }) {
|
|
|
1677
1774
|
}
|
|
1678
1775
|
|
|
1679
1776
|
exports.CartDrawer = CartDrawer;
|
|
1777
|
+
exports.ChatErrorBoundary = ChatErrorBoundary;
|
|
1680
1778
|
exports.ChatFooter = ChatFooter;
|
|
1681
1779
|
exports.ChatHeader = ChatHeader;
|
|
1682
1780
|
exports.ChatInput = ChatInput;
|
|
@@ -1686,6 +1784,7 @@ exports.LiveChatPanel = LiveChatPanel;
|
|
|
1686
1784
|
exports.MobileLiveChatDrawer = MobileLiveChatDrawer;
|
|
1687
1785
|
exports.PreviewEmbedPanel = PreviewEmbedPanel;
|
|
1688
1786
|
exports.QuickQuestions = QuickQuestions;
|
|
1787
|
+
exports.SystemMessage = SystemMessage;
|
|
1689
1788
|
exports.WelcomePage = WelcomePage;
|
|
1690
|
-
//# sourceMappingURL=chunk-
|
|
1691
|
-
//# sourceMappingURL=chunk-
|
|
1789
|
+
//# sourceMappingURL=chunk-PPCGZ5MP.cjs.map
|
|
1790
|
+
//# sourceMappingURL=chunk-PPCGZ5MP.cjs.map
|