page-agent-sdk 1.3.10 → 1.3.12
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/README.md +18 -0
- package/README.zh-CN.md +18 -0
- package/dist/page-agent-sdk.css +1 -1
- package/dist/page-agent-sdk.iife.js +22 -22
- package/dist/page-agent-sdk.js +121 -115
- package/dist/page-agent-sdk.umd.cjs +15 -15
- package/package.json +1 -1
package/dist/page-agent-sdk.js
CHANGED
|
@@ -4085,21 +4085,25 @@ function xl(e = {}) {
|
|
|
4085
4085
|
messages: e.messages ?? [],
|
|
4086
4086
|
loading: !1,
|
|
4087
4087
|
error: null
|
|
4088
|
-
}), o = /* @__PURE__ */ fn(null), s = /* @__PURE__ */ fn(
|
|
4089
|
-
function
|
|
4088
|
+
}), o = /* @__PURE__ */ fn(null), s = /* @__PURE__ */ fn(!0), c = null, l = /* @__PURE__ */ fn(null);
|
|
4089
|
+
function u() {
|
|
4090
|
+
let e = o.value;
|
|
4091
|
+
e && (s.value = e.scrollHeight - e.scrollTop - e.clientHeight < 64);
|
|
4092
|
+
}
|
|
4093
|
+
function d() {
|
|
4090
4094
|
Xn(() => {
|
|
4091
|
-
o.value && (o.value.scrollTop = o.value.scrollHeight);
|
|
4095
|
+
o.value && s.value && (o.value.scrollTop = o.value.scrollHeight);
|
|
4092
4096
|
});
|
|
4093
4097
|
}
|
|
4094
|
-
function
|
|
4098
|
+
function f(e, t) {
|
|
4095
4099
|
a.messages.push({
|
|
4096
4100
|
role: e,
|
|
4097
4101
|
content: t,
|
|
4098
4102
|
timestamp: Date.now()
|
|
4099
|
-
}),
|
|
4103
|
+
}), s.value = !0, d();
|
|
4100
4104
|
}
|
|
4101
|
-
async function
|
|
4102
|
-
if (n) {
|
|
4105
|
+
async function p(e) {
|
|
4106
|
+
if (s.value = !0, n) {
|
|
4103
4107
|
let t = /* @__PURE__ */ Qt({
|
|
4104
4108
|
role: "assistant",
|
|
4105
4109
|
content: "",
|
|
@@ -4150,14 +4154,14 @@ function xl(e = {}) {
|
|
|
4150
4154
|
break;
|
|
4151
4155
|
}
|
|
4152
4156
|
case "approval_request":
|
|
4153
|
-
|
|
4157
|
+
l.value = {
|
|
4154
4158
|
toolName: e.toolName,
|
|
4155
4159
|
args: e.args,
|
|
4156
4160
|
resolve: e.resolve
|
|
4157
4161
|
};
|
|
4158
4162
|
break;
|
|
4159
4163
|
}
|
|
4160
|
-
|
|
4164
|
+
d();
|
|
4161
4165
|
}, e);
|
|
4162
4166
|
} catch (n) {
|
|
4163
4167
|
if (gl(n, e) || (a.error = n.message || "请求失败,请重试"), !t.content && !t.reasoning) {
|
|
@@ -4170,39 +4174,39 @@ function xl(e = {}) {
|
|
|
4170
4174
|
return;
|
|
4171
4175
|
}
|
|
4172
4176
|
try {
|
|
4173
|
-
|
|
4177
|
+
f("assistant", await (t || g)(a.messages, e));
|
|
4174
4178
|
} catch (t) {
|
|
4175
4179
|
gl(t, e) || (a.error = t.message || "请求失败,请重试");
|
|
4176
4180
|
} finally {
|
|
4177
4181
|
await r?.(a.messages), a.loading = !1, c = null;
|
|
4178
4182
|
}
|
|
4179
4183
|
}
|
|
4180
|
-
async function
|
|
4181
|
-
!e.trim() || a.loading || (
|
|
4184
|
+
async function m(e) {
|
|
4185
|
+
!e.trim() || a.loading || (f("user", e.trim()), a.loading = !0, a.error = null, c = new AbortController(), await p(c.signal));
|
|
4182
4186
|
}
|
|
4183
|
-
async function
|
|
4187
|
+
async function h() {
|
|
4184
4188
|
if (a.loading) return;
|
|
4185
4189
|
let e = a.messages;
|
|
4186
4190
|
for (let t = e.length - 1; t >= 0; t--) if (e[t].role === "assistant") {
|
|
4187
4191
|
e.splice(t);
|
|
4188
4192
|
break;
|
|
4189
4193
|
}
|
|
4190
|
-
e.some((e) => e.role === "user") && (a.loading = !0, a.error = null, c = new AbortController(), await
|
|
4194
|
+
e.some((e) => e.role === "user") && (a.loading = !0, a.error = null, c = new AbortController(), await p(c.signal));
|
|
4191
4195
|
}
|
|
4192
|
-
async function
|
|
4196
|
+
async function g(e) {
|
|
4193
4197
|
return await new Promise((e) => setTimeout(e, 800 + Math.random() * 1200)), `收到你的消息:"${e.filter((e) => e.role === "user").pop()?.content}"。这是一个模拟回复,请接入实际的 AI API。`;
|
|
4194
4198
|
}
|
|
4195
|
-
function
|
|
4199
|
+
function _() {
|
|
4196
4200
|
i?.(), a.messages.splice(0, a.messages.length), a.error = null;
|
|
4197
4201
|
}
|
|
4198
|
-
function
|
|
4202
|
+
function v() {
|
|
4199
4203
|
c?.abort();
|
|
4200
4204
|
}
|
|
4201
|
-
function
|
|
4202
|
-
let t =
|
|
4203
|
-
t && (
|
|
4205
|
+
function y(e) {
|
|
4206
|
+
let t = l.value;
|
|
4207
|
+
t && (l.value = null, t.resolve(e));
|
|
4204
4208
|
}
|
|
4205
|
-
async function
|
|
4209
|
+
async function b() {
|
|
4206
4210
|
if (!a.error) return;
|
|
4207
4211
|
let e = a.messages, t = -1;
|
|
4208
4212
|
for (let n = e.length - 1; n >= 0; n--) if (e[n].role === "user") {
|
|
@@ -4211,18 +4215,19 @@ function xl(e = {}) {
|
|
|
4211
4215
|
}
|
|
4212
4216
|
if (t < 0) return;
|
|
4213
4217
|
let n = e[t].content;
|
|
4214
|
-
e.splice(t), a.error = null, await
|
|
4218
|
+
e.splice(t), a.error = null, await m(n);
|
|
4215
4219
|
}
|
|
4216
4220
|
return {
|
|
4217
4221
|
state: a,
|
|
4218
4222
|
scrollContainer: o,
|
|
4219
|
-
pendingApproval:
|
|
4220
|
-
sendMessage:
|
|
4221
|
-
clearMessages:
|
|
4222
|
-
stop:
|
|
4223
|
-
retry:
|
|
4224
|
-
regenerate:
|
|
4225
|
-
resolveApproval:
|
|
4223
|
+
pendingApproval: l,
|
|
4224
|
+
sendMessage: m,
|
|
4225
|
+
clearMessages: _,
|
|
4226
|
+
stop: v,
|
|
4227
|
+
retry: b,
|
|
4228
|
+
regenerate: h,
|
|
4229
|
+
resolveApproval: y,
|
|
4230
|
+
onScroll: u
|
|
4226
4231
|
};
|
|
4227
4232
|
}
|
|
4228
4233
|
//#endregion
|
|
@@ -13218,13 +13223,13 @@ app.mount('#app');
|
|
|
13218
13223
|
}
|
|
13219
13224
|
},
|
|
13220
13225
|
setup(e) {
|
|
13221
|
-
let t = e, { state: n, scrollContainer: r, pendingApproval: i, sendMessage: a, clearMessages: o, stop: s, retry: c, regenerate: l, resolveApproval: u } = xl({
|
|
13226
|
+
let t = e, { state: n, scrollContainer: r, pendingApproval: i, sendMessage: a, clearMessages: o, stop: s, retry: c, regenerate: l, resolveApproval: u, onScroll: d } = xl({
|
|
13222
13227
|
fetchResponse: t.fetchResponse,
|
|
13223
13228
|
fetchStream: t.fetchStream,
|
|
13224
13229
|
messages: t.initialMessages,
|
|
13225
13230
|
onPersist: t.onPersist,
|
|
13226
13231
|
onClear: t.onClear
|
|
13227
|
-
}),
|
|
13232
|
+
}), f = zs(() => {
|
|
13228
13233
|
let e = i.value?.args;
|
|
13229
13234
|
if (e == null) return "";
|
|
13230
13235
|
try {
|
|
@@ -13233,25 +13238,25 @@ app.mount('#app');
|
|
|
13233
13238
|
} catch {
|
|
13234
13239
|
return String(e);
|
|
13235
13240
|
}
|
|
13236
|
-
}),
|
|
13241
|
+
}), p = zs(() => i.value?.toolName === "request_human_confirmation"), m = zs(() => {
|
|
13237
13242
|
let e = i.value?.args?.options;
|
|
13238
13243
|
return Array.isArray(e) ? e.map(String) : [];
|
|
13239
|
-
}),
|
|
13244
|
+
}), h = /* @__PURE__ */ fn(!1);
|
|
13240
13245
|
Gr(i, () => {
|
|
13241
|
-
|
|
13246
|
+
h.value = !1;
|
|
13242
13247
|
});
|
|
13243
|
-
let
|
|
13244
|
-
function
|
|
13248
|
+
let g = zs(() => typeof t.canUndo == "function" && !!t.canUndo());
|
|
13249
|
+
function _() {
|
|
13245
13250
|
t.onUndo?.() && (n.error = null);
|
|
13246
13251
|
}
|
|
13247
|
-
let
|
|
13248
|
-
function w(e) {
|
|
13249
|
-
b.value[e] = !b.value[e];
|
|
13250
|
-
}
|
|
13252
|
+
let v = /* @__PURE__ */ fn(""), y = /* @__PURE__ */ fn(!0), b = /* @__PURE__ */ fn(!1), x = /* @__PURE__ */ fn({}), S = zs(() => n.messages.length > 0), C = zs(() => n.messages.some((e) => e.role === "user")), w = zs(() => (t.debugLogs?.length ?? 0) > 0);
|
|
13251
13253
|
function T(e) {
|
|
13252
|
-
|
|
13254
|
+
x.value[e] = !x.value[e];
|
|
13253
13255
|
}
|
|
13254
13256
|
function E(e) {
|
|
13257
|
+
return e.status === "running" ? "⏳" : e.status === "error" ? "❌" : "✅";
|
|
13258
|
+
}
|
|
13259
|
+
function D(e) {
|
|
13255
13260
|
let t = [];
|
|
13256
13261
|
for (let n of e) {
|
|
13257
13262
|
let e = t.length ? t[t.length - 1] : null;
|
|
@@ -13270,46 +13275,46 @@ app.mount('#app');
|
|
|
13270
13275
|
children: e.children
|
|
13271
13276
|
}));
|
|
13272
13277
|
}
|
|
13273
|
-
function
|
|
13278
|
+
function O(e) {
|
|
13274
13279
|
return e === "running" ? "⏳" : e === "error" ? "❌" : "✅";
|
|
13275
13280
|
}
|
|
13276
|
-
function
|
|
13281
|
+
function k(e) {
|
|
13277
13282
|
let t = n.messages[e];
|
|
13278
13283
|
return !!t && t.role === "assistant" && n.loading && e === n.messages.length - 1 && !t.content && !t.reasoning;
|
|
13279
13284
|
}
|
|
13280
|
-
function
|
|
13281
|
-
|
|
13282
|
-
}
|
|
13283
|
-
function A(e) {
|
|
13284
|
-
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), k());
|
|
13285
|
+
function A() {
|
|
13286
|
+
v.value.trim() && (a(v.value), v.value = "");
|
|
13285
13287
|
}
|
|
13286
13288
|
function j(e) {
|
|
13289
|
+
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), A());
|
|
13290
|
+
}
|
|
13291
|
+
function M(e) {
|
|
13287
13292
|
return new Date(e).toLocaleTimeString("zh-CN", {
|
|
13288
13293
|
hour: "2-digit",
|
|
13289
13294
|
minute: "2-digit"
|
|
13290
13295
|
});
|
|
13291
13296
|
}
|
|
13292
|
-
let
|
|
13297
|
+
let N = zs(() => {
|
|
13293
13298
|
let e = t.getInfo?.();
|
|
13294
13299
|
return {
|
|
13295
13300
|
mcp: e?.mcp?.servers?.length ?? 0,
|
|
13296
13301
|
tools: e?.tools?.length ?? 0
|
|
13297
13302
|
};
|
|
13298
13303
|
});
|
|
13299
|
-
function
|
|
13304
|
+
function P(e) {
|
|
13300
13305
|
navigator.clipboard.writeText(e);
|
|
13301
13306
|
}
|
|
13302
|
-
return (a,
|
|
13307
|
+
return (a, F) => (q(), J("div", { class: Se(["chat-dialog", { collapsed: !y.value }]) }, [
|
|
13303
13308
|
Y("div", Lm, [Y("div", Rm, [
|
|
13304
|
-
|
|
13309
|
+
F[14] ||= Y("span", { class: "header-icon" }, "🤖", -1),
|
|
13305
13310
|
Y("span", zm, V(e.title), 1),
|
|
13306
13311
|
W(n).loading ? (q(), J("span", Bm)) : X("", !0)
|
|
13307
13312
|
]), Y("div", Vm, [
|
|
13308
13313
|
Y("button", {
|
|
13309
|
-
class: Se(["action-btn debug-btn", { active:
|
|
13314
|
+
class: Se(["action-btn debug-btn", { active: b.value }]),
|
|
13310
13315
|
title: "日志 / 执行流程 / Agent 信息",
|
|
13311
|
-
onClick:
|
|
13312
|
-
}, [
|
|
13316
|
+
onClick: F[0] ||= (e) => b.value = !0
|
|
13317
|
+
}, [F[15] ||= Y("svg", {
|
|
13313
13318
|
width: "16",
|
|
13314
13319
|
height: "16",
|
|
13315
13320
|
viewBox: "0 0 24 24",
|
|
@@ -13320,13 +13325,13 @@ app.mount('#app');
|
|
|
13320
13325
|
Y("path", { d: "M9 2v8l-3 3v2h12v-2l-3-3V2" }),
|
|
13321
13326
|
Y("path", { d: "M9 2h6" }),
|
|
13322
13327
|
Y("path", { d: "M9 18h6" })
|
|
13323
|
-
], -1),
|
|
13328
|
+
], -1), w.value ? (q(), J("span", Hm, V(e.debugLogs?.length), 1)) : X("", !0)], 2),
|
|
13324
13329
|
Y("button", {
|
|
13325
13330
|
class: "action-btn",
|
|
13326
13331
|
title: "清空对话",
|
|
13327
|
-
onClick:
|
|
13328
|
-
disabled: !
|
|
13329
|
-
}, [...
|
|
13332
|
+
onClick: F[1] ||= (...e) => W(o) && W(o)(...e),
|
|
13333
|
+
disabled: !S.value
|
|
13334
|
+
}, [...F[16] ||= [Y("svg", {
|
|
13330
13335
|
width: "16",
|
|
13331
13336
|
height: "16",
|
|
13332
13337
|
viewBox: "0 0 24 24",
|
|
@@ -13336,15 +13341,16 @@ app.mount('#app');
|
|
|
13336
13341
|
}, [Y("polyline", { points: "3 6 5 6 21 6" }), Y("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })], -1)]], 8, Um),
|
|
13337
13342
|
Y("button", {
|
|
13338
13343
|
class: "action-btn",
|
|
13339
|
-
onClick:
|
|
13340
|
-
}, [(q(), J("svg", Wm, [
|
|
13344
|
+
onClick: F[2] ||= (e) => y.value = !y.value
|
|
13345
|
+
}, [(q(), J("svg", Wm, [y.value ? (q(), J("path", Gm)) : (q(), J("path", Km))]))])
|
|
13341
13346
|
])]),
|
|
13342
13347
|
zr(Y("div", {
|
|
13343
13348
|
class: "chat-body",
|
|
13344
13349
|
ref_key: "scrollContainer",
|
|
13345
|
-
ref: r
|
|
13350
|
+
ref: r,
|
|
13351
|
+
onScroll: F[5] ||= (...e) => W(d) && W(d)(...e)
|
|
13346
13352
|
}, [
|
|
13347
|
-
|
|
13353
|
+
S.value ? X("", !0) : (q(), J("div", qm, [...F[17] ||= [Y("div", { class: "empty-icon" }, "💬", -1), Y("p", null, "有什么可以帮你的?", -1)]])),
|
|
13348
13354
|
(q(!0), J(K, null, Xi(W(n).messages, (t, r) => (q(), J("div", {
|
|
13349
13355
|
key: r,
|
|
13350
13356
|
class: Se(["message-row", t.role]),
|
|
@@ -13352,143 +13358,143 @@ app.mount('#app');
|
|
|
13352
13358
|
}, [e.showAvatar ? (q(), J("div", Ym, V(t.role === "user" ? "👤" : "🤖"), 1)) : X("", !0), Y("div", Xm, [
|
|
13353
13359
|
t.role === "assistant" && t.reasoning ? (q(), J("div", {
|
|
13354
13360
|
key: 0,
|
|
13355
|
-
class: Se(["reasoning-block", { expanded:
|
|
13361
|
+
class: Se(["reasoning-block", { expanded: x.value[r] }])
|
|
13356
13362
|
}, [Y("div", {
|
|
13357
13363
|
class: "reasoning-header",
|
|
13358
|
-
onClick: (e) =>
|
|
13364
|
+
onClick: (e) => T(r)
|
|
13359
13365
|
}, [
|
|
13360
|
-
|
|
13361
|
-
|
|
13362
|
-
Y("span", Qm, V(
|
|
13363
|
-
], 8, Zm),
|
|
13364
|
-
t.role === "assistant" && t.steps && t.steps.length ? (q(), J("div", eh, [(q(!0), J(K, null, Xi(
|
|
13366
|
+
F[18] ||= Y("span", { class: "reasoning-icon" }, "🧠", -1),
|
|
13367
|
+
F[19] ||= Y("span", { class: "reasoning-title" }, "思考过程", -1),
|
|
13368
|
+
Y("span", Qm, V(x.value[r] ? "▾" : "▸"), 1)
|
|
13369
|
+
], 8, Zm), x.value[r] ? (q(), J("div", $m, V(t.reasoning), 1)) : X("", !0)], 2)) : X("", !0),
|
|
13370
|
+
t.role === "assistant" && t.steps && t.steps.length ? (q(), J("div", eh, [(q(!0), J(K, null, Xi(D(t.steps), (e, t) => (q(), J("div", {
|
|
13365
13371
|
key: t,
|
|
13366
13372
|
class: "step-item"
|
|
13367
13373
|
}, [Y("div", th, [
|
|
13368
|
-
Y("span", nh, V(
|
|
13374
|
+
Y("span", nh, V(O(e.status)), 1),
|
|
13369
13375
|
Y("span", rh, V(e.name), 1),
|
|
13370
13376
|
e.count > 1 ? (q(), J("span", ih, "×" + V(e.count), 1)) : X("", !0),
|
|
13371
13377
|
e.status === "running" ? (q(), J("span", ah, "执行中…")) : X("", !0)
|
|
13372
|
-
]), e.children && e.children.length ? (q(), J("div", oh, [
|
|
13378
|
+
]), e.children && e.children.length ? (q(), J("div", oh, [F[20] ||= Y("div", { class: "step-children-label" }, "🧬 子 agent 进度", -1), (q(!0), J(K, null, Xi(e.children, (e, t) => (q(), J("div", {
|
|
13373
13379
|
key: t,
|
|
13374
13380
|
class: "step-child"
|
|
13375
13381
|
}, [
|
|
13376
|
-
Y("span", sh, V(
|
|
13382
|
+
Y("span", sh, V(E(e)), 1),
|
|
13377
13383
|
Y("span", ch, V(e.name), 1),
|
|
13378
13384
|
e.status === "running" ? (q(), J("span", lh, "…")) : X("", !0)
|
|
13379
13385
|
]))), 128))])) : X("", !0)]))), 128))])) : X("", !0),
|
|
13380
|
-
Y("div", { class: Se(["message-bubble", { typing:
|
|
13381
|
-
|
|
13382
|
-
|
|
13383
|
-
|
|
13386
|
+
Y("div", { class: Se(["message-bubble", { typing: k(r) }]) }, [k(r) ? (q(), J(K, { key: 0 }, [e.showTyping ? (q(), J(K, { key: 0 }, [
|
|
13387
|
+
F[21] ||= Y("span", { class: "dot" }, null, -1),
|
|
13388
|
+
F[22] ||= Y("span", { class: "dot" }, null, -1),
|
|
13389
|
+
F[23] ||= Y("span", { class: "dot" }, null, -1)
|
|
13384
13390
|
], 64)) : (q(), J("span", uh, "思考中…"))], 64)) : (q(), J(K, { key: 1 }, [t.role === "assistant" ? (q(), Ko(ef, {
|
|
13385
13391
|
key: 0,
|
|
13386
13392
|
content: t.content
|
|
13387
13393
|
}, null, 8, ["content"])) : (q(), J(K, { key: 1 }, [is(V(t.content), 1)], 64))], 64))], 2),
|
|
13388
13394
|
t.role === "assistant" && W(n).loading && r === W(n).messages.length - 1 && t.content ? (q(), J("span", dh)) : X("", !0),
|
|
13389
|
-
Y("div", fh, V(
|
|
13395
|
+
Y("div", fh, V(M(t.timestamp)), 1),
|
|
13390
13396
|
t.role === "assistant" && t.content && !W(n).loading && r === W(n).messages.length - 1 ? (q(), J("div", ph, [Y("button", {
|
|
13391
13397
|
class: "msg-action-btn",
|
|
13392
13398
|
title: "复制",
|
|
13393
|
-
onClick: (e) =>
|
|
13399
|
+
onClick: (e) => P(t.content)
|
|
13394
13400
|
}, "📋 复制", 8, mh), Y("button", {
|
|
13395
13401
|
class: "msg-action-btn",
|
|
13396
13402
|
title: "重新生成",
|
|
13397
|
-
onClick:
|
|
13403
|
+
onClick: F[3] ||= (...e) => W(l) && W(l)(...e)
|
|
13398
13404
|
}, "🔄 重新生成")])) : X("", !0)
|
|
13399
13405
|
])], 10, Jm))), 128)),
|
|
13400
13406
|
W(n).loading && W(n).messages[W(n).messages.length - 1]?.role !== "assistant" ? (q(), J("div", hh, [e.showAvatar ? (q(), J("div", gh, "🤖")) : X("", !0), Y("div", _h, [Y("div", vh, [e.showTyping ? (q(), J(K, { key: 0 }, [
|
|
13401
|
-
|
|
13402
|
-
|
|
13403
|
-
|
|
13407
|
+
F[24] ||= Y("span", { class: "dot" }, null, -1),
|
|
13408
|
+
F[25] ||= Y("span", { class: "dot" }, null, -1),
|
|
13409
|
+
F[26] ||= Y("span", { class: "dot" }, null, -1)
|
|
13404
13410
|
], 64)) : (q(), J("span", yh, "思考中…"))])])])) : X("", !0),
|
|
13405
13411
|
W(n).error ? (q(), J("div", bh, [
|
|
13406
13412
|
Y("span", xh, V(W(n).error), 1),
|
|
13407
|
-
|
|
13413
|
+
C.value ? (q(), J("button", {
|
|
13408
13414
|
key: 0,
|
|
13409
13415
|
class: "retry-btn",
|
|
13410
|
-
onClick:
|
|
13416
|
+
onClick: F[4] ||= (...e) => W(c) && W(c)(...e)
|
|
13411
13417
|
}, "重试")) : X("", !0),
|
|
13412
|
-
|
|
13418
|
+
g.value ? (q(), J("button", {
|
|
13413
13419
|
key: 1,
|
|
13414
13420
|
class: "undo-btn",
|
|
13415
13421
|
title: "回退到上次正常状态(还原对话历史 + 页面属性 + 工作区)",
|
|
13416
|
-
onClick:
|
|
13422
|
+
onClick: _
|
|
13417
13423
|
}, "↩ 回退")) : X("", !0)
|
|
13418
13424
|
])) : X("", !0)
|
|
13419
|
-
],
|
|
13420
|
-
W(i) ? (q(), J("div", Sh, [
|
|
13421
|
-
|
|
13425
|
+
], 544), [[xc, y.value]]),
|
|
13426
|
+
W(i) ? (q(), J("div", Sh, [p.value ? (q(), J(K, { key: 0 }, [
|
|
13427
|
+
F[27] ||= Y("div", { class: "approval-head" }, [Y("span", { class: "approval-icon" }, "❓"), Y("span", { class: "approval-title" }, "AI 需要你确认")], -1),
|
|
13422
13428
|
W(i).args?.question ? (q(), J("div", Ch, V(W(i).args.question), 1)) : X("", !0),
|
|
13423
13429
|
W(i).args?.context ? (q(), J("div", wh, V(W(i).args.context), 1)) : X("", !0),
|
|
13424
13430
|
W(i).args?.recommendation ? (q(), J("div", Th, "💡 推荐:" + V(W(i).args.recommendation), 1)) : X("", !0),
|
|
13425
13431
|
Y("div", Eh, [Y("button", {
|
|
13426
13432
|
class: "approval-deny",
|
|
13427
|
-
onClick:
|
|
13428
|
-
}, "拒绝"),
|
|
13433
|
+
onClick: F[6] ||= (e) => W(u)(!1)
|
|
13434
|
+
}, "拒绝"), m.value.length ? (q(!0), J(K, { key: 0 }, Xi(m.value, (e) => (q(), J("button", {
|
|
13429
13435
|
key: e,
|
|
13430
13436
|
class: "approval-opt",
|
|
13431
13437
|
onClick: (t) => W(u)(e)
|
|
13432
13438
|
}, V(e), 9, Dh))), 128)) : (q(), J("button", {
|
|
13433
13439
|
key: 1,
|
|
13434
13440
|
class: "approval-allow",
|
|
13435
|
-
onClick:
|
|
13441
|
+
onClick: F[7] ||= (e) => W(u)(!0)
|
|
13436
13442
|
}, "允许"))])
|
|
13437
13443
|
], 64)) : (q(), J(K, { key: 1 }, [
|
|
13438
13444
|
Y("div", Oh, [
|
|
13439
|
-
|
|
13440
|
-
Y("span", kh, [
|
|
13441
|
-
|
|
13445
|
+
F[29] ||= Y("span", { class: "approval-icon" }, "✋", -1),
|
|
13446
|
+
Y("span", kh, [F[28] ||= is("需确认工具调用:", -1), Y("code", null, V(W(i).toolName), 1)]),
|
|
13447
|
+
f.value ? (q(), J("button", {
|
|
13442
13448
|
key: 0,
|
|
13443
13449
|
class: "approval-toggle",
|
|
13444
|
-
onClick:
|
|
13445
|
-
}, V(
|
|
13450
|
+
onClick: F[8] ||= (e) => h.value = !h.value
|
|
13451
|
+
}, V(h.value ? "收起参数" : "查看参数") + V(h.value ? " ▴" : " ▾"), 1)) : X("", !0)
|
|
13446
13452
|
]),
|
|
13447
|
-
|
|
13453
|
+
f.value && h.value ? (q(), J("pre", Ah, V(f.value), 1)) : X("", !0),
|
|
13448
13454
|
Y("div", jh, [Y("button", {
|
|
13449
13455
|
class: "approval-deny",
|
|
13450
|
-
onClick:
|
|
13456
|
+
onClick: F[9] ||= (e) => W(u)(!1)
|
|
13451
13457
|
}, "拒绝"), Y("button", {
|
|
13452
13458
|
class: "approval-allow",
|
|
13453
|
-
onClick:
|
|
13459
|
+
onClick: F[10] ||= (e) => W(u)(!0)
|
|
13454
13460
|
}, "允许")])
|
|
13455
13461
|
], 64))])) : X("", !0),
|
|
13456
13462
|
zr(Y("div", Mh, [
|
|
13457
|
-
t.getInfo ? (q(), J("span", Nh, " 🔌" + V(
|
|
13458
|
-
|
|
13463
|
+
t.getInfo ? (q(), J("span", Nh, " 🔌" + V(N.value.mcp) + " · 🔧" + V(N.value.tools), 1)) : X("", !0),
|
|
13464
|
+
g.value ? (q(), J("button", {
|
|
13459
13465
|
key: 1,
|
|
13460
13466
|
class: "undo-foot-btn",
|
|
13461
13467
|
title: "回退到上次正常状态(还原对话历史 + 页面属性 + 工作区)",
|
|
13462
|
-
onClick:
|
|
13468
|
+
onClick: _
|
|
13463
13469
|
}, "↩ 回退")) : X("", !0),
|
|
13464
13470
|
zr(Y("textarea", {
|
|
13465
|
-
"onUpdate:modelValue":
|
|
13471
|
+
"onUpdate:modelValue": F[11] ||= (e) => v.value = e,
|
|
13466
13472
|
class: "chat-input",
|
|
13467
13473
|
placeholder: e.placeholder,
|
|
13468
13474
|
rows: "1",
|
|
13469
|
-
onKeydown:
|
|
13470
|
-
}, null, 40, Ph), [[rl,
|
|
13475
|
+
onKeydown: j
|
|
13476
|
+
}, null, 40, Ph), [[rl, v.value]]),
|
|
13471
13477
|
Y("button", {
|
|
13472
13478
|
class: Se(["send-btn", { "stop-btn": W(n).loading }]),
|
|
13473
|
-
disabled: !W(n).loading && !
|
|
13479
|
+
disabled: !W(n).loading && !v.value.trim(),
|
|
13474
13480
|
title: W(n).loading ? "停止生成" : "发送",
|
|
13475
|
-
onClick:
|
|
13476
|
-
}, [W(n).loading ? (q(), J("svg", Ih, [...
|
|
13481
|
+
onClick: F[12] ||= (e) => W(n).loading ? W(s)() : A()
|
|
13482
|
+
}, [W(n).loading ? (q(), J("svg", Ih, [...F[30] ||= [Y("rect", {
|
|
13477
13483
|
x: "6",
|
|
13478
13484
|
y: "6",
|
|
13479
13485
|
width: "12",
|
|
13480
13486
|
height: "12",
|
|
13481
13487
|
rx: "2"
|
|
13482
|
-
}, null, -1)]])) : (q(), J("svg", Lh, [...
|
|
13488
|
+
}, null, -1)]])) : (q(), J("svg", Lh, [...F[31] ||= [Y("line", {
|
|
13483
13489
|
x1: "22",
|
|
13484
13490
|
y1: "2",
|
|
13485
13491
|
x2: "11",
|
|
13486
13492
|
y2: "13"
|
|
13487
13493
|
}, null, -1), Y("polygon", { points: "22 2 15 22 11 13 2 9 22 2" }, null, -1)]]))], 10, Fh)
|
|
13488
|
-
], 512), [[xc,
|
|
13494
|
+
], 512), [[xc, y.value]]),
|
|
13489
13495
|
$o(Im, {
|
|
13490
|
-
visible:
|
|
13491
|
-
"onUpdate:visible":
|
|
13496
|
+
visible: b.value,
|
|
13497
|
+
"onUpdate:visible": F[13] ||= (e) => b.value = e,
|
|
13492
13498
|
logs: e.debugLogs,
|
|
13493
13499
|
"get-info": t.getInfo
|
|
13494
13500
|
}, null, 8, [
|
|
@@ -13498,7 +13504,7 @@ app.mount('#app');
|
|
|
13498
13504
|
])
|
|
13499
13505
|
], 2));
|
|
13500
13506
|
}
|
|
13501
|
-
}), [["__scopeId", "data-v-
|
|
13507
|
+
}), [["__scopeId", "data-v-5bd4b0f0"]]);
|
|
13502
13508
|
function zh(e) {
|
|
13503
13509
|
return e.replace(/^\/+/, "").replace(/\/+/g, "/");
|
|
13504
13510
|
}
|