@zero-library/chat-copilot 3.1.28 → 3.1.29
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 +31 -48
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +32 -49
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1193,18 +1193,6 @@ function createChatStore() {
|
|
|
1193
1193
|
/** 智能体加载状态 */
|
|
1194
1194
|
loading: false
|
|
1195
1195
|
});
|
|
1196
|
-
const setAgentModel = (updater) => {
|
|
1197
|
-
const prevModel = agent.agentInfo.spec?.model || {
|
|
1198
|
-
modelName: "",
|
|
1199
|
-
providerName: "",
|
|
1200
|
-
reasoning: true
|
|
1201
|
-
};
|
|
1202
|
-
const nextPatch = typeof updater === "function" ? updater(prevModel) : updater;
|
|
1203
|
-
const nextSpec = common.deepCopy(agent.agentInfo.spec || {});
|
|
1204
|
-
nextSpec.model = { ...prevModel, ...nextPatch };
|
|
1205
|
-
agent.agentInfo.spec = nextSpec;
|
|
1206
|
-
config.hooks?.onAfterSwitchModel?.(agent.agentInfo.spec.model);
|
|
1207
|
-
};
|
|
1208
1196
|
const getUserInput = async (agentId) => {
|
|
1209
1197
|
agent.loading = true;
|
|
1210
1198
|
try {
|
|
@@ -1226,19 +1214,19 @@ function createChatStore() {
|
|
|
1226
1214
|
try {
|
|
1227
1215
|
const { data } = await config.services.request.fetchAgentInfo(id || "");
|
|
1228
1216
|
agent.agentInfo = data;
|
|
1229
|
-
config.hooks?.onAfterSwitchAgent?.(agent.agentInfo);
|
|
1230
1217
|
} finally {
|
|
1231
1218
|
config.loading = false;
|
|
1232
1219
|
}
|
|
1233
1220
|
};
|
|
1234
1221
|
const setAgent = async (agentInfo) => {
|
|
1235
|
-
if (!agent.agentInfo.id && !agentInfo.updatedAt || agent.agentInfo.id !== agentInfo.id) {
|
|
1222
|
+
if (!agent.agentInfo.id && !agentInfo.updatedAt || agent.agentInfo.id && agent.agentInfo.id !== agentInfo.id) {
|
|
1236
1223
|
await getAgentInfo(agentInfo.id);
|
|
1237
1224
|
}
|
|
1238
1225
|
agent.agentInfo = { ...agent.agentInfo, ...agentInfo };
|
|
1239
1226
|
if (config.layout.userInput) {
|
|
1240
1227
|
await getUserInput(agent.agentInfo.id);
|
|
1241
1228
|
}
|
|
1229
|
+
config.hooks?.onAfterSwitchAgent?.(agent.agentInfo);
|
|
1242
1230
|
};
|
|
1243
1231
|
const conversations = valtio.proxy({
|
|
1244
1232
|
/** 会话列表数据 */
|
|
@@ -2071,7 +2059,11 @@ function createChatStore() {
|
|
|
2071
2059
|
files,
|
|
2072
2060
|
spec: {
|
|
2073
2061
|
...conversation.active.spec,
|
|
2074
|
-
model:
|
|
2062
|
+
model: {
|
|
2063
|
+
providerName: agent.agentInfo.spec?.model?.providerName || "",
|
|
2064
|
+
modelName: agent.agentInfo.spec?.model?.modelName || "",
|
|
2065
|
+
reasoning: agent.agentInfo.spec?.model?.reasoning ?? false
|
|
2066
|
+
}
|
|
2075
2067
|
},
|
|
2076
2068
|
stream: true,
|
|
2077
2069
|
responseMode: 2
|
|
@@ -2140,8 +2132,6 @@ function createChatStore() {
|
|
|
2140
2132
|
setServices,
|
|
2141
2133
|
/** 智能体状态 */
|
|
2142
2134
|
agent,
|
|
2143
|
-
/** 设置智能体模型 */
|
|
2144
|
-
setAgentModel,
|
|
2145
2135
|
/** 设置文件预览 */
|
|
2146
2136
|
setPreview,
|
|
2147
2137
|
/** 设置参数 */
|
|
@@ -6022,16 +6012,16 @@ var ModelSelect_default = ({}) => {
|
|
|
6022
6012
|
const currentModel = agentState.agentInfo.spec?.model;
|
|
6023
6013
|
const updateAgentModel = React10.useCallback(
|
|
6024
6014
|
(model) => {
|
|
6025
|
-
const nextAgentInfo =
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6015
|
+
const nextAgentInfo = {
|
|
6016
|
+
...agentState.agentInfo,
|
|
6017
|
+
spec: {
|
|
6018
|
+
...agentState.agentInfo.spec,
|
|
6019
|
+
model: {
|
|
6020
|
+
...agentState.agentInfo.spec?.model,
|
|
6021
|
+
...model
|
|
6022
|
+
}
|
|
6023
|
+
}
|
|
6033
6024
|
};
|
|
6034
|
-
nextAgentInfo.spec = nextSpec;
|
|
6035
6025
|
chatStore.setAgent(nextAgentInfo);
|
|
6036
6026
|
},
|
|
6037
6027
|
[agentState.agentInfo, chatStore]
|
|
@@ -6094,34 +6084,27 @@ var ModelSelect_default = ({}) => {
|
|
|
6094
6084
|
}
|
|
6095
6085
|
);
|
|
6096
6086
|
};
|
|
6097
|
-
var ReasonBtn_default = (
|
|
6087
|
+
var ReasonBtn_default = () => {
|
|
6098
6088
|
const chatStore = useChatStore();
|
|
6099
6089
|
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
6100
6090
|
const currentModel = agentState.agentInfo.spec?.model;
|
|
6101
|
-
const
|
|
6102
|
-
const nextAgentInfo =
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6091
|
+
const toggleReasoning = () => {
|
|
6092
|
+
const nextAgentInfo = {
|
|
6093
|
+
...agentState.agentInfo,
|
|
6094
|
+
spec: {
|
|
6095
|
+
...agentState.agentInfo.spec,
|
|
6096
|
+
model: {
|
|
6097
|
+
...agentState.agentInfo.spec?.model,
|
|
6098
|
+
reasoning: !currentModel?.reasoning
|
|
6099
|
+
}
|
|
6100
|
+
}
|
|
6109
6101
|
};
|
|
6110
|
-
nextSpec.model.reasoning = reasoning;
|
|
6111
|
-
nextAgentInfo.spec = nextSpec;
|
|
6112
6102
|
chatStore.setAgent(nextAgentInfo);
|
|
6113
6103
|
};
|
|
6114
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6115
|
-
"
|
|
6116
|
-
{
|
|
6117
|
-
|
|
6118
|
-
onClick: () => updateAgentModel(!currentModel?.reasoning),
|
|
6119
|
-
children: [
|
|
6120
|
-
/* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-reason" }),
|
|
6121
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u6DF1\u5EA6\u601D\u8003" })
|
|
6122
|
-
]
|
|
6123
|
-
}
|
|
6124
|
-
);
|
|
6104
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames2__default.default(style_module_default.resourceBtn, { [style_module_default.resourceBtnActive]: currentModel?.reasoning }), onClick: toggleReasoning, children: [
|
|
6105
|
+
/* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-reason" }),
|
|
6106
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u6DF1\u5EA6\u601D\u8003" })
|
|
6107
|
+
] });
|
|
6125
6108
|
};
|
|
6126
6109
|
var { Text: Text7 } = antd.Typography;
|
|
6127
6110
|
var SkillBtn_default = ({}) => {
|