@zero-library/chat-copilot 1.0.6 → 1.0.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 +79 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +22 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.esm.js +82 -15
- package/dist/index.esm.js.map +1 -1
- package/package.json +4 -3
package/dist/index.cjs.js
CHANGED
|
@@ -503,13 +503,6 @@ function createChatStore() {
|
|
|
503
503
|
const getModels = async () => {
|
|
504
504
|
const { data } = await config.services.request.fetchModelList();
|
|
505
505
|
config.models = data;
|
|
506
|
-
if (data?.length) {
|
|
507
|
-
setAgentModel({
|
|
508
|
-
providerName: data[0].providerName,
|
|
509
|
-
modelName: data[0].models[0].modelName,
|
|
510
|
-
reasoning: true
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
506
|
};
|
|
514
507
|
const setServices = ({ http, websocket } = {}) => {
|
|
515
508
|
const httpConfig = { baseURL: "/luya/v1", headers: { [TOKEN_KEY]: tokenManager.get() }, ...http?.config };
|
|
@@ -590,7 +583,7 @@ function createChatStore() {
|
|
|
590
583
|
loading: false
|
|
591
584
|
});
|
|
592
585
|
const setAgentModel = (model) => {
|
|
593
|
-
agent.model = model;
|
|
586
|
+
agent.model = { ...agent.model, ...model };
|
|
594
587
|
};
|
|
595
588
|
const getUserInput = async (agentId) => {
|
|
596
589
|
agent.loading = true;
|
|
@@ -605,6 +598,12 @@ function createChatStore() {
|
|
|
605
598
|
};
|
|
606
599
|
const setAgent = (agentInfo) => {
|
|
607
600
|
agent.agentInfo = agentInfo;
|
|
601
|
+
if (agentInfo.agentType === 2 /* AUTONOMOUS */) {
|
|
602
|
+
setAgentModel({
|
|
603
|
+
modelName: agent.agentInfo.spec?.model?.modelName || "",
|
|
604
|
+
providerName: agent.agentInfo.spec?.model?.providerName || ""
|
|
605
|
+
});
|
|
606
|
+
}
|
|
608
607
|
};
|
|
609
608
|
const setUserInput = (userInput) => {
|
|
610
609
|
if (config.params?.convMeta?.mode === CONV_MODE.PROD && agent.agentInfo.agentType === 1 /* FLOW */) {
|
|
@@ -619,6 +618,12 @@ function createChatStore() {
|
|
|
619
618
|
try {
|
|
620
619
|
const { data } = await config.services.request.fetchAgentInfo(id || "");
|
|
621
620
|
agent.agentInfo = data;
|
|
621
|
+
if (agent.agentInfo.agentType === 2 /* AUTONOMOUS */) {
|
|
622
|
+
setAgentModel({
|
|
623
|
+
modelName: agent.agentInfo.spec?.model?.modelName || "",
|
|
624
|
+
providerName: agent.agentInfo.spec?.model?.providerName || ""
|
|
625
|
+
});
|
|
626
|
+
}
|
|
622
627
|
config.hooks?.onAfterSwitchAgent?.(data);
|
|
623
628
|
} finally {
|
|
624
629
|
config.loading = false;
|
|
@@ -680,7 +685,7 @@ function createChatStore() {
|
|
|
680
685
|
if (config2?.conversationId) {
|
|
681
686
|
switchConversation(config2.conversationId);
|
|
682
687
|
} else {
|
|
683
|
-
if (config2.conversationStrategy === 1) {
|
|
688
|
+
if (config2.conversationStrategy === 1 && conversations.list.items.length > 0) {
|
|
684
689
|
switchConversation(conversations.list.items[0].key);
|
|
685
690
|
} else {
|
|
686
691
|
createConversation();
|
|
@@ -741,7 +746,6 @@ function createChatStore() {
|
|
|
741
746
|
spec: newSpec
|
|
742
747
|
});
|
|
743
748
|
await switchConversation(data);
|
|
744
|
-
config.hooks?.onAfterSwitchConversation?.(data);
|
|
745
749
|
};
|
|
746
750
|
const conversation = valtio.proxy({
|
|
747
751
|
/** 当前激活的会话信息 */
|
|
@@ -1941,7 +1945,10 @@ var styles_module_default3 = {
|
|
|
1941
1945
|
fileEdit: "styles_module_fileEdit",
|
|
1942
1946
|
fileEditHeader: "styles_module_fileEditHeader",
|
|
1943
1947
|
fileEditContent: "styles_module_fileEditContent",
|
|
1944
|
-
mdEdit: "styles_module_mdEdit"
|
|
1948
|
+
mdEdit: "styles_module_mdEdit",
|
|
1949
|
+
chart: "styles_module_chart",
|
|
1950
|
+
chartSkeleton: "styles_module_chartSkeleton",
|
|
1951
|
+
chartSkeletonIcon: "styles_module_chartSkeletonIcon"
|
|
1945
1952
|
};
|
|
1946
1953
|
var AppCard_default = ({ data, loading }) => {
|
|
1947
1954
|
const chatStore = useChatStore();
|
|
@@ -1959,6 +1966,65 @@ var AppCard_default = ({ data, loading }) => {
|
|
|
1959
1966
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ellipsis", title: data.appName, children: data.appName })
|
|
1960
1967
|
] }) });
|
|
1961
1968
|
};
|
|
1969
|
+
var chartTypes = [
|
|
1970
|
+
"Line",
|
|
1971
|
+
"Column",
|
|
1972
|
+
"Bar",
|
|
1973
|
+
"Area",
|
|
1974
|
+
"Pie",
|
|
1975
|
+
"DualAxes",
|
|
1976
|
+
"Scatter",
|
|
1977
|
+
"WordCloud",
|
|
1978
|
+
"Funnel",
|
|
1979
|
+
"Heatmap",
|
|
1980
|
+
"Histogram",
|
|
1981
|
+
"Liquid",
|
|
1982
|
+
"BidirectionalBar",
|
|
1983
|
+
"Box",
|
|
1984
|
+
"Bullet",
|
|
1985
|
+
"CirclePacking",
|
|
1986
|
+
"Gauge",
|
|
1987
|
+
"Radar",
|
|
1988
|
+
"Rose",
|
|
1989
|
+
"Sankey",
|
|
1990
|
+
"Stock",
|
|
1991
|
+
"Sunburst",
|
|
1992
|
+
"Treemap",
|
|
1993
|
+
"Venn",
|
|
1994
|
+
"Waterfall",
|
|
1995
|
+
"MindMap",
|
|
1996
|
+
"Fishbone",
|
|
1997
|
+
"IndentedTree",
|
|
1998
|
+
"Dendrogram",
|
|
1999
|
+
"OrganizationChart",
|
|
2000
|
+
"FlowGraph",
|
|
2001
|
+
"FlowDirectionGraph",
|
|
2002
|
+
"NetworkGraph"
|
|
2003
|
+
// …如果还有其他图表也继续加
|
|
2004
|
+
];
|
|
2005
|
+
var CHART_COMPONENTS = Object.fromEntries(
|
|
2006
|
+
chartTypes.map((type) => [
|
|
2007
|
+
type,
|
|
2008
|
+
() => import('@ant-design/charts').then((mod) => ({
|
|
2009
|
+
default: mod[type]
|
|
2010
|
+
}))
|
|
2011
|
+
])
|
|
2012
|
+
);
|
|
2013
|
+
var Charts_default = ({ data, loading }) => {
|
|
2014
|
+
const { type, config } = data;
|
|
2015
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames2__default.default(styles_module_default3.chart, "scroll-fade-in"), children: loading ? (
|
|
2016
|
+
// Antd 骨架屏
|
|
2017
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Skeleton.Node, { active: true, className: styles_module_default3.chartSkeleton, children: /* @__PURE__ */ jsxRuntime.jsx(icons.DotChartOutlined, { className: styles_module_default3.chartSkeletonIcon }) })
|
|
2018
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2019
|
+
common.LazyComponent,
|
|
2020
|
+
{
|
|
2021
|
+
type,
|
|
2022
|
+
...config,
|
|
2023
|
+
customComponents: CHART_COMPONENTS,
|
|
2024
|
+
unknownContent: /* @__PURE__ */ jsxRuntime.jsx(antd.Alert, { title: "\u4E0D\u652F\u6301\u7684\u56FE\u8868", description: `\u5F53\u524D\u56FE\u8868\u7C7B\u578B "${type}" \u6682\u672A\u5B9E\u73B0\uFF0C\u8BF7\u68C0\u67E5\u56FE\u8868\u7C7B\u578B\u662F\u5426\u6B63\u786E\u3002`, type: "warning", showIcon: true })
|
|
2025
|
+
}
|
|
2026
|
+
) });
|
|
2027
|
+
};
|
|
1962
2028
|
var CodeHighlight_default = ({ className, data }) => {
|
|
1963
2029
|
const lang = className?.match(/language-(\w+)/)?.[1] || "";
|
|
1964
2030
|
if (typeof data !== "string") return null;
|
|
@@ -2119,6 +2185,7 @@ var XMarkdown_default = ({ message: message3, components, content, ...rest }) =>
|
|
|
2119
2185
|
a: PreviewLink_default,
|
|
2120
2186
|
appcard: AppCard_default,
|
|
2121
2187
|
fileview: FileView_default,
|
|
2188
|
+
charts: Charts_default,
|
|
2122
2189
|
// indexquote: IndexQuote,
|
|
2123
2190
|
mdedit: MdEdit_default,
|
|
2124
2191
|
fileedit: FileEdit_default,
|
|
@@ -4221,7 +4288,7 @@ var FeaturesRenderer_default = ({ skillsBtn, knowledgeBtn }) => {
|
|
|
4221
4288
|
const chatStore = useChatStore();
|
|
4222
4289
|
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
4223
4290
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4224
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4291
|
+
agentState.agentInfo.agentType === 2 /* AUTONOMOUS */ && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4225
4292
|
antd.Flex,
|
|
4226
4293
|
{
|
|
4227
4294
|
className: classNames2__default.default(styles_module_default2.resourceBtn, { [styles_module_default2.resourceBtnActive]: agentState.model.reasoning }),
|