@zero-library/chat-agent 2.1.6 → 2.1.8
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 +20 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +46 -6
- package/dist/index.d.ts +46 -6
- package/dist/index.esm.js +13 -7
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -427,7 +427,7 @@ function createChatStore() {
|
|
|
427
427
|
const defaultLayout = receiverType === 3 ? defaultAgentLayout : defaultExpertLayout;
|
|
428
428
|
config.layout = common.deepMerge(defaultLayout, layout);
|
|
429
429
|
};
|
|
430
|
-
const
|
|
430
|
+
const setParams = (params = {}) => {
|
|
431
431
|
config.params = { ...params };
|
|
432
432
|
};
|
|
433
433
|
const setHooks = (hooks = {}) => {
|
|
@@ -489,6 +489,7 @@ function createChatStore() {
|
|
|
489
489
|
}
|
|
490
490
|
config.hooks?.onAfterSwitchAgent?.(data);
|
|
491
491
|
} catch (error) {
|
|
492
|
+
console.error(error);
|
|
492
493
|
throw error;
|
|
493
494
|
} finally {
|
|
494
495
|
receiver.loading = false;
|
|
@@ -514,10 +515,13 @@ function createChatStore() {
|
|
|
514
515
|
const getCharacters = async (agentId) => {
|
|
515
516
|
try {
|
|
516
517
|
character.loading = true;
|
|
517
|
-
const
|
|
518
|
+
const { data } = await agentCharacterQuery(agentId);
|
|
518
519
|
if (receiver.active.id !== agentId) return;
|
|
519
|
-
character.list =
|
|
520
|
-
|
|
520
|
+
character.list = data;
|
|
521
|
+
const active = data.find((item) => item.selected);
|
|
522
|
+
if (active) {
|
|
523
|
+
character.active = active;
|
|
524
|
+
}
|
|
521
525
|
} finally {
|
|
522
526
|
character.loading = false;
|
|
523
527
|
}
|
|
@@ -886,7 +890,7 @@ function createChatStore() {
|
|
|
886
890
|
setPreview,
|
|
887
891
|
setLayout,
|
|
888
892
|
setHooks,
|
|
889
|
-
|
|
893
|
+
setParams,
|
|
890
894
|
setUserInfo,
|
|
891
895
|
character,
|
|
892
896
|
getCharacters,
|
|
@@ -1862,7 +1866,7 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
|
|
|
1862
1866
|
chatStore.setLayout(layout, config?.receiverType);
|
|
1863
1867
|
}, [layout, config?.receiverType]);
|
|
1864
1868
|
react.useEffect(() => {
|
|
1865
|
-
chatStore.
|
|
1869
|
+
chatStore.setParams(params);
|
|
1866
1870
|
}, [params]);
|
|
1867
1871
|
react.useEffect(() => {
|
|
1868
1872
|
chatStore.setHooks(hooks);
|
|
@@ -1879,6 +1883,7 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
|
|
|
1879
1883
|
setReferences: chatStore.setReferences,
|
|
1880
1884
|
setMessage: chatStore.setContent,
|
|
1881
1885
|
setFiles: chatStore.setFileList,
|
|
1886
|
+
setParams: chatStore.setParams,
|
|
1882
1887
|
senderFocus: (options) => {
|
|
1883
1888
|
senderRef.current?.focus(options);
|
|
1884
1889
|
}
|
|
@@ -1994,6 +1999,15 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
|
|
|
1994
1999
|
] }) }) }) });
|
|
1995
2000
|
});
|
|
1996
2001
|
|
|
2002
|
+
exports.Attachments = Attachments_default;
|
|
1997
2003
|
exports.ChatCopilot = layouts_default;
|
|
2004
|
+
exports.ChatSender = ChatSender_default;
|
|
2005
|
+
exports.MessageRender = MessageRender_default;
|
|
2006
|
+
Object.keys(x).forEach(function (k) {
|
|
2007
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
2008
|
+
enumerable: true,
|
|
2009
|
+
get: function () { return x[k]; }
|
|
2010
|
+
});
|
|
2011
|
+
});
|
|
1998
2012
|
//# sourceMappingURL=index.cjs.js.map
|
|
1999
2013
|
//# sourceMappingURL=index.cjs.js.map
|