@zero-library/chat-agent 2.1.4 → 2.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +167 -152
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +15 -6
- package/dist/index.d.ts +15 -6
- package/dist/index.esm.js +170 -155
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -365,7 +365,6 @@ var defaultAgentLayout = {
|
|
|
365
365
|
firstMessage: false,
|
|
366
366
|
senderHeader: false,
|
|
367
367
|
sender: true,
|
|
368
|
-
senderPrompts: true,
|
|
369
368
|
senderFooter: false,
|
|
370
369
|
globalHeader: false,
|
|
371
370
|
chatHeader: true,
|
|
@@ -378,8 +377,11 @@ var defaultExpertLayout = {
|
|
|
378
377
|
messageList: true,
|
|
379
378
|
firstMessage: false,
|
|
380
379
|
senderHeader: false,
|
|
381
|
-
sender:
|
|
382
|
-
|
|
380
|
+
sender: {
|
|
381
|
+
props: {
|
|
382
|
+
prompts: false
|
|
383
|
+
}
|
|
384
|
+
},
|
|
383
385
|
senderFooter: false,
|
|
384
386
|
globalHeader: false,
|
|
385
387
|
chatHeader: {
|
|
@@ -457,7 +459,9 @@ function createChatStore() {
|
|
|
457
459
|
const switchAgent = async (agentId) => {
|
|
458
460
|
if (receiver.active.id === agentId) return;
|
|
459
461
|
const canProceed = await config.hooks?.onBeforeSwitchAgent?.(agentId);
|
|
460
|
-
if (canProceed === false)
|
|
462
|
+
if (canProceed === false) {
|
|
463
|
+
throw new Error("\u64CD\u4F5C\u88AB\u963B\u6B62");
|
|
464
|
+
}
|
|
461
465
|
try {
|
|
462
466
|
receiver.loading = true;
|
|
463
467
|
const { data } = await agentInfoQuery(agentId);
|
|
@@ -483,7 +487,9 @@ function createChatStore() {
|
|
|
483
487
|
if (receiver.active.feature?.deepThink) {
|
|
484
488
|
setReceiverParams({ thinkMode: "2" });
|
|
485
489
|
}
|
|
486
|
-
config.hooks?.onAfterSwitchAgent?.(
|
|
490
|
+
config.hooks?.onAfterSwitchAgent?.(data);
|
|
491
|
+
} catch (error) {
|
|
492
|
+
throw error;
|
|
487
493
|
} finally {
|
|
488
494
|
receiver.loading = false;
|
|
489
495
|
}
|
|
@@ -685,7 +691,7 @@ function createChatStore() {
|
|
|
685
691
|
if (member.memberType === 3) {
|
|
686
692
|
conversation.active.member.agent = member;
|
|
687
693
|
} else {
|
|
688
|
-
if (member.memberId === config.userInfo.id) {
|
|
694
|
+
if (member.memberId === config.userInfo.id || member.memberType === 1) {
|
|
689
695
|
conversation.active.member.user = member;
|
|
690
696
|
} else {
|
|
691
697
|
conversation.active.member.other = member;
|
|
@@ -700,47 +706,51 @@ function createChatStore() {
|
|
|
700
706
|
await switchAgent(agentId);
|
|
701
707
|
const conversationId = await resolveConversationId(agentId, strategy);
|
|
702
708
|
if (conversationId) {
|
|
703
|
-
switchConversation(conversationId);
|
|
709
|
+
await switchConversation(conversationId);
|
|
704
710
|
}
|
|
705
711
|
};
|
|
706
712
|
const createConversation = async () => {
|
|
707
713
|
if (!receiver.active.id) return;
|
|
708
714
|
const conversationId = await resolveConversationId(receiver.active.id);
|
|
709
715
|
if (conversationId) {
|
|
710
|
-
switchConversation(conversationId);
|
|
716
|
+
await switchConversation(conversationId);
|
|
711
717
|
}
|
|
712
718
|
};
|
|
713
719
|
const switchConversation = async (id) => {
|
|
714
720
|
const conversationId = String(id);
|
|
715
721
|
if (conversation.active.id === conversationId) return;
|
|
716
722
|
const canProceed = await config.hooks?.onBeforeSwitchConversation?.(conversationId);
|
|
717
|
-
if (canProceed === false)
|
|
723
|
+
if (canProceed === false) {
|
|
724
|
+
throw new Error("\u64CD\u4F5C\u88AB\u963B\u6B62");
|
|
725
|
+
}
|
|
718
726
|
await initConversation(conversationId);
|
|
719
727
|
setPreview();
|
|
720
728
|
config.hooks?.onAfterSwitchConversation?.(conversationId);
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
729
|
+
try {
|
|
730
|
+
if (conversation.active.member.agent) {
|
|
731
|
+
switchAgent(conversation.active.member.agent.memberId);
|
|
732
|
+
} else if (conversation.active.member.other) {
|
|
733
|
+
switchExpert(conversation.active.member.other);
|
|
734
|
+
}
|
|
735
|
+
} catch (e) {
|
|
726
736
|
}
|
|
737
|
+
await getMessages(conversationId);
|
|
727
738
|
};
|
|
728
739
|
const getMessages = async (conversationId) => {
|
|
729
740
|
const canProceed = await config.hooks?.onBeforeInitMessages?.(conversationId);
|
|
730
|
-
if (canProceed === false)
|
|
741
|
+
if (canProceed === false) {
|
|
742
|
+
throw new Error("\u64CD\u4F5C\u88AB\u963B\u6B62");
|
|
743
|
+
}
|
|
731
744
|
if (!conversation.messages[conversationId]) {
|
|
732
745
|
setInitMessage(conversationId);
|
|
733
746
|
}
|
|
734
747
|
if (conversation.messages[conversationId].message.length === 0) {
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
conversation.messages[conversationId].message = data.items;
|
|
742
|
-
} finally {
|
|
743
|
-
}
|
|
748
|
+
const { data } = await conversationMessagesQuery({
|
|
749
|
+
pageNo: 1,
|
|
750
|
+
pageSize: 1e3,
|
|
751
|
+
conversationId
|
|
752
|
+
});
|
|
753
|
+
conversation.messages[conversationId].message = data.items;
|
|
744
754
|
config.hooks?.onAfterInitMessages?.(conversation.messages[conversationId].message);
|
|
745
755
|
config.hooks?.onAfterInit?.();
|
|
746
756
|
}
|
|
@@ -1590,7 +1600,7 @@ var ChatSender_default = react.forwardRef(
|
|
|
1590
1600
|
extraHeader,
|
|
1591
1601
|
extraFooter,
|
|
1592
1602
|
extraFooterBelow,
|
|
1593
|
-
|
|
1603
|
+
sendBtnProps,
|
|
1594
1604
|
fileUpload: fileUpload2
|
|
1595
1605
|
}, ref) => {
|
|
1596
1606
|
const senderRef = react.useRef(null);
|
|
@@ -1644,7 +1654,7 @@ var ChatSender_default = react.forwardRef(
|
|
|
1644
1654
|
extraFooter,
|
|
1645
1655
|
" "
|
|
1646
1656
|
] }),
|
|
1647
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { align: "center", children: loading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingButton, {}) : /* @__PURE__ */ jsxRuntime.jsx(SendButton, { ...
|
|
1657
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { align: "center", children: loading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingButton, {}) : /* @__PURE__ */ jsxRuntime.jsx(SendButton, { ...sendBtnProps }) })
|
|
1648
1658
|
] }),
|
|
1649
1659
|
extraFooterBelow
|
|
1650
1660
|
] });
|
|
@@ -1658,94 +1668,141 @@ var ChatSender_default = react.forwardRef(
|
|
|
1658
1668
|
|
|
1659
1669
|
// src/ui/common/ChatSender.tsx
|
|
1660
1670
|
init_Context();
|
|
1661
|
-
|
|
1671
|
+
|
|
1672
|
+
// src/ui/common/SenderPromptsItems.tsx
|
|
1673
|
+
init_Context();
|
|
1674
|
+
var SenderPromptsItems_default = () => {
|
|
1662
1675
|
const chatStore = useChatStore();
|
|
1663
1676
|
const receiverState = valtio.useSnapshot(chatStore.receiver);
|
|
1664
|
-
const
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1677
|
+
const component = react.useMemo(
|
|
1678
|
+
() => receiverState.active.config?.labels?.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 4, className: "overflow-hidden", children: [
|
|
1679
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { disabled: true, color: "default", variant: "text", children: "\u968F\u4FBF\u804A\u804A" }),
|
|
1680
|
+
receiverState.active.config.labels.map((question) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1681
|
+
antd.Popover,
|
|
1682
|
+
{
|
|
1683
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1684
|
+
antd.List,
|
|
1685
|
+
{
|
|
1686
|
+
itemLayout: "horizontal",
|
|
1687
|
+
split: false,
|
|
1688
|
+
className: styles_module_default2.senderList,
|
|
1689
|
+
dataSource: question.items,
|
|
1690
|
+
renderItem: (item) => /* @__PURE__ */ jsxRuntime.jsx(antd.List.Item, { onClick: () => chatStore.sendMessage(item.question), className: styles_module_default2.senderListItem, children: item.question }),
|
|
1691
|
+
footer: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "end", className: styles_module_default2.senderListFooter, children: "(\u60A8\u53EF\u70B9\u51FB\u4EE5\u4E0A\u95EE\u9898\u5F00\u542FAI\u4F53\u9A8C)" })
|
|
1692
|
+
}
|
|
1693
|
+
),
|
|
1694
|
+
title: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1695
|
+
"div",
|
|
1696
|
+
{
|
|
1697
|
+
className: classNames7__default.default(styles_module_default2.senderListTitle, "text-ellipsis"),
|
|
1698
|
+
children: `${receiverState.active.name}\u5F00\u59CB\u5173\u6CE8${question.name}\u5185\u5BB9\uFF01`
|
|
1699
|
+
}
|
|
1700
|
+
),
|
|
1701
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { color: "default", variant: "filled", children: question.name })
|
|
1702
|
+
},
|
|
1703
|
+
question.id
|
|
1704
|
+
))
|
|
1705
|
+
] }),
|
|
1706
|
+
[receiverState.active.config?.labels]
|
|
1668
1707
|
);
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
config: receiverState.active.config?.fileUpload
|
|
1692
|
-
},
|
|
1693
|
-
extraFooter: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1694
|
-
receiverState.active.feature?.deepThink && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1695
|
-
antd.Button,
|
|
1696
|
-
{
|
|
1697
|
-
size: "small",
|
|
1698
|
-
color: receiverState.params.thinkMode === "1" ? "primary" : "default",
|
|
1699
|
-
variant: "filled",
|
|
1700
|
-
onClick: () => chatStore.setReceiverParams({ thinkMode: receiverState.params.thinkMode === "1" ? "2" : "1" }),
|
|
1701
|
-
children: "\u6DF1\u5EA6\u601D\u8003"
|
|
1702
|
-
}
|
|
1703
|
-
),
|
|
1704
|
-
receiverState.active.feature?.switchManual && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1705
|
-
antd.Button,
|
|
1706
|
-
{
|
|
1707
|
-
size: "small",
|
|
1708
|
-
title: chatMessage?.speakHuman ? "\u5F53\u524D\u72B6\u6001\u4E3A\u4EBA\u5DE5\u6A21\u5F0F\u3002\u60A8\u53D1\u9001\u7684\u95EE\u9898\u5C06\u76F4\u63A5\u53D1\u9001\u7ED9\u4E13\u5BB6\uFF0C\u667A\u80FD\u52A9\u624B\u5C06\u4E0D\u518D\u56DE\u590D" : "\u5F53\u524D\u72B6\u6001\u4E3A\u667A\u80FD\u52A9\u624B\u6A21\u5F0F\u3002\u60A8\u53D1\u9001\u7684\u95EE\u9898\u5C06\u53D1\u9001\u7ED9\u667A\u80FD\u52A9\u624B\uFF0C\u667A\u80FD\u52A9\u624B\u5C06\u56DE\u590D\u60A8",
|
|
1709
|
-
shape: "round",
|
|
1710
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.UserSwitchOutlined, {}),
|
|
1711
|
-
color: chatMessage?.speakHuman ? "primary" : "default",
|
|
1712
|
-
variant: "filled",
|
|
1713
|
-
onClick: () => {
|
|
1714
|
-
chatStore.setSpeakHuman?.(!chatMessage?.speakHuman);
|
|
1715
|
-
},
|
|
1716
|
-
children: "\u5411\u4E13\u5BB6\u54A8\u8BE2"
|
|
1717
|
-
}
|
|
1718
|
-
),
|
|
1719
|
-
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: extraBtn })
|
|
1720
|
-
] }),
|
|
1721
|
-
extraHeader: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1722
|
-
x.Sender.Header,
|
|
1708
|
+
return component;
|
|
1709
|
+
};
|
|
1710
|
+
var ChatSender_default2 = react.forwardRef(
|
|
1711
|
+
({ placeholder, extraBtn = false, referencesBtn = false, sendBtnProps = {}, footerBelow = false, prompts = true }, ref) => {
|
|
1712
|
+
const chatStore = useChatStore();
|
|
1713
|
+
const receiverState = valtio.useSnapshot(chatStore.receiver);
|
|
1714
|
+
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
1715
|
+
const chatMessage = react.useMemo(
|
|
1716
|
+
() => conversationState.messages[conversationState.active.id] || {},
|
|
1717
|
+
[conversationState.messages[conversationState.active.id]]
|
|
1718
|
+
);
|
|
1719
|
+
const referenceHandle = (con) => {
|
|
1720
|
+
if (chatMessage?.loading) return;
|
|
1721
|
+
chatStore.setContent(con);
|
|
1722
|
+
setTimeout(() => {
|
|
1723
|
+
chatStore.sendMessage();
|
|
1724
|
+
}, 10);
|
|
1725
|
+
};
|
|
1726
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 8, children: [
|
|
1727
|
+
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: prompts, DefaultComponent: SenderPromptsItems_default }),
|
|
1728
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1729
|
+
ChatSender_default,
|
|
1723
1730
|
{
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1731
|
+
ref,
|
|
1732
|
+
placeholder,
|
|
1733
|
+
content: chatMessage.content,
|
|
1734
|
+
fileList: chatMessage.files,
|
|
1735
|
+
headerOpen: chatMessage.headerOpen,
|
|
1736
|
+
loading: chatMessage.loading,
|
|
1737
|
+
onContentChange: chatStore.setContent,
|
|
1738
|
+
onFileListChange: chatStore.setFileList,
|
|
1739
|
+
onHeaderOpenChange: chatStore.setHeaderOpen,
|
|
1740
|
+
onSend: () => chatStore.sendMessage(),
|
|
1741
|
+
onCancel: chatStore.cancelReceive,
|
|
1742
|
+
onFocus: chatStore.config.hooks?.onSenderFocus,
|
|
1743
|
+
fileUpload: {
|
|
1744
|
+
config: receiverState.active.config?.fileUpload
|
|
1733
1745
|
},
|
|
1734
|
-
|
|
1735
|
-
|
|
1746
|
+
sendBtnProps,
|
|
1747
|
+
extraFooterBelow: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: footerBelow }),
|
|
1748
|
+
extraFooter: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1749
|
+
receiverState.active.feature?.deepThink && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1750
|
+
antd.Button,
|
|
1751
|
+
{
|
|
1752
|
+
size: "small",
|
|
1753
|
+
color: receiverState.params.thinkMode === "1" ? "primary" : "default",
|
|
1754
|
+
variant: "filled",
|
|
1755
|
+
onClick: () => chatStore.setReceiverParams({ thinkMode: receiverState.params.thinkMode === "1" ? "2" : "1" }),
|
|
1756
|
+
children: "\u6DF1\u5EA6\u601D\u8003"
|
|
1757
|
+
}
|
|
1758
|
+
),
|
|
1759
|
+
receiverState.active.feature?.switchManual && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1760
|
+
antd.Button,
|
|
1761
|
+
{
|
|
1762
|
+
size: "small",
|
|
1763
|
+
title: chatMessage?.speakHuman ? "\u5F53\u524D\u72B6\u6001\u4E3A\u4EBA\u5DE5\u6A21\u5F0F\u3002\u60A8\u53D1\u9001\u7684\u95EE\u9898\u5C06\u76F4\u63A5\u53D1\u9001\u7ED9\u4E13\u5BB6\uFF0C\u667A\u80FD\u52A9\u624B\u5C06\u4E0D\u518D\u56DE\u590D" : "\u5F53\u524D\u72B6\u6001\u4E3A\u667A\u80FD\u52A9\u624B\u6A21\u5F0F\u3002\u60A8\u53D1\u9001\u7684\u95EE\u9898\u5C06\u53D1\u9001\u7ED9\u667A\u80FD\u52A9\u624B\uFF0C\u667A\u80FD\u52A9\u624B\u5C06\u56DE\u590D\u60A8",
|
|
1764
|
+
shape: "round",
|
|
1765
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.UserSwitchOutlined, {}),
|
|
1766
|
+
color: chatMessage?.speakHuman ? "primary" : "default",
|
|
1767
|
+
variant: "filled",
|
|
1768
|
+
onClick: () => {
|
|
1769
|
+
chatStore.setSpeakHuman?.(!chatMessage?.speakHuman);
|
|
1770
|
+
},
|
|
1771
|
+
children: "\u5411\u4E13\u5BB6\u54A8\u8BE2"
|
|
1772
|
+
}
|
|
1773
|
+
),
|
|
1774
|
+
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: extraBtn })
|
|
1775
|
+
] }),
|
|
1776
|
+
extraHeader: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1777
|
+
x.Sender.Header,
|
|
1736
1778
|
{
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1779
|
+
title: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 4, children: [
|
|
1780
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.EnterOutlined, {}),
|
|
1781
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { type: "secondary", ellipsis: true, children: chatMessage?.references?.content?.name })
|
|
1782
|
+
] }),
|
|
1783
|
+
open: !!chatMessage?.references?.content?.name,
|
|
1784
|
+
onOpenChange: () => chatStore.setReferences(),
|
|
1785
|
+
classNames: {
|
|
1786
|
+
header: styles_module_default2.nsSenderReferenceHeaderTitle,
|
|
1787
|
+
content: common.shouldRender(referencesBtn) ? "" : styles_module_default2.nsSenderReferenceHeaderContent
|
|
1788
|
+
},
|
|
1789
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1790
|
+
common.RenderWrapper,
|
|
1791
|
+
{
|
|
1792
|
+
control: referencesBtn,
|
|
1793
|
+
DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 8, children: ["\u6DF1\u5EA6\u89E3\u8BFB", "\u6982\u8981\u89E3\u8BFB"].map((con) => /* @__PURE__ */ jsxRuntime.jsxs(antd.Button, { color: "primary", variant: "filled", onClick: () => referenceHandle(con), children: [
|
|
1794
|
+
con,
|
|
1795
|
+
" \u2192"
|
|
1796
|
+
] }, con)) })
|
|
1797
|
+
}
|
|
1798
|
+
)
|
|
1742
1799
|
}
|
|
1743
1800
|
)
|
|
1744
1801
|
}
|
|
1745
1802
|
)
|
|
1746
|
-
}
|
|
1747
|
-
|
|
1748
|
-
|
|
1803
|
+
] });
|
|
1804
|
+
}
|
|
1805
|
+
);
|
|
1749
1806
|
|
|
1750
1807
|
// src/ui/common/ConversationListHeader.tsx
|
|
1751
1808
|
init_Context();
|
|
@@ -1778,45 +1835,6 @@ var ConversationListPanel_default = ({ header }) => {
|
|
|
1778
1835
|
] });
|
|
1779
1836
|
};
|
|
1780
1837
|
|
|
1781
|
-
// src/ui/common/SenderPromptsItems.tsx
|
|
1782
|
-
init_Context();
|
|
1783
|
-
var SenderPromptsItems_default = () => {
|
|
1784
|
-
const chatStore = useChatStore();
|
|
1785
|
-
const receiverState = valtio.useSnapshot(chatStore.receiver);
|
|
1786
|
-
const component = react.useMemo(
|
|
1787
|
-
() => receiverState.active.config?.labels?.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 4, className: "overflow-hidden", children: [
|
|
1788
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { disabled: true, color: "default", variant: "text", children: "\u968F\u4FBF\u804A\u804A" }),
|
|
1789
|
-
receiverState.active.config.labels.map((question) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1790
|
-
antd.Popover,
|
|
1791
|
-
{
|
|
1792
|
-
content: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1793
|
-
antd.List,
|
|
1794
|
-
{
|
|
1795
|
-
itemLayout: "horizontal",
|
|
1796
|
-
split: false,
|
|
1797
|
-
className: styles_module_default2.senderList,
|
|
1798
|
-
dataSource: question.items,
|
|
1799
|
-
renderItem: (item) => /* @__PURE__ */ jsxRuntime.jsx(antd.List.Item, { onClick: () => chatStore.sendMessage(item.question), className: styles_module_default2.senderListItem, children: item.question }),
|
|
1800
|
-
footer: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "end", className: styles_module_default2.senderListFooter, children: "(\u60A8\u53EF\u70B9\u51FB\u4EE5\u4E0A\u95EE\u9898\u5F00\u542FAI\u4F53\u9A8C)" })
|
|
1801
|
-
}
|
|
1802
|
-
),
|
|
1803
|
-
title: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1804
|
-
"div",
|
|
1805
|
-
{
|
|
1806
|
-
className: classNames7__default.default(styles_module_default2.senderListTitle, "text-ellipsis"),
|
|
1807
|
-
children: `${receiverState.active.name}\u5F00\u59CB\u5173\u6CE8${question.name}\u5185\u5BB9\uFF01`
|
|
1808
|
-
}
|
|
1809
|
-
),
|
|
1810
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { color: "default", variant: "filled", children: question.name })
|
|
1811
|
-
},
|
|
1812
|
-
question.id
|
|
1813
|
-
))
|
|
1814
|
-
] }),
|
|
1815
|
-
[receiverState.active.config?.labels]
|
|
1816
|
-
);
|
|
1817
|
-
return component;
|
|
1818
|
-
};
|
|
1819
|
-
|
|
1820
1838
|
// src/ui/layouts/styles.module.less
|
|
1821
1839
|
var styles_module_default4 = {
|
|
1822
1840
|
nsPreviewHeader: "styles_module_nsPreviewHeader",
|
|
@@ -1827,6 +1845,7 @@ var styles_module_default4 = {
|
|
|
1827
1845
|
};
|
|
1828
1846
|
var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout, config }, ref) => {
|
|
1829
1847
|
const chatStore = react.useMemo(() => createChatStore(), []);
|
|
1848
|
+
const senderRef = react.useRef();
|
|
1830
1849
|
common.useDeepEffect(() => {
|
|
1831
1850
|
if (config?.conversationId) {
|
|
1832
1851
|
chatStore.switchConversation(config.conversationId);
|
|
@@ -1859,7 +1878,10 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
|
|
|
1859
1878
|
createConversation: chatStore.createConversation,
|
|
1860
1879
|
setReferences: chatStore.setReferences,
|
|
1861
1880
|
setMessage: chatStore.setContent,
|
|
1862
|
-
setFiles: chatStore.setFileList
|
|
1881
|
+
setFiles: chatStore.setFileList,
|
|
1882
|
+
senderFocus: (options) => {
|
|
1883
|
+
senderRef.current?.focus(options);
|
|
1884
|
+
}
|
|
1863
1885
|
}),
|
|
1864
1886
|
[]
|
|
1865
1887
|
);
|
|
@@ -1955,14 +1977,7 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
|
|
|
1955
1977
|
] })
|
|
1956
1978
|
}
|
|
1957
1979
|
),
|
|
1958
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1959
|
-
common.RenderWrapper,
|
|
1960
|
-
{
|
|
1961
|
-
control: configState.layout.senderPrompts,
|
|
1962
|
-
DefaultComponent: SenderPromptsItems_default
|
|
1963
|
-
}
|
|
1964
|
-
),
|
|
1965
|
-
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.sender, DefaultComponent: ChatSender_default2 }),
|
|
1980
|
+
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { ref: senderRef, control: configState.layout.sender, DefaultComponent: ChatSender_default2 }),
|
|
1966
1981
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1967
1982
|
common.RenderWrapper,
|
|
1968
1983
|
{
|