@duxi999/usdp-eacp-conversation 0.0.2 → 0.0.4
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 +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +304 -278
- package/dist/index.js.map +1 -1
- package/package.json +70 -71
package/dist/index.js
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Loading as
|
|
3
|
-
import { ElMessage as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as Ye, computed as z, ref as l, watch as Q, onMounted as Fe, onUnmounted as Ge, resolveComponent as b, resolveDirective as Je, openBlock as m, createElementBlock as T, createVNode as o, withCtx as s, createTextVNode as g, unref as we, createElementVNode as H, toDisplayString as X, createCommentVNode as Ke, withDirectives as Qe, createBlock as Ze } from "vue";
|
|
2
|
+
import { Loading as Ce } from "@element-plus/icons-vue";
|
|
3
|
+
import { ElMessage as Z } from "element-plus";
|
|
4
|
+
const et = { class: "conversation-session" }, tt = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "status-placeholder"
|
|
7
|
-
},
|
|
7
|
+
}, nt = {
|
|
8
8
|
key: 1,
|
|
9
9
|
class: "status-placeholder"
|
|
10
|
-
},
|
|
10
|
+
}, at = {
|
|
11
11
|
key: 2,
|
|
12
12
|
class: "status-placeholder"
|
|
13
|
-
},
|
|
13
|
+
}, ot = {
|
|
14
14
|
key: 3,
|
|
15
|
-
class: "iframe-container"
|
|
16
|
-
}, at = ["src"], ot = {
|
|
17
|
-
key: 4,
|
|
18
15
|
class: "status-placeholder"
|
|
19
16
|
}, it = {
|
|
17
|
+
key: 4,
|
|
18
|
+
class: "iframe-container"
|
|
19
|
+
}, st = ["src"], lt = {
|
|
20
20
|
key: 5,
|
|
21
21
|
class: "status-placeholder"
|
|
22
|
-
},
|
|
22
|
+
}, rt = {
|
|
23
|
+
key: 6,
|
|
24
|
+
class: "status-placeholder"
|
|
25
|
+
}, ut = { class: "env-limit-dialog" }, be = 30, ct = 2e3, vt = 45, dt = 300 * 1e3, ft = /* @__PURE__ */ Ye({
|
|
23
26
|
name: "UsdpXjgzConversation",
|
|
24
27
|
__name: "UsdpEacpConversation",
|
|
25
28
|
props: {
|
|
@@ -28,11 +31,11 @@ const Qe = { class: "conversation-session" }, Ze = {
|
|
|
28
31
|
appConfig: {}
|
|
29
32
|
},
|
|
30
33
|
emits: ["state-change"],
|
|
31
|
-
setup(
|
|
32
|
-
const
|
|
33
|
-
() =>
|
|
34
|
-
),
|
|
35
|
-
const e =
|
|
34
|
+
setup(S, { expose: ee, emit: W }) {
|
|
35
|
+
const i = S, te = W, ne = z(
|
|
36
|
+
() => i.appCode !== void 0 && i.appCode !== null && i.appCode !== "" ? String(i.appCode) : void 0
|
|
37
|
+
), Y = z(() => {
|
|
38
|
+
const e = i.appConfig;
|
|
36
39
|
if (e == null) return;
|
|
37
40
|
let t = null;
|
|
38
41
|
if (typeof e == "string")
|
|
@@ -44,15 +47,15 @@ const Qe = { class: "conversation-session" }, Ze = {
|
|
|
44
47
|
else typeof e == "object" && (t = e);
|
|
45
48
|
const a = t == null ? void 0 : t.projectId;
|
|
46
49
|
if (a == null) return;
|
|
47
|
-
const
|
|
48
|
-
return
|
|
49
|
-
}), n =
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
[
|
|
50
|
+
const r = String(a).trim();
|
|
51
|
+
return r === "" ? void 0 : r;
|
|
52
|
+
}), k = l(/^\/aisys\/[^/]+/.test(window.location.pathname)), n = l("not_exist"), ae = l(""), v = l(""), c = l(""), y = l(""), L = l(""), _ = l(!1), h = z(() => n.value);
|
|
53
|
+
z(() => c.value || "智能助手");
|
|
54
|
+
const Se = z(() => L.value || ne.value || null);
|
|
55
|
+
Q(
|
|
56
|
+
[h, () => c.value, Se],
|
|
54
57
|
([e, t, a]) => {
|
|
55
|
-
|
|
58
|
+
te("state-change", {
|
|
56
59
|
status: e,
|
|
57
60
|
nickname: t,
|
|
58
61
|
appCode: a
|
|
@@ -60,15 +63,15 @@ const Qe = { class: "conversation-session" }, Ze = {
|
|
|
60
63
|
},
|
|
61
64
|
{ immediate: !0 }
|
|
62
65
|
);
|
|
63
|
-
const
|
|
66
|
+
const U = l(!1), Ee = {
|
|
64
67
|
workspace: "工作区",
|
|
65
68
|
knowledge_base: "知识库",
|
|
66
69
|
agent: "智能体",
|
|
67
70
|
skill: "技能构建",
|
|
68
71
|
personal_assistant: "个人助手",
|
|
69
72
|
bid: "智能投标"
|
|
70
|
-
},
|
|
71
|
-
function
|
|
73
|
+
}, oe = l(!1), ie = l(!1), se = l([]), P = l([]), Ie = l();
|
|
74
|
+
function xe(e) {
|
|
72
75
|
if (!e) return "-";
|
|
73
76
|
try {
|
|
74
77
|
return new Date(e).toLocaleString("zh-CN", {
|
|
@@ -82,42 +85,42 @@ const Qe = { class: "conversation-session" }, Ze = {
|
|
|
82
85
|
return e;
|
|
83
86
|
}
|
|
84
87
|
}
|
|
85
|
-
async function
|
|
86
|
-
|
|
88
|
+
async function ke() {
|
|
89
|
+
oe.value = !0, P.value = [];
|
|
87
90
|
try {
|
|
88
|
-
|
|
91
|
+
se.value = await i.request.get("/app-conversation/my-running-environments");
|
|
89
92
|
} catch {
|
|
90
|
-
|
|
93
|
+
Z.error("获取运行中环境列表失败"), se.value = [];
|
|
91
94
|
} finally {
|
|
92
|
-
|
|
95
|
+
oe.value = !1;
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
|
-
|
|
96
|
-
e &&
|
|
98
|
+
Q(U, (e) => {
|
|
99
|
+
e && ke();
|
|
97
100
|
});
|
|
98
|
-
function
|
|
99
|
-
|
|
101
|
+
function Le(e) {
|
|
102
|
+
P.value = e;
|
|
100
103
|
}
|
|
101
|
-
async function
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
+
async function Ue() {
|
|
105
|
+
if (P.value.length !== 0) {
|
|
106
|
+
ie.value = !0;
|
|
104
107
|
try {
|
|
105
|
-
const e =
|
|
108
|
+
const e = P.value.map((a) => ({
|
|
106
109
|
appCode: a.appCode,
|
|
107
110
|
// appConfig 配置了 projectId 时携带(与 start-environment 对齐)
|
|
108
|
-
...
|
|
109
|
-
})), t = await
|
|
110
|
-
t.allSuccess ||
|
|
111
|
+
...Y.value ? { projectId: Y.value } : {}
|
|
112
|
+
})), t = await i.request.post("/app-conversation/batch-stop-environments", { environments: e });
|
|
113
|
+
t.allSuccess || Z.warning(`关闭完成:成功 ${t.successCount} 个,失败 ${t.failedCount} 个`), U.value = !1, await Ne();
|
|
111
114
|
} catch {
|
|
112
|
-
|
|
115
|
+
Z.error("关闭环境失败,请重试");
|
|
113
116
|
} finally {
|
|
114
|
-
|
|
117
|
+
ie.value = !1;
|
|
115
118
|
}
|
|
116
119
|
}
|
|
117
120
|
}
|
|
118
|
-
const
|
|
119
|
-
let
|
|
120
|
-
function
|
|
121
|
+
const w = l(""), de = l(null), C = l("");
|
|
122
|
+
let A = 0, q = null, M = null, O = null, E = null, V = !1, F = null, G = 0, J = null;
|
|
123
|
+
function K(e) {
|
|
121
124
|
if (!e) return "";
|
|
122
125
|
try {
|
|
123
126
|
const t = new URL(e);
|
|
@@ -126,163 +129,164 @@ const Qe = { class: "conversation-session" }, Ze = {
|
|
|
126
129
|
return e;
|
|
127
130
|
}
|
|
128
131
|
}
|
|
129
|
-
async function
|
|
130
|
-
|
|
132
|
+
async function le() {
|
|
133
|
+
_.value = !0;
|
|
131
134
|
try {
|
|
132
|
-
const e = await
|
|
133
|
-
appCode:
|
|
135
|
+
const e = await i.request.post("/app-conversation/start-environment", {
|
|
136
|
+
appCode: i.appCode,
|
|
134
137
|
// appConfig 配置了 projectId 时携带(dynamic_project 模式后端必需)
|
|
135
|
-
...
|
|
138
|
+
...Y.value ? { projectId: Y.value } : {}
|
|
136
139
|
});
|
|
137
|
-
return e.status !== n.value && (n.value = e.status), e.environmentId && e.environmentId !==
|
|
140
|
+
return e.status !== n.value && (n.value = e.status), e.environmentId && e.environmentId !== y.value && (y.value = e.environmentId), e.proxyUrl && e.proxyUrl !== v.value && (v.value = e.proxyUrl), e;
|
|
138
141
|
} finally {
|
|
139
|
-
|
|
142
|
+
_.value = !1;
|
|
140
143
|
}
|
|
141
144
|
}
|
|
142
|
-
async function
|
|
145
|
+
async function N() {
|
|
143
146
|
try {
|
|
144
|
-
const e = await
|
|
145
|
-
appCode:
|
|
147
|
+
const e = await i.request.get("/app-conversation/environment-status", {
|
|
148
|
+
appCode: i.appCode
|
|
146
149
|
}, { silent: !0 });
|
|
147
|
-
e.status !== n.value && (n.value = e.status), e.environmentId && e.environmentId !==
|
|
150
|
+
e.status !== n.value && (n.value = e.status), e.environmentId && e.environmentId !== y.value && (y.value = e.environmentId), e.proxyUrl && e.proxyUrl !== v.value && (v.value = e.proxyUrl);
|
|
148
151
|
} catch {
|
|
149
152
|
}
|
|
150
153
|
}
|
|
151
|
-
async function
|
|
152
|
-
|
|
154
|
+
async function fe() {
|
|
155
|
+
_.value = !0;
|
|
153
156
|
try {
|
|
154
|
-
await
|
|
155
|
-
appCode:
|
|
157
|
+
await i.request.post("/app-conversation/stop-environment", {
|
|
158
|
+
appCode: i.appCode
|
|
156
159
|
}), n.value = "stopped";
|
|
157
160
|
} finally {
|
|
158
|
-
|
|
161
|
+
_.value = !1;
|
|
159
162
|
}
|
|
160
163
|
}
|
|
161
|
-
async function
|
|
162
|
-
|
|
164
|
+
async function Ae() {
|
|
165
|
+
_.value = !0;
|
|
163
166
|
try {
|
|
164
|
-
await
|
|
165
|
-
appCode:
|
|
166
|
-
}), n.value = "not_exist",
|
|
167
|
+
await i.request.post("/app-conversation/destroy-environment", {
|
|
168
|
+
appCode: i.appCode
|
|
169
|
+
}), n.value = "not_exist", v.value = "", y.value = "";
|
|
167
170
|
} finally {
|
|
168
|
-
|
|
171
|
+
_.value = !1;
|
|
169
172
|
}
|
|
170
173
|
}
|
|
171
|
-
async function
|
|
174
|
+
async function I() {
|
|
172
175
|
try {
|
|
173
|
-
const e = await
|
|
174
|
-
appCode:
|
|
176
|
+
const e = await i.request.get("/app-conversation/session-info", {
|
|
177
|
+
appCode: i.appCode
|
|
175
178
|
}, { silent: !0 });
|
|
176
|
-
return e.sessionId !==
|
|
179
|
+
return e.sessionId !== ae.value && (ae.value = e.sessionId), e.proxyUrl !== v.value && (v.value = e.proxyUrl), e.agentNickname !== c.value && (c.value = e.agentNickname), e.environmentId !== y.value && (y.value = e.environmentId), e.appCode && e.appCode !== L.value && (L.value = e.appCode), e.environmentStatus !== n.value && (n.value = e.environmentStatus), e;
|
|
177
180
|
} catch {
|
|
178
181
|
return;
|
|
179
182
|
}
|
|
180
183
|
}
|
|
181
|
-
function
|
|
182
|
-
|
|
183
|
-
if (
|
|
184
|
-
if (await
|
|
185
|
-
|
|
184
|
+
function B() {
|
|
185
|
+
d(), G = 0, F = setInterval(async () => {
|
|
186
|
+
if (G++, G > vt) {
|
|
187
|
+
if (await N(), n.value === "running") {
|
|
188
|
+
d(), x(), c.value || I();
|
|
186
189
|
return;
|
|
187
190
|
}
|
|
188
|
-
|
|
191
|
+
d(), n.value = "start_failed";
|
|
189
192
|
return;
|
|
190
193
|
}
|
|
191
|
-
await
|
|
192
|
-
},
|
|
194
|
+
await N(), n.value === "running" ? (d(), x(), c.value || I()) : n.value === "start_failed" && d();
|
|
195
|
+
}, ct);
|
|
193
196
|
}
|
|
194
|
-
function
|
|
195
|
-
|
|
197
|
+
function d() {
|
|
198
|
+
F !== null && (clearInterval(F), F = null), G = 0;
|
|
196
199
|
}
|
|
197
|
-
function
|
|
198
|
-
|
|
199
|
-
document.visibilityState === "visible" && await
|
|
200
|
-
},
|
|
200
|
+
function x() {
|
|
201
|
+
R(), J = setInterval(async () => {
|
|
202
|
+
document.visibilityState === "visible" && await N();
|
|
203
|
+
}, dt);
|
|
201
204
|
}
|
|
202
|
-
function
|
|
203
|
-
|
|
205
|
+
function R() {
|
|
206
|
+
J !== null && (clearInterval(J), J = null);
|
|
204
207
|
}
|
|
205
208
|
function re() {
|
|
206
|
-
|
|
209
|
+
d(), R(), n.value = "not_exist", ae.value = "", v.value = "", c.value = "", y.value = "", L.value = "", _.value = !1;
|
|
207
210
|
}
|
|
208
|
-
|
|
209
|
-
[() => n.value, () =>
|
|
210
|
-
([e, t], [a,
|
|
211
|
+
Q(
|
|
212
|
+
[() => n.value, () => v.value],
|
|
213
|
+
([e, t], [a, r]) => {
|
|
211
214
|
if (!t || e !== "running") {
|
|
212
|
-
|
|
215
|
+
w.value = "", C.value = "", f(), D();
|
|
213
216
|
return;
|
|
214
217
|
}
|
|
215
|
-
|
|
218
|
+
K(t) !== K(r || "") && ge(t, a === "starting");
|
|
216
219
|
},
|
|
217
220
|
{ immediate: !0 }
|
|
218
|
-
),
|
|
221
|
+
), Q(
|
|
219
222
|
() => n.value,
|
|
220
223
|
(e, t) => {
|
|
221
224
|
if (e === "running" && t === "starting") {
|
|
222
|
-
const a =
|
|
225
|
+
const a = v.value;
|
|
223
226
|
if (!a) return;
|
|
224
|
-
(!
|
|
227
|
+
(!w.value || K(a) === K(w.value)) && ge(a, !0);
|
|
225
228
|
}
|
|
226
229
|
}
|
|
227
230
|
);
|
|
228
|
-
async function
|
|
229
|
-
if (
|
|
231
|
+
async function $() {
|
|
232
|
+
if (k.value || _.value) return;
|
|
230
233
|
const e = n.value;
|
|
231
234
|
if (!(e === "running" || e === "starting")) {
|
|
232
235
|
if (e === "start_failed") {
|
|
233
|
-
await
|
|
236
|
+
await N();
|
|
234
237
|
const t = n.value;
|
|
235
238
|
if (t === "running") {
|
|
236
|
-
|
|
239
|
+
x();
|
|
237
240
|
return;
|
|
238
241
|
}
|
|
239
242
|
if (t === "starting") {
|
|
240
|
-
|
|
243
|
+
B();
|
|
241
244
|
return;
|
|
242
245
|
}
|
|
243
246
|
}
|
|
244
247
|
try {
|
|
245
|
-
await
|
|
248
|
+
await le(), c.value || I(), n.value === "starting" ? B() : n.value === "running" && x();
|
|
246
249
|
} catch (t) {
|
|
247
250
|
if ((t == null ? void 0 : t.code) === 23010) {
|
|
248
|
-
|
|
251
|
+
U.value = !0;
|
|
249
252
|
return;
|
|
250
253
|
}
|
|
251
254
|
}
|
|
252
255
|
}
|
|
253
256
|
}
|
|
254
|
-
async function Ae() {
|
|
255
|
-
await new Promise((e) => setTimeout(e, 500)), await R();
|
|
256
|
-
}
|
|
257
257
|
async function Ne() {
|
|
258
|
-
|
|
258
|
+
await new Promise((e) => setTimeout(e, 500)), await $();
|
|
259
|
+
}
|
|
260
|
+
async function Re() {
|
|
261
|
+
if (k.value) return !1;
|
|
262
|
+
n.value = "stopping", d(), R(), f(), D();
|
|
259
263
|
try {
|
|
260
|
-
return await
|
|
264
|
+
return await fe(), !0;
|
|
261
265
|
} catch {
|
|
262
266
|
return n.value = "running", !1;
|
|
263
267
|
}
|
|
264
268
|
}
|
|
265
|
-
async function
|
|
266
|
-
let e =
|
|
267
|
-
return e || (await
|
|
269
|
+
async function $e() {
|
|
270
|
+
let e = L.value || ne.value;
|
|
271
|
+
return e || (await I(), e = L.value || ne.value), e || void 0;
|
|
268
272
|
}
|
|
269
|
-
function
|
|
270
|
-
const e =
|
|
273
|
+
function De() {
|
|
274
|
+
const e = w.value;
|
|
271
275
|
if (!e) return;
|
|
272
|
-
|
|
276
|
+
f(), A = 0;
|
|
273
277
|
const t = e.includes("?") ? "&" : "?";
|
|
274
|
-
|
|
275
|
-
}
|
|
276
|
-
function De() {
|
|
277
|
-
fe();
|
|
278
|
+
C.value = `${e}${t}_refresh=${Date.now()}`, ce(C.value);
|
|
278
279
|
}
|
|
279
280
|
function Pe() {
|
|
280
|
-
|
|
281
|
+
pe();
|
|
282
|
+
}
|
|
283
|
+
function qe() {
|
|
284
|
+
ve("network");
|
|
281
285
|
}
|
|
282
|
-
function
|
|
283
|
-
|
|
286
|
+
function pe() {
|
|
287
|
+
V && (f(), A = 0);
|
|
284
288
|
}
|
|
285
|
-
function
|
|
289
|
+
function Me(e) {
|
|
286
290
|
try {
|
|
287
291
|
const t = new URL(e);
|
|
288
292
|
return t.pathname = "/test", t.search = "", t.hash = "", t.toString();
|
|
@@ -290,292 +294,314 @@ const Qe = { class: "conversation-session" }, Ze = {
|
|
|
290
294
|
return `${e.split("?")[0].split("#")[0].replace(/\/+$/, "")}/test`;
|
|
291
295
|
}
|
|
292
296
|
}
|
|
293
|
-
async function
|
|
297
|
+
async function Oe(e) {
|
|
294
298
|
try {
|
|
295
|
-
const t =
|
|
299
|
+
const t = Me(e), a = new AbortController(), r = setTimeout(() => a.abort(), 5e3), u = await fetch(t, {
|
|
296
300
|
method: "HEAD",
|
|
297
301
|
mode: "cors",
|
|
298
302
|
cache: "no-cache",
|
|
299
303
|
signal: a.signal
|
|
300
304
|
});
|
|
301
|
-
return clearTimeout(
|
|
305
|
+
return clearTimeout(r), u.status === 200;
|
|
302
306
|
} catch {
|
|
303
307
|
return !1;
|
|
304
308
|
}
|
|
305
309
|
}
|
|
306
|
-
async function
|
|
307
|
-
if (await
|
|
308
|
-
|
|
310
|
+
async function ue(e, t = 0) {
|
|
311
|
+
if (await Oe(e)) {
|
|
312
|
+
me(e);
|
|
309
313
|
return;
|
|
310
314
|
}
|
|
311
|
-
t <
|
|
312
|
-
|
|
313
|
-
}, 100) :
|
|
315
|
+
t < be ? q = setTimeout(() => {
|
|
316
|
+
ue(e, t + 1);
|
|
317
|
+
}, 100) : me(e);
|
|
314
318
|
}
|
|
315
|
-
function
|
|
316
|
-
|
|
319
|
+
function me(e) {
|
|
320
|
+
w.value = e, C.value = e, ce(e);
|
|
317
321
|
}
|
|
318
|
-
function
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}, 1500) :
|
|
322
|
+
function ge(e, t) {
|
|
323
|
+
f(), D(), A = 0, t ? M = setTimeout(() => {
|
|
324
|
+
ue(e), M = null;
|
|
325
|
+
}, 1500) : ue(e);
|
|
322
326
|
}
|
|
323
|
-
function
|
|
324
|
-
|
|
327
|
+
function D() {
|
|
328
|
+
q && (clearTimeout(q), q = null), M && (clearTimeout(M), M = null), E && (clearTimeout(E), E = null);
|
|
325
329
|
}
|
|
326
|
-
function
|
|
327
|
-
if (
|
|
328
|
-
|
|
330
|
+
function ce(e) {
|
|
331
|
+
if (f(), !window.PerformanceObserver) {
|
|
332
|
+
ye();
|
|
329
333
|
return;
|
|
330
334
|
}
|
|
331
|
-
|
|
335
|
+
V = !0;
|
|
332
336
|
try {
|
|
333
|
-
|
|
337
|
+
O = new PerformanceObserver((t) => {
|
|
334
338
|
for (const a of t.getEntries()) {
|
|
335
|
-
const
|
|
336
|
-
if (a.name !== e && a.name !==
|
|
337
|
-
const
|
|
338
|
-
if (
|
|
339
|
-
|
|
339
|
+
const r = a;
|
|
340
|
+
if (a.name !== e && a.name !== C.value) continue;
|
|
341
|
+
const u = r.responseStatus;
|
|
342
|
+
if (u === 502) {
|
|
343
|
+
ve("502");
|
|
340
344
|
return;
|
|
341
345
|
}
|
|
342
|
-
|
|
346
|
+
u >= 200 && u < 400 && pe();
|
|
343
347
|
}
|
|
344
|
-
}),
|
|
348
|
+
}), O.observe({ type: "resource", buffered: !0 });
|
|
345
349
|
} catch {
|
|
346
350
|
}
|
|
347
|
-
|
|
351
|
+
ye();
|
|
348
352
|
}
|
|
349
|
-
function
|
|
350
|
-
|
|
353
|
+
function f() {
|
|
354
|
+
O && (O.disconnect(), O = null), E && (clearTimeout(E), E = null), V = !1;
|
|
351
355
|
}
|
|
352
|
-
function
|
|
353
|
-
|
|
354
|
-
|
|
356
|
+
function ye(e) {
|
|
357
|
+
E = setTimeout(() => {
|
|
358
|
+
V && ve("timeout");
|
|
355
359
|
}, 15e3);
|
|
356
360
|
}
|
|
357
|
-
function
|
|
358
|
-
if (!
|
|
359
|
-
if (
|
|
360
|
-
|
|
361
|
+
function ve(e) {
|
|
362
|
+
if (!V) return;
|
|
363
|
+
if (f(), A++, A > be) {
|
|
364
|
+
Z.error("应用加载失败,请刷新页面重试");
|
|
361
365
|
return;
|
|
362
366
|
}
|
|
363
|
-
console.warn(`[ConversationSession] 加载失败: ${e === "network" ? "网络错误" : e === "timeout" ? "加载超时" : "应用暂不可用"}, 第 ${
|
|
364
|
-
if (!
|
|
365
|
-
const a =
|
|
366
|
-
|
|
367
|
+
console.warn(`[ConversationSession] 加载失败: ${e === "network" ? "网络错误" : e === "timeout" ? "加载超时" : "应用暂不可用"}, 第 ${A} 次重试`), q = setTimeout(() => {
|
|
368
|
+
if (!w.value) return;
|
|
369
|
+
const a = w.value.includes("?") ? "&" : "?";
|
|
370
|
+
C.value = `${w.value}${a}_retry=${Date.now()}`, ce(C.value);
|
|
367
371
|
}, 1e3);
|
|
368
372
|
}
|
|
369
|
-
function
|
|
370
|
-
document.visibilityState === "visible" &&
|
|
373
|
+
function _e() {
|
|
374
|
+
document.visibilityState === "visible" && h.value === "running" && N();
|
|
371
375
|
}
|
|
372
|
-
|
|
373
|
-
|
|
376
|
+
Fe(async () => {
|
|
377
|
+
if (k.value) return;
|
|
378
|
+
document.addEventListener("visibilitychange", _e), await N();
|
|
374
379
|
const e = n.value;
|
|
375
|
-
e === "not_exist" || e === "stopped" ?
|
|
380
|
+
e === "not_exist" || e === "stopped" ? $() : (await I(), e === "starting" ? B() : e === "running" && x());
|
|
376
381
|
});
|
|
377
|
-
async function
|
|
382
|
+
async function Ve() {
|
|
383
|
+
if (k.value) return;
|
|
378
384
|
const e = n.value;
|
|
379
|
-
if (n.value = "stopping",
|
|
385
|
+
if (n.value = "stopping", d(), R(), f(), D(), e === "running" || e === "starting")
|
|
380
386
|
try {
|
|
381
|
-
await
|
|
387
|
+
await fe();
|
|
382
388
|
} catch {
|
|
383
389
|
}
|
|
384
390
|
re(), n.value = "starting";
|
|
385
391
|
try {
|
|
386
|
-
await
|
|
392
|
+
await le(), I(), n.value === "starting" ? B() : n.value === "running" && x();
|
|
387
393
|
} catch {
|
|
388
394
|
}
|
|
389
395
|
}
|
|
390
|
-
async function
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
396
|
+
async function Be() {
|
|
397
|
+
if (!k.value) {
|
|
398
|
+
n.value = "stopping", d(), R(), f(), D();
|
|
399
|
+
try {
|
|
400
|
+
await Ae();
|
|
401
|
+
} catch {
|
|
402
|
+
}
|
|
403
|
+
re(), n.value = "starting";
|
|
404
|
+
try {
|
|
405
|
+
await le(), I(), n.value === "starting" ? B() : n.value === "running" && x();
|
|
406
|
+
} catch {
|
|
407
|
+
}
|
|
400
408
|
}
|
|
401
409
|
}
|
|
402
|
-
function
|
|
403
|
-
var
|
|
404
|
-
const a = (
|
|
410
|
+
function je(e, t) {
|
|
411
|
+
var r;
|
|
412
|
+
const a = (r = de.value) == null ? void 0 : r.contentWindow;
|
|
405
413
|
a && a.postMessage({ target: "dsh", type: e, payload: t }, "*");
|
|
406
414
|
}
|
|
407
|
-
return
|
|
408
|
-
|
|
415
|
+
return ee({ start: $, stop: Re, restart: Ve, rebuild: Be, refresh: De, resolveAgentId: $e, postDshEvent: je }), Ge(() => {
|
|
416
|
+
d(), R(), document.removeEventListener("visibilitychange", _e), f(), D(), re();
|
|
409
417
|
}), (e, t) => {
|
|
410
|
-
const a =
|
|
411
|
-
return
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
418
|
+
const a = b("el-text"), r = b("el-result"), u = b("el-button"), ze = b("el-empty"), he = b("el-icon"), j = b("el-table-column"), He = b("el-table"), Xe = b("el-dialog"), We = Je("loading");
|
|
419
|
+
return m(), T("div", et, [
|
|
420
|
+
k.value ? (m(), T("div", tt, [
|
|
421
|
+
o(r, {
|
|
422
|
+
icon: "warning",
|
|
423
|
+
title: "当前应用包需要创建应用通过应用访问智能体服务"
|
|
424
|
+
}, {
|
|
425
|
+
extra: s(() => [
|
|
426
|
+
o(a, {
|
|
427
|
+
type: "info",
|
|
428
|
+
size: "small"
|
|
429
|
+
}, {
|
|
430
|
+
default: s(() => [...t[2] || (t[2] = [
|
|
431
|
+
g("请在本平台创建智能应用并绑定本应用包后,通过应用入口访问", -1)
|
|
432
|
+
])]),
|
|
433
|
+
_: 1
|
|
434
|
+
})
|
|
435
|
+
]),
|
|
436
|
+
_: 1
|
|
437
|
+
})
|
|
438
|
+
])) : h.value === "not_exist" ? (m(), T("div", nt, [
|
|
439
|
+
o(ze, {
|
|
440
|
+
description: `${c.value} 环境未启动`
|
|
415
441
|
}, {
|
|
416
|
-
default:
|
|
417
|
-
|
|
442
|
+
default: s(() => [
|
|
443
|
+
o(u, {
|
|
418
444
|
type: "primary",
|
|
419
|
-
onClick:
|
|
445
|
+
onClick: $
|
|
420
446
|
}, {
|
|
421
|
-
default:
|
|
422
|
-
|
|
447
|
+
default: s(() => [...t[3] || (t[3] = [
|
|
448
|
+
g("启动环境", -1)
|
|
423
449
|
])]),
|
|
424
450
|
_: 1
|
|
425
451
|
})
|
|
426
452
|
]),
|
|
427
453
|
_: 1
|
|
428
454
|
}, 8, ["description"])
|
|
429
|
-
])) :
|
|
430
|
-
|
|
455
|
+
])) : h.value === "starting" ? (m(), T("div", at, [
|
|
456
|
+
o(he, {
|
|
431
457
|
class: "is-loading",
|
|
432
458
|
size: 48
|
|
433
459
|
}, {
|
|
434
|
-
default:
|
|
435
|
-
|
|
460
|
+
default: s(() => [
|
|
461
|
+
o(we(Ce))
|
|
436
462
|
]),
|
|
437
463
|
_: 1
|
|
438
464
|
}),
|
|
439
|
-
|
|
440
|
-
])) :
|
|
441
|
-
|
|
465
|
+
H("p", null, X(c.value) + " 环境启动中...", 1)
|
|
466
|
+
])) : h.value === "stopping" ? (m(), T("div", ot, [
|
|
467
|
+
o(he, {
|
|
442
468
|
class: "is-loading",
|
|
443
469
|
size: 48
|
|
444
470
|
}, {
|
|
445
|
-
default:
|
|
446
|
-
|
|
471
|
+
default: s(() => [
|
|
472
|
+
o(we(Ce))
|
|
447
473
|
]),
|
|
448
474
|
_: 1
|
|
449
475
|
}),
|
|
450
|
-
|
|
451
|
-
])) :
|
|
452
|
-
|
|
476
|
+
H("p", null, "正在停止 " + X(c.value) + "...", 1)
|
|
477
|
+
])) : h.value === "running" ? (m(), T("div", it, [
|
|
478
|
+
H("iframe", {
|
|
453
479
|
ref_key: "iframeRef",
|
|
454
|
-
ref:
|
|
455
|
-
src:
|
|
480
|
+
ref: de,
|
|
481
|
+
src: C.value,
|
|
456
482
|
class: "conversation-iframe",
|
|
457
|
-
onLoad:
|
|
458
|
-
onError:
|
|
459
|
-
}, null, 40,
|
|
460
|
-
])) :
|
|
461
|
-
|
|
483
|
+
onLoad: Pe,
|
|
484
|
+
onError: qe
|
|
485
|
+
}, null, 40, st)
|
|
486
|
+
])) : h.value === "start_failed" ? (m(), T("div", lt, [
|
|
487
|
+
o(r, {
|
|
462
488
|
icon: "error",
|
|
463
489
|
title: "环境启动失败"
|
|
464
490
|
}, {
|
|
465
|
-
extra:
|
|
466
|
-
|
|
491
|
+
extra: s(() => [
|
|
492
|
+
o(u, {
|
|
467
493
|
type: "primary",
|
|
468
|
-
onClick:
|
|
494
|
+
onClick: $
|
|
469
495
|
}, {
|
|
470
|
-
default:
|
|
471
|
-
|
|
496
|
+
default: s(() => [...t[4] || (t[4] = [
|
|
497
|
+
g("重新启动", -1)
|
|
472
498
|
])]),
|
|
473
499
|
_: 1
|
|
474
500
|
})
|
|
475
501
|
]),
|
|
476
502
|
_: 1
|
|
477
503
|
})
|
|
478
|
-
])) :
|
|
479
|
-
|
|
504
|
+
])) : h.value === "stopped" ? (m(), T("div", rt, [
|
|
505
|
+
o(r, {
|
|
480
506
|
icon: "info",
|
|
481
507
|
title: "环境已停止"
|
|
482
508
|
}, {
|
|
483
|
-
extra:
|
|
484
|
-
|
|
509
|
+
extra: s(() => [
|
|
510
|
+
o(u, {
|
|
485
511
|
type: "primary",
|
|
486
|
-
onClick:
|
|
512
|
+
onClick: $
|
|
487
513
|
}, {
|
|
488
|
-
default:
|
|
489
|
-
|
|
514
|
+
default: s(() => [...t[5] || (t[5] = [
|
|
515
|
+
g("重新启动", -1)
|
|
490
516
|
])]),
|
|
491
517
|
_: 1
|
|
492
518
|
})
|
|
493
519
|
]),
|
|
494
520
|
_: 1
|
|
495
521
|
})
|
|
496
|
-
])) :
|
|
497
|
-
|
|
498
|
-
"model-value":
|
|
522
|
+
])) : Ke("", !0),
|
|
523
|
+
o(Xe, {
|
|
524
|
+
"model-value": U.value,
|
|
499
525
|
title: "运行中环境数量已达上限",
|
|
500
526
|
width: "720px",
|
|
501
527
|
"close-on-click-modal": !1,
|
|
502
|
-
"onUpdate:modelValue": t[1] || (t[1] = (p) =>
|
|
528
|
+
"onUpdate:modelValue": t[1] || (t[1] = (p) => U.value = p)
|
|
503
529
|
}, {
|
|
504
|
-
footer:
|
|
505
|
-
|
|
506
|
-
onClick: t[0] || (t[0] = (p) =>
|
|
530
|
+
footer: s(() => [
|
|
531
|
+
o(u, {
|
|
532
|
+
onClick: t[0] || (t[0] = (p) => U.value = !1)
|
|
507
533
|
}, {
|
|
508
|
-
default:
|
|
509
|
-
|
|
534
|
+
default: s(() => [...t[7] || (t[7] = [
|
|
535
|
+
g("暂不关闭", -1)
|
|
510
536
|
])]),
|
|
511
537
|
_: 1
|
|
512
538
|
}),
|
|
513
|
-
|
|
539
|
+
o(u, {
|
|
514
540
|
type: "primary",
|
|
515
|
-
loading:
|
|
516
|
-
disabled:
|
|
517
|
-
onClick:
|
|
541
|
+
loading: ie.value,
|
|
542
|
+
disabled: P.value.length === 0,
|
|
543
|
+
onClick: Ue
|
|
518
544
|
}, {
|
|
519
|
-
default:
|
|
520
|
-
|
|
545
|
+
default: s(() => [...t[8] || (t[8] = [
|
|
546
|
+
g(" 关闭已选环境 ", -1)
|
|
521
547
|
])]),
|
|
522
548
|
_: 1
|
|
523
549
|
}, 8, ["loading", "disabled"])
|
|
524
550
|
]),
|
|
525
|
-
default:
|
|
526
|
-
|
|
527
|
-
t[
|
|
528
|
-
|
|
551
|
+
default: s(() => [
|
|
552
|
+
H("div", ut, [
|
|
553
|
+
t[6] || (t[6] = H("p", { class: "env-limit-dialog__tip" }, " 您的运行中智能会话数量已达上限,请选择需要关闭的会话后重试。 ", -1)),
|
|
554
|
+
Qe((m(), Ze(He, {
|
|
529
555
|
ref_key: "envLimitTableRef",
|
|
530
|
-
ref:
|
|
531
|
-
data:
|
|
556
|
+
ref: Ie,
|
|
557
|
+
data: se.value,
|
|
532
558
|
"max-height": "520",
|
|
533
559
|
"header-cell-style": { textAlign: "center" },
|
|
534
|
-
onSelectionChange:
|
|
560
|
+
onSelectionChange: Le
|
|
535
561
|
}, {
|
|
536
|
-
default:
|
|
537
|
-
|
|
562
|
+
default: s(() => [
|
|
563
|
+
o(j, {
|
|
538
564
|
type: "selection",
|
|
539
565
|
width: "42"
|
|
540
566
|
}),
|
|
541
|
-
|
|
567
|
+
o(j, {
|
|
542
568
|
label: "场景类型",
|
|
543
569
|
"min-width": "100"
|
|
544
570
|
}, {
|
|
545
|
-
default:
|
|
546
|
-
|
|
571
|
+
default: s(({ row: p }) => [
|
|
572
|
+
g(X(Ee[p.sceneType] || p.sceneType), 1)
|
|
547
573
|
]),
|
|
548
574
|
_: 1
|
|
549
575
|
}),
|
|
550
|
-
|
|
576
|
+
o(j, {
|
|
551
577
|
prop: "sceneName",
|
|
552
578
|
label: "场景名称",
|
|
553
579
|
"min-width": "150",
|
|
554
580
|
"show-overflow-tooltip": ""
|
|
555
581
|
}),
|
|
556
|
-
|
|
582
|
+
o(j, {
|
|
557
583
|
label: "智能体",
|
|
558
584
|
"min-width": "130",
|
|
559
585
|
"show-overflow-tooltip": ""
|
|
560
586
|
}, {
|
|
561
|
-
default:
|
|
562
|
-
|
|
587
|
+
default: s(({ row: p }) => [
|
|
588
|
+
g(X(p.agentNickname || "-"), 1)
|
|
563
589
|
]),
|
|
564
590
|
_: 1
|
|
565
591
|
}),
|
|
566
|
-
|
|
592
|
+
o(j, {
|
|
567
593
|
label: "创建时间",
|
|
568
594
|
"min-width": "170"
|
|
569
595
|
}, {
|
|
570
|
-
default:
|
|
571
|
-
|
|
596
|
+
default: s(({ row: p }) => [
|
|
597
|
+
g(X(xe(p.createdAt)), 1)
|
|
572
598
|
]),
|
|
573
599
|
_: 1
|
|
574
600
|
})
|
|
575
601
|
]),
|
|
576
602
|
_: 1
|
|
577
603
|
}, 8, ["data"])), [
|
|
578
|
-
[
|
|
604
|
+
[We, oe.value]
|
|
579
605
|
])
|
|
580
606
|
])
|
|
581
607
|
]),
|
|
@@ -584,18 +610,18 @@ const Qe = { class: "conversation-session" }, Ze = {
|
|
|
584
610
|
]);
|
|
585
611
|
};
|
|
586
612
|
}
|
|
587
|
-
}),
|
|
588
|
-
const
|
|
589
|
-
for (const [
|
|
590
|
-
|
|
591
|
-
return
|
|
592
|
-
},
|
|
593
|
-
install(
|
|
594
|
-
|
|
613
|
+
}), pt = (S, ee) => {
|
|
614
|
+
const W = S.__vccOpts || S;
|
|
615
|
+
for (const [i, te] of ee)
|
|
616
|
+
W[i] = te;
|
|
617
|
+
return W;
|
|
618
|
+
}, Te = /* @__PURE__ */ pt(ft, [["__scopeId", "data-v-ad448334"]]), mt = "usdp-eacp-conversation", ht = {
|
|
619
|
+
install(S) {
|
|
620
|
+
S.component(mt, Te), S.component("UsdpEacpConversation", Te);
|
|
595
621
|
}
|
|
596
622
|
};
|
|
597
623
|
export {
|
|
598
|
-
|
|
599
|
-
|
|
624
|
+
Te as ConversationSession,
|
|
625
|
+
ht as default
|
|
600
626
|
};
|
|
601
627
|
//# sourceMappingURL=index.js.map
|