@zero-library/chat-copilot 3.1.19 → 3.1.21
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 +29 -39
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +9 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.esm.js +30 -40
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -863,7 +863,7 @@ var ChatInput = React10__namespace.forwardRef(
|
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
865
|
),
|
|
866
|
-
placeholder: !stringValue ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default.promptEditorPlaceholder, children: placeholder || "\u4ECA\u5929\u5E2E\u4F60\u505A\u4E9B\u4EC0\u4E48\uFF1F
|
|
866
|
+
placeholder: !stringValue ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default.promptEditorPlaceholder, children: placeholder || "\u4ECA\u5929\u5E2E\u4F60\u505A\u4E9B\u4EC0\u4E48\uFF1F" }) : null,
|
|
867
867
|
ErrorBoundary: LexicalErrorBoundary.LexicalErrorBoundary
|
|
868
868
|
}
|
|
869
869
|
),
|
|
@@ -1213,17 +1213,6 @@ function createChatStore() {
|
|
|
1213
1213
|
agent.loading = false;
|
|
1214
1214
|
}
|
|
1215
1215
|
};
|
|
1216
|
-
const setAgent = (agentInfo) => {
|
|
1217
|
-
agent.agentInfo = agentInfo;
|
|
1218
|
-
if (agentInfo.agentType === 2 /* AUTONOMOUS */) {
|
|
1219
|
-
setAgentModel({
|
|
1220
|
-
modelName: agent.agentInfo.spec?.model?.modelName || "",
|
|
1221
|
-
providerName: agent.agentInfo.spec?.model?.providerName || ""
|
|
1222
|
-
});
|
|
1223
|
-
} else if (config.layout.userInput) {
|
|
1224
|
-
getUserInput(agent.agentInfo.id);
|
|
1225
|
-
}
|
|
1226
|
-
};
|
|
1227
1216
|
const setUserInput = (userInput) => {
|
|
1228
1217
|
if (agent.agentInfo.agentType === 1 /* FLOW */) {
|
|
1229
1218
|
agent.agentInfo.userInput = userInput;
|
|
@@ -1231,15 +1220,28 @@ function createChatStore() {
|
|
|
1231
1220
|
};
|
|
1232
1221
|
const getAgentInfo = async (id) => {
|
|
1233
1222
|
config.loading = true;
|
|
1234
|
-
if (agent.agentInfo.id === id) return;
|
|
1235
1223
|
try {
|
|
1236
1224
|
const { data } = await config.services.request.fetchAgentInfo(id || "");
|
|
1237
|
-
|
|
1238
|
-
config.hooks?.onAfterSwitchAgent?.(
|
|
1225
|
+
agent.agentInfo = data;
|
|
1226
|
+
config.hooks?.onAfterSwitchAgent?.(agent.agentInfo);
|
|
1239
1227
|
} finally {
|
|
1240
1228
|
config.loading = false;
|
|
1241
1229
|
}
|
|
1242
1230
|
};
|
|
1231
|
+
const setAgent = async (agentInfo) => {
|
|
1232
|
+
if (!agent.agentInfo.id || agent.agentInfo.id !== agentInfo.id) {
|
|
1233
|
+
await getAgentInfo(agentInfo.id);
|
|
1234
|
+
}
|
|
1235
|
+
agent.agentInfo = { ...agent.agentInfo, ...agentInfo };
|
|
1236
|
+
if (agentInfo.agentType === 2 /* AUTONOMOUS */) {
|
|
1237
|
+
setAgentModel({
|
|
1238
|
+
modelName: agent.agentInfo.spec?.model?.modelName || "",
|
|
1239
|
+
providerName: agent.agentInfo.spec?.model?.providerName || ""
|
|
1240
|
+
});
|
|
1241
|
+
} else if (config.layout.userInput) {
|
|
1242
|
+
await getUserInput(agent.agentInfo.id);
|
|
1243
|
+
}
|
|
1244
|
+
};
|
|
1243
1245
|
const conversations = valtio.proxy({
|
|
1244
1246
|
/** 会话列表数据 */
|
|
1245
1247
|
list: {
|
|
@@ -1347,6 +1349,7 @@ function createChatStore() {
|
|
|
1347
1349
|
id: data || "",
|
|
1348
1350
|
title: "",
|
|
1349
1351
|
agentId: agent.agentInfo?.id || "",
|
|
1352
|
+
isFavorite: false,
|
|
1350
1353
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1351
1354
|
spec: newSpec
|
|
1352
1355
|
});
|
|
@@ -2266,7 +2269,7 @@ var ConversationFavoritesBtn_default = ({ icon, ...rest }) => {
|
|
|
2266
2269
|
const activeConversation = React10.useMemo(() => {
|
|
2267
2270
|
return conversationsState.list.items.find((item) => item.id === conversationState.active.id);
|
|
2268
2271
|
}, [conversationsState.list.items, conversationState.active.id]);
|
|
2269
|
-
const isFavorite = activeConversation?.isFavorite
|
|
2272
|
+
const isFavorite = activeConversation?.isFavorite;
|
|
2270
2273
|
const handleToggleFavorite = () => {
|
|
2271
2274
|
if (!conversationState.active.id) return;
|
|
2272
2275
|
chatStore.collectConversation(conversationState.active.id, !isFavorite);
|
|
@@ -2291,7 +2294,7 @@ var ConversationShareBtn_default = ({ icon, ...rest }) => {
|
|
|
2291
2294
|
const handleShareConversation = async () => {
|
|
2292
2295
|
const { data } = await configState.services.request.shareConversation(conversationState.active.id);
|
|
2293
2296
|
if (data) {
|
|
2294
|
-
common.copyText(data.url);
|
|
2297
|
+
common.copyText(data.url, "\u94FE\u63A5\u5DF2\u590D\u5236\uFF0C\u53EF\u76F4\u63A5\u7C98\u8D34\u5206\u4EAB");
|
|
2295
2298
|
}
|
|
2296
2299
|
};
|
|
2297
2300
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2321,6 +2324,7 @@ var styles_module_default2 = {
|
|
|
2321
2324
|
chatHeaderBtnGroup: "styles_module_chatHeaderBtnGroup",
|
|
2322
2325
|
conversationListPanel: "styles_module_conversationListPanel",
|
|
2323
2326
|
createConversationButton: "styles_module_createConversationButton",
|
|
2327
|
+
conversationListContent: "styles_module_conversationListContent",
|
|
2324
2328
|
conversations: "styles_module_conversations",
|
|
2325
2329
|
conversationTabs: "styles_module_conversationTabs",
|
|
2326
2330
|
conversationTabPane: "styles_module_conversationTabPane",
|
|
@@ -2617,9 +2621,9 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
2617
2621
|
] });
|
|
2618
2622
|
};
|
|
2619
2623
|
var ConversationListPanel = ({ header }) => {
|
|
2620
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames2__default.default("
|
|
2624
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames2__default.default("zero-chat-conversations", styles_module_default2.conversationListPanel), children: [
|
|
2621
2625
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
|
|
2622
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
2626
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.conversationListContent, children: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}) })
|
|
2623
2627
|
] });
|
|
2624
2628
|
};
|
|
2625
2629
|
var ConversationListPanel_default = ConversationListPanel;
|
|
@@ -6077,7 +6081,8 @@ var ChatSender_default2 = React10.forwardRef(
|
|
|
6077
6081
|
skillsBtn = false,
|
|
6078
6082
|
knowledgeBtn = false,
|
|
6079
6083
|
modelSelect = false,
|
|
6080
|
-
commandConfig
|
|
6084
|
+
commandConfig,
|
|
6085
|
+
uploadConfig
|
|
6081
6086
|
}, ref) => {
|
|
6082
6087
|
const chatStore = useChatStore();
|
|
6083
6088
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
@@ -6124,7 +6129,7 @@ var ChatSender_default2 = React10.forwardRef(
|
|
|
6124
6129
|
onFocus: chatStore.config.hooks?.onSenderFocus,
|
|
6125
6130
|
fileUpload: {
|
|
6126
6131
|
request: fileUploadRequest,
|
|
6127
|
-
config: agentState.agentInfo.config?.options?.fileUpload
|
|
6132
|
+
config: uploadConfig || agentState.agentInfo.config?.options?.fileUpload
|
|
6128
6133
|
},
|
|
6129
6134
|
sendBtnProps: common.isFunction(sendBtnProps) ? sendBtnProps() : {},
|
|
6130
6135
|
extraFooterBelow: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: footerBelow }),
|
|
@@ -6632,25 +6637,10 @@ var layouts_default = React10.forwardRef(({ theme: theme5, params, hooks, layout
|
|
|
6632
6637
|
chatStore.setServices(services);
|
|
6633
6638
|
}, [services]);
|
|
6634
6639
|
common.useDeepEffect(() => {
|
|
6635
|
-
if (
|
|
6636
|
-
chatStore.setAgent(
|
|
6637
|
-
}
|
|
6638
|
-
}, [agentState.agentInfo.id, config.agent?.spec]);
|
|
6639
|
-
common.useDeepEffect(() => {
|
|
6640
|
-
if (agentState.agentInfo.id && common.isObject(config.agent?.config)) {
|
|
6641
|
-
chatStore.setAgent({ ...agentState.agentInfo, config: config.agent.config || {} });
|
|
6642
|
-
}
|
|
6643
|
-
}, [agentState.agentInfo.id, config.agent?.config]);
|
|
6644
|
-
common.useDeepEffect(() => {
|
|
6645
|
-
if (agentState.agentInfo.id) {
|
|
6646
|
-
chatStore.setUserInput(config.agent.userInput);
|
|
6647
|
-
}
|
|
6648
|
-
}, [agentState.agentInfo.id, config.agent?.userInput]);
|
|
6649
|
-
common.useDeepEffect(() => {
|
|
6650
|
-
if (config?.agent?.id) {
|
|
6651
|
-
chatStore.getAgentInfo(config.agent.id);
|
|
6640
|
+
if (config.agent) {
|
|
6641
|
+
chatStore.setAgent(config.agent);
|
|
6652
6642
|
}
|
|
6653
|
-
}, [config.agent
|
|
6643
|
+
}, [config.agent]);
|
|
6654
6644
|
common.useDeepEffect(() => {
|
|
6655
6645
|
if (agentState.agentInfo.id) {
|
|
6656
6646
|
chatStore.initConversation(config);
|