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