sand-components-vben 2.5.7 → 2.5.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/package.json +1 -1
- package/sand-components-vben.js +58 -37
- package/sand-components-vben.umd.cjs +91 -91
package/package.json
CHANGED
package/sand-components-vben.js
CHANGED
|
@@ -39147,59 +39147,77 @@ function ioe() {
|
|
|
39147
39147
|
// 思考内容
|
|
39148
39148
|
thinkIng: !1
|
|
39149
39149
|
// 是否正在思考
|
|
39150
|
-
}), { isStreaming: t, streamContent: n, currentRequestId: r, conversationId: a, thinkContent: i, thinkIng: o } = Wn(e), s = (
|
|
39150
|
+
}), { isStreaming: t, streamContent: n, currentRequestId: r, conversationId: a, thinkContent: i, thinkIng: o } = Wn(e), s = (f, p, m, g) => {
|
|
39151
39151
|
try {
|
|
39152
|
-
if (typeof
|
|
39153
|
-
|
|
39154
|
-
|
|
39152
|
+
if (typeof f == "object" && f !== null && f.conversationId !== a.value && (a.value = f.conversationId), typeof f == "object" && f !== null) {
|
|
39153
|
+
if (f.event === "message") {
|
|
39154
|
+
const v = f.answer;
|
|
39155
|
+
v && (n.value += v, m && m(n.value));
|
|
39156
|
+
} else if (f.event === "message_end") {
|
|
39157
|
+
console.log("流式消息接收完成"), t.value = !1, r.value = null, g && g(n.value);
|
|
39158
|
+
return;
|
|
39159
|
+
} else if (f.event === "error")
|
|
39160
|
+
throw console.error("流式请求出现错误:", f.message || "未知错误"), t.value = !1, r.value = null, new Error(f.message || "流式请求出现错误");
|
|
39155
39161
|
}
|
|
39156
|
-
} catch (
|
|
39157
|
-
console.error("处理流式消息失败:",
|
|
39162
|
+
} catch (v) {
|
|
39163
|
+
console.error("处理流式消息失败:", v), typeof p == "string" && (n.value += p, m && m(n.value));
|
|
39158
39164
|
}
|
|
39159
|
-
}, u = async (
|
|
39165
|
+
}, u = async (f = {}) => {
|
|
39160
39166
|
const {
|
|
39161
|
-
sceneId:
|
|
39162
|
-
extra:
|
|
39163
|
-
conversationId:
|
|
39164
|
-
describe:
|
|
39165
|
-
onContentUpdate:
|
|
39166
|
-
onError:
|
|
39167
|
-
onComplete:
|
|
39168
|
-
onOpen:
|
|
39169
|
-
} =
|
|
39167
|
+
sceneId: p,
|
|
39168
|
+
extra: m = {},
|
|
39169
|
+
conversationId: g,
|
|
39170
|
+
describe: v,
|
|
39171
|
+
onContentUpdate: h,
|
|
39172
|
+
onError: b,
|
|
39173
|
+
onComplete: y,
|
|
39174
|
+
onOpen: A
|
|
39175
|
+
} = f;
|
|
39170
39176
|
n.value = "", t.value = !0;
|
|
39171
|
-
const
|
|
39172
|
-
r.value =
|
|
39173
|
-
const
|
|
39174
|
-
id:
|
|
39175
|
-
dict:
|
|
39177
|
+
const O = Date.now().toString();
|
|
39178
|
+
r.value = O;
|
|
39179
|
+
const T = {
|
|
39180
|
+
id: p,
|
|
39181
|
+
dict: m
|
|
39176
39182
|
};
|
|
39177
|
-
|
|
39183
|
+
g && (T.conversationId = g), v && (T.describe = v);
|
|
39178
39184
|
try {
|
|
39179
|
-
const
|
|
39180
|
-
return await Im.createSseRequest(
|
|
39181
|
-
data:
|
|
39182
|
-
requestId:
|
|
39183
|
-
onMessage: (
|
|
39184
|
-
|
|
39185
|
-
|
|
39186
|
-
|
|
39187
|
-
|
|
39185
|
+
const x = Gke();
|
|
39186
|
+
return await Im.createSseRequest(x, {
|
|
39187
|
+
data: T,
|
|
39188
|
+
requestId: O,
|
|
39189
|
+
onMessage: (E, N) => {
|
|
39190
|
+
if (E.event === "message")
|
|
39191
|
+
if (E.answer.includes("<think>")) {
|
|
39192
|
+
o.value = !0;
|
|
39193
|
+
const D = E.answer.indexOf("<think>"), w = E.answer.substring(0, D), C = E.answer.substring(D + 7);
|
|
39194
|
+
w ? E.answer = w : E.answer = "", C && (i.value += C);
|
|
39195
|
+
} else if (E.answer.includes("</think>")) {
|
|
39196
|
+
o.value = !1;
|
|
39197
|
+
const D = E.answer.indexOf("</think>"), w = E.answer.substring(0, D), C = E.answer.substring(D + 8);
|
|
39198
|
+
w && (i.value += w), E.answer = C || "";
|
|
39199
|
+
} else o.value && (i.value += E.answer, E.answer = "");
|
|
39200
|
+
s(E, N, h, y);
|
|
39201
|
+
},
|
|
39202
|
+
onError: (E) => {
|
|
39203
|
+
console.error("流式请求失败:", E), t.value = !1, r.value = null, b && b(E);
|
|
39188
39204
|
},
|
|
39189
39205
|
onComplete: () => {
|
|
39190
|
-
console.log("流式请求完成"), t.value = !1, r.value = null,
|
|
39206
|
+
console.log("流式请求完成"), t.value = !1, r.value = null, y && y(n.value);
|
|
39191
39207
|
},
|
|
39192
39208
|
onOpen: () => {
|
|
39193
|
-
console.log("流式连接已建立"),
|
|
39209
|
+
console.log("流式连接已建立"), A && A();
|
|
39194
39210
|
}
|
|
39195
|
-
}),
|
|
39196
|
-
} catch (
|
|
39197
|
-
throw console.error("创建流式请求失败:",
|
|
39211
|
+
}), O;
|
|
39212
|
+
} catch (x) {
|
|
39213
|
+
throw console.error("创建流式请求失败:", x), t.value = !1, r.value = null, x;
|
|
39198
39214
|
}
|
|
39199
39215
|
}, c = () => {
|
|
39200
39216
|
r.value && (Im.cancelRequest(r.value), t.value = !1, r.value = null);
|
|
39201
39217
|
}, l = () => {
|
|
39202
|
-
n.value = "", t.value = !1, r.value = null;
|
|
39218
|
+
n.value = "", t.value = !1, r.value = null, i.value = "", o.value = !1;
|
|
39219
|
+
}, d = () => {
|
|
39220
|
+
i.value = "", o.value = !1;
|
|
39203
39221
|
};
|
|
39204
39222
|
return Uv(() => {
|
|
39205
39223
|
c();
|
|
@@ -39209,10 +39227,13 @@ function ioe() {
|
|
|
39209
39227
|
streamContent: n,
|
|
39210
39228
|
currentRequestId: r,
|
|
39211
39229
|
conversationId: a,
|
|
39230
|
+
thinkContent: i,
|
|
39231
|
+
thinkIng: o,
|
|
39212
39232
|
// 方法
|
|
39213
39233
|
createStreamRequest: u,
|
|
39214
39234
|
cancelCurrentRequest: c,
|
|
39215
39235
|
resetStreamState: l,
|
|
39236
|
+
resetThinkContent: d,
|
|
39216
39237
|
handleStreamMessage: s
|
|
39217
39238
|
};
|
|
39218
39239
|
}
|