@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.js CHANGED
@@ -1,25 +1,28 @@
1
- import { defineComponent as Xe, computed as j, ref as s, watch as K, onMounted as We, onUnmounted as Ye, resolveComponent as I, resolveDirective as Fe, openBlock as w, createElementBlock as L, createVNode as i, withCtx as r, createTextVNode as C, unref as he, createElementVNode as z, toDisplayString as H, createCommentVNode as Ge, withDirectives as Je, createBlock as Ke } from "vue";
2
- import { Loading as we } from "@element-plus/icons-vue";
3
- import { ElMessage as Q } from "element-plus";
4
- const Qe = { class: "conversation-session" }, Ze = {
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
- }, et = {
7
+ }, nt = {
8
8
  key: 1,
9
9
  class: "status-placeholder"
10
- }, tt = {
10
+ }, at = {
11
11
  key: 2,
12
12
  class: "status-placeholder"
13
- }, nt = {
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
- }, st = { class: "env-limit-dialog" }, Ce = 30, rt = 2e3, lt = 45, ut = 300 * 1e3, ct = /* @__PURE__ */ Xe({
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(b, { expose: Z, emit: X }) {
32
- const o = b, ee = X, te = j(
33
- () => o.appCode !== void 0 && o.appCode !== null && o.appCode !== "" ? String(o.appCode) : void 0
34
- ), W = j(() => {
35
- const e = o.appConfig;
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 l = String(a).trim();
48
- return l === "" ? void 0 : l;
49
- }), n = s("not_exist"), ne = s(""), c = s(""), u = s(""), m = s(""), k = s(""), g = s(!1), y = j(() => n.value);
50
- j(() => u.value || "智能助手");
51
- const Te = j(() => k.value || te.value || null);
52
- K(
53
- [y, () => u.value, Te],
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
- ee("state-change", {
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 x = s(!1), Se = {
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
- }, ae = s(!1), oe = s(!1), ie = s([]), D = s([]), Ee = s();
71
- function Ie(e) {
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 Le() {
86
- ae.value = !0, D.value = [];
88
+ async function ke() {
89
+ oe.value = !0, P.value = [];
87
90
  try {
88
- ie.value = await o.request.get("/app-conversation/my-running-environments");
91
+ se.value = await i.request.get("/app-conversation/my-running-environments");
89
92
  } catch {
90
- Q.error("获取运行中环境列表失败"), ie.value = [];
93
+ Z.error("获取运行中环境列表失败"), se.value = [];
91
94
  } finally {
92
- ae.value = !1;
95
+ oe.value = !1;
93
96
  }
94
97
  }
95
- K(x, (e) => {
96
- e && Le();
98
+ Q(U, (e) => {
99
+ e && ke();
97
100
  });
98
- function ke(e) {
99
- D.value = e;
101
+ function Le(e) {
102
+ P.value = e;
100
103
  }
101
- async function xe() {
102
- if (D.value.length !== 0) {
103
- oe.value = !0;
104
+ async function Ue() {
105
+ if (P.value.length !== 0) {
106
+ ie.value = !0;
104
107
  try {
105
- const e = D.value.map((a) => ({
108
+ const e = P.value.map((a) => ({
106
109
  appCode: a.appCode,
107
110
  // appConfig 配置了 projectId 时携带(与 start-environment 对齐)
108
- ...W.value ? { projectId: W.value } : {}
109
- })), t = await o.request.post("/app-conversation/batch-stop-environments", { environments: e });
110
- t.allSuccess || Q.warning(`关闭完成:成功 ${t.successCount} 个,失败 ${t.failedCount} 个`), x.value = !1, await Ae();
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
- Q.error("关闭环境失败,请重试");
115
+ Z.error("关闭环境失败,请重试");
113
116
  } finally {
114
- oe.value = !1;
117
+ ie.value = !1;
115
118
  }
116
119
  }
117
120
  }
118
- const _ = s(""), ve = s(null), h = s("");
119
- let U = 0, P = null, q = null, M = null, T = null, O = !1, Y = null, F = 0, G = null;
120
- function J(e) {
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 se() {
130
- g.value = !0;
132
+ async function le() {
133
+ _.value = !0;
131
134
  try {
132
- const e = await o.request.post("/app-conversation/start-environment", {
133
- appCode: o.appCode,
135
+ const e = await i.request.post("/app-conversation/start-environment", {
136
+ appCode: i.appCode,
134
137
  // appConfig 配置了 projectId 时携带(dynamic_project 模式后端必需)
135
- ...W.value ? { projectId: W.value } : {}
138
+ ...Y.value ? { projectId: Y.value } : {}
136
139
  });
137
- return e.status !== n.value && (n.value = e.status), e.environmentId && e.environmentId !== m.value && (m.value = e.environmentId), e.proxyUrl && e.proxyUrl !== c.value && (c.value = e.proxyUrl), e;
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
- g.value = !1;
142
+ _.value = !1;
140
143
  }
141
144
  }
142
- async function A() {
145
+ async function N() {
143
146
  try {
144
- const e = await o.request.get("/app-conversation/environment-status", {
145
- appCode: o.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 !== m.value && (m.value = e.environmentId), e.proxyUrl && e.proxyUrl !== c.value && (c.value = e.proxyUrl);
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 de() {
152
- g.value = !0;
154
+ async function fe() {
155
+ _.value = !0;
153
156
  try {
154
- await o.request.post("/app-conversation/stop-environment", {
155
- appCode: o.appCode
157
+ await i.request.post("/app-conversation/stop-environment", {
158
+ appCode: i.appCode
156
159
  }), n.value = "stopped";
157
160
  } finally {
158
- g.value = !1;
161
+ _.value = !1;
159
162
  }
160
163
  }
161
- async function Ue() {
162
- g.value = !0;
164
+ async function Ae() {
165
+ _.value = !0;
163
166
  try {
164
- await o.request.post("/app-conversation/destroy-environment", {
165
- appCode: o.appCode
166
- }), n.value = "not_exist", c.value = "", m.value = "";
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
- g.value = !1;
171
+ _.value = !1;
169
172
  }
170
173
  }
171
- async function S() {
174
+ async function I() {
172
175
  try {
173
- const e = await o.request.get("/app-conversation/session-info", {
174
- appCode: o.appCode
176
+ const e = await i.request.get("/app-conversation/session-info", {
177
+ appCode: i.appCode
175
178
  }, { silent: !0 });
176
- return e.sessionId !== ne.value && (ne.value = e.sessionId), e.proxyUrl !== c.value && (c.value = e.proxyUrl), e.agentNickname !== u.value && (u.value = e.agentNickname), e.environmentId !== m.value && (m.value = e.environmentId), e.appCode && e.appCode !== k.value && (k.value = e.appCode), e.environmentStatus !== n.value && (n.value = e.environmentStatus), e;
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 V() {
182
- v(), F = 0, Y = setInterval(async () => {
183
- if (F++, F > lt) {
184
- if (await A(), n.value === "running") {
185
- v(), E(), u.value || S();
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
- v(), n.value = "start_failed";
191
+ d(), n.value = "start_failed";
189
192
  return;
190
193
  }
191
- await A(), n.value === "running" ? (v(), E(), u.value || S()) : n.value === "start_failed" && v();
192
- }, rt);
194
+ await N(), n.value === "running" ? (d(), x(), c.value || I()) : n.value === "start_failed" && d();
195
+ }, ct);
193
196
  }
194
- function v() {
195
- Y !== null && (clearInterval(Y), Y = null), F = 0;
197
+ function d() {
198
+ F !== null && (clearInterval(F), F = null), G = 0;
196
199
  }
197
- function E() {
198
- N(), G = setInterval(async () => {
199
- document.visibilityState === "visible" && await A();
200
- }, ut);
200
+ function x() {
201
+ R(), J = setInterval(async () => {
202
+ document.visibilityState === "visible" && await N();
203
+ }, dt);
201
204
  }
202
- function N() {
203
- G !== null && (clearInterval(G), G = null);
205
+ function R() {
206
+ J !== null && (clearInterval(J), J = null);
204
207
  }
205
208
  function re() {
206
- v(), N(), n.value = "not_exist", ne.value = "", c.value = "", u.value = "", m.value = "", k.value = "", g.value = !1;
209
+ d(), R(), n.value = "not_exist", ae.value = "", v.value = "", c.value = "", y.value = "", L.value = "", _.value = !1;
207
210
  }
208
- K(
209
- [() => n.value, () => c.value],
210
- ([e, t], [a, l]) => {
211
+ Q(
212
+ [() => n.value, () => v.value],
213
+ ([e, t], [a, r]) => {
211
214
  if (!t || e !== "running") {
212
- _.value = "", h.value = "", d(), $();
215
+ w.value = "", C.value = "", f(), D();
213
216
  return;
214
217
  }
215
- J(t) !== J(l || "") && me(t, a === "starting");
218
+ K(t) !== K(r || "") && ge(t, a === "starting");
216
219
  },
217
220
  { immediate: !0 }
218
- ), K(
221
+ ), Q(
219
222
  () => n.value,
220
223
  (e, t) => {
221
224
  if (e === "running" && t === "starting") {
222
- const a = c.value;
225
+ const a = v.value;
223
226
  if (!a) return;
224
- (!_.value || J(a) === J(_.value)) && me(a, !0);
227
+ (!w.value || K(a) === K(w.value)) && ge(a, !0);
225
228
  }
226
229
  }
227
230
  );
228
- async function R() {
229
- if (g.value) return;
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 A();
236
+ await N();
234
237
  const t = n.value;
235
238
  if (t === "running") {
236
- E();
239
+ x();
237
240
  return;
238
241
  }
239
242
  if (t === "starting") {
240
- V();
243
+ B();
241
244
  return;
242
245
  }
243
246
  }
244
247
  try {
245
- await se(), u.value || S(), n.value === "starting" ? V() : n.value === "running" && E();
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
- x.value = !0;
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
- n.value = "stopping", v(), N(), d(), $();
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 de(), !0;
264
+ return await fe(), !0;
261
265
  } catch {
262
266
  return n.value = "running", !1;
263
267
  }
264
268
  }
265
- async function Re() {
266
- let e = k.value || te.value;
267
- return e || (await S(), e = k.value || te.value), e || void 0;
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 $e() {
270
- const e = _.value;
273
+ function De() {
274
+ const e = w.value;
271
275
  if (!e) return;
272
- d(), U = 0;
276
+ f(), A = 0;
273
277
  const t = e.includes("?") ? "&" : "?";
274
- h.value = `${e}${t}_refresh=${Date.now()}`, ue(h.value);
275
- }
276
- function De() {
277
- fe();
278
+ C.value = `${e}${t}_refresh=${Date.now()}`, ce(C.value);
278
279
  }
279
280
  function Pe() {
280
- ce("network");
281
+ pe();
282
+ }
283
+ function qe() {
284
+ ve("network");
281
285
  }
282
- function fe() {
283
- O && (d(), U = 0);
286
+ function pe() {
287
+ V && (f(), A = 0);
284
288
  }
285
- function qe(e) {
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 Me(e) {
297
+ async function Oe(e) {
294
298
  try {
295
- const t = qe(e), a = new AbortController(), l = setTimeout(() => a.abort(), 5e3), f = await fetch(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(l), f.status === 200;
305
+ return clearTimeout(r), u.status === 200;
302
306
  } catch {
303
307
  return !1;
304
308
  }
305
309
  }
306
- async function le(e, t = 0) {
307
- if (await Me(e)) {
308
- pe(e);
310
+ async function ue(e, t = 0) {
311
+ if (await Oe(e)) {
312
+ me(e);
309
313
  return;
310
314
  }
311
- t < Ce ? P = setTimeout(() => {
312
- le(e, t + 1);
313
- }, 100) : pe(e);
315
+ t < be ? q = setTimeout(() => {
316
+ ue(e, t + 1);
317
+ }, 100) : me(e);
314
318
  }
315
- function pe(e) {
316
- _.value = e, h.value = e, ue(e);
319
+ function me(e) {
320
+ w.value = e, C.value = e, ce(e);
317
321
  }
318
- function me(e, t) {
319
- d(), $(), U = 0, t ? q = setTimeout(() => {
320
- le(e), q = null;
321
- }, 1500) : le(e);
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
- P && (clearTimeout(P), P = null), q && (clearTimeout(q), q = null), T && (clearTimeout(T), T = null);
327
+ function D() {
328
+ q && (clearTimeout(q), q = null), M && (clearTimeout(M), M = null), E && (clearTimeout(E), E = null);
325
329
  }
326
- function ue(e) {
327
- if (d(), !window.PerformanceObserver) {
328
- ge();
330
+ function ce(e) {
331
+ if (f(), !window.PerformanceObserver) {
332
+ ye();
329
333
  return;
330
334
  }
331
- O = !0;
335
+ V = !0;
332
336
  try {
333
- M = new PerformanceObserver((t) => {
337
+ O = new PerformanceObserver((t) => {
334
338
  for (const a of t.getEntries()) {
335
- const l = a;
336
- if (a.name !== e && a.name !== h.value) continue;
337
- const f = l.responseStatus;
338
- if (f === 502) {
339
- ce("502");
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
- f >= 200 && f < 400 && fe();
346
+ u >= 200 && u < 400 && pe();
343
347
  }
344
- }), M.observe({ type: "resource", buffered: !0 });
348
+ }), O.observe({ type: "resource", buffered: !0 });
345
349
  } catch {
346
350
  }
347
- ge();
351
+ ye();
348
352
  }
349
- function d() {
350
- M && (M.disconnect(), M = null), T && (clearTimeout(T), T = null), O = !1;
353
+ function f() {
354
+ O && (O.disconnect(), O = null), E && (clearTimeout(E), E = null), V = !1;
351
355
  }
352
- function ge(e) {
353
- T = setTimeout(() => {
354
- O && ce("timeout");
356
+ function ye(e) {
357
+ E = setTimeout(() => {
358
+ V && ve("timeout");
355
359
  }, 15e3);
356
360
  }
357
- function ce(e) {
358
- if (!O) return;
359
- if (d(), U++, U > Ce) {
360
- Q.error("应用加载失败,请刷新页面重试");
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" ? "加载超时" : "应用暂不可用"}, 第 ${U} 次重试`), P = setTimeout(() => {
364
- if (!_.value) return;
365
- const a = _.value.includes("?") ? "&" : "?";
366
- h.value = `${_.value}${a}_retry=${Date.now()}`, ue(h.value);
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 ye() {
370
- document.visibilityState === "visible" && y.value === "running" && A();
373
+ function _e() {
374
+ document.visibilityState === "visible" && h.value === "running" && N();
371
375
  }
372
- We(async () => {
373
- document.addEventListener("visibilitychange", ye), await A();
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" ? R() : (await S(), e === "starting" ? V() : e === "running" && E());
380
+ e === "not_exist" || e === "stopped" ? $() : (await I(), e === "starting" ? B() : e === "running" && x());
376
381
  });
377
- async function Oe() {
382
+ async function Ve() {
383
+ if (k.value) return;
378
384
  const e = n.value;
379
- if (n.value = "stopping", v(), N(), d(), $(), e === "running" || e === "starting")
385
+ if (n.value = "stopping", d(), R(), f(), D(), e === "running" || e === "starting")
380
386
  try {
381
- await de();
387
+ await fe();
382
388
  } catch {
383
389
  }
384
390
  re(), n.value = "starting";
385
391
  try {
386
- await se(), S(), n.value === "starting" ? V() : n.value === "running" && E();
392
+ await le(), I(), n.value === "starting" ? B() : n.value === "running" && x();
387
393
  } catch {
388
394
  }
389
395
  }
390
- async function Ve() {
391
- n.value = "stopping", v(), N(), d(), $();
392
- try {
393
- await Ue();
394
- } catch {
395
- }
396
- re(), n.value = "starting";
397
- try {
398
- await se(), S(), n.value === "starting" ? V() : n.value === "running" && E();
399
- } catch {
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 Be(e, t) {
403
- var l;
404
- const a = (l = ve.value) == null ? void 0 : l.contentWindow;
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 Z({ start: R, stop: Ne, restart: Oe, rebuild: Ve, refresh: $e, resolveAgentId: Re, postDshEvent: Be }), Ye(() => {
408
- v(), N(), document.removeEventListener("visibilitychange", ye), d(), $(), re();
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 = I("el-button"), l = I("el-empty"), f = I("el-icon"), _e = I("el-result"), B = I("el-table-column"), je = I("el-table"), ze = I("el-dialog"), He = Fe("loading");
411
- return w(), L("div", Qe, [
412
- y.value === "not_exist" ? (w(), L("div", Ze, [
413
- i(l, {
414
- description: `${u.value} 环境未启动`
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: r(() => [
417
- i(a, {
442
+ default: s(() => [
443
+ o(u, {
418
444
  type: "primary",
419
- onClick: R
445
+ onClick: $
420
446
  }, {
421
- default: r(() => [...t[2] || (t[2] = [
422
- C("启动环境", -1)
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
- ])) : y.value === "starting" ? (w(), L("div", et, [
430
- i(f, {
455
+ ])) : h.value === "starting" ? (m(), T("div", at, [
456
+ o(he, {
431
457
  class: "is-loading",
432
458
  size: 48
433
459
  }, {
434
- default: r(() => [
435
- i(he(we))
460
+ default: s(() => [
461
+ o(we(Ce))
436
462
  ]),
437
463
  _: 1
438
464
  }),
439
- z("p", null, H(u.value) + " 环境启动中...", 1)
440
- ])) : y.value === "stopping" ? (w(), L("div", tt, [
441
- i(f, {
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: r(() => [
446
- i(he(we))
471
+ default: s(() => [
472
+ o(we(Ce))
447
473
  ]),
448
474
  _: 1
449
475
  }),
450
- z("p", null, "正在停止 " + H(u.value) + "...", 1)
451
- ])) : y.value === "running" ? (w(), L("div", nt, [
452
- z("iframe", {
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: ve,
455
- src: h.value,
480
+ ref: de,
481
+ src: C.value,
456
482
  class: "conversation-iframe",
457
- onLoad: De,
458
- onError: Pe
459
- }, null, 40, at)
460
- ])) : y.value === "start_failed" ? (w(), L("div", ot, [
461
- i(_e, {
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: r(() => [
466
- i(a, {
491
+ extra: s(() => [
492
+ o(u, {
467
493
  type: "primary",
468
- onClick: R
494
+ onClick: $
469
495
  }, {
470
- default: r(() => [...t[3] || (t[3] = [
471
- C("重新启动", -1)
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
- ])) : y.value === "stopped" ? (w(), L("div", it, [
479
- i(_e, {
504
+ ])) : h.value === "stopped" ? (m(), T("div", rt, [
505
+ o(r, {
480
506
  icon: "info",
481
507
  title: "环境已停止"
482
508
  }, {
483
- extra: r(() => [
484
- i(a, {
509
+ extra: s(() => [
510
+ o(u, {
485
511
  type: "primary",
486
- onClick: R
512
+ onClick: $
487
513
  }, {
488
- default: r(() => [...t[4] || (t[4] = [
489
- C("重新启动", -1)
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
- ])) : Ge("", !0),
497
- i(ze, {
498
- "model-value": x.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) => x.value = p)
528
+ "onUpdate:modelValue": t[1] || (t[1] = (p) => U.value = p)
503
529
  }, {
504
- footer: r(() => [
505
- i(a, {
506
- onClick: t[0] || (t[0] = (p) => x.value = !1)
530
+ footer: s(() => [
531
+ o(u, {
532
+ onClick: t[0] || (t[0] = (p) => U.value = !1)
507
533
  }, {
508
- default: r(() => [...t[6] || (t[6] = [
509
- C("暂不关闭", -1)
534
+ default: s(() => [...t[7] || (t[7] = [
535
+ g("暂不关闭", -1)
510
536
  ])]),
511
537
  _: 1
512
538
  }),
513
- i(a, {
539
+ o(u, {
514
540
  type: "primary",
515
- loading: oe.value,
516
- disabled: D.value.length === 0,
517
- onClick: xe
541
+ loading: ie.value,
542
+ disabled: P.value.length === 0,
543
+ onClick: Ue
518
544
  }, {
519
- default: r(() => [...t[7] || (t[7] = [
520
- C(" 关闭已选环境 ", -1)
545
+ default: s(() => [...t[8] || (t[8] = [
546
+ g(" 关闭已选环境 ", -1)
521
547
  ])]),
522
548
  _: 1
523
549
  }, 8, ["loading", "disabled"])
524
550
  ]),
525
- default: r(() => [
526
- z("div", st, [
527
- t[5] || (t[5] = z("p", { class: "env-limit-dialog__tip" }, " 您的运行中智能会话数量已达上限,请选择需要关闭的会话后重试。 ", -1)),
528
- Je((w(), Ke(je, {
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: Ee,
531
- data: ie.value,
556
+ ref: Ie,
557
+ data: se.value,
532
558
  "max-height": "520",
533
559
  "header-cell-style": { textAlign: "center" },
534
- onSelectionChange: ke
560
+ onSelectionChange: Le
535
561
  }, {
536
- default: r(() => [
537
- i(B, {
562
+ default: s(() => [
563
+ o(j, {
538
564
  type: "selection",
539
565
  width: "42"
540
566
  }),
541
- i(B, {
567
+ o(j, {
542
568
  label: "场景类型",
543
569
  "min-width": "100"
544
570
  }, {
545
- default: r(({ row: p }) => [
546
- C(H(Se[p.sceneType] || p.sceneType), 1)
571
+ default: s(({ row: p }) => [
572
+ g(X(Ee[p.sceneType] || p.sceneType), 1)
547
573
  ]),
548
574
  _: 1
549
575
  }),
550
- i(B, {
576
+ o(j, {
551
577
  prop: "sceneName",
552
578
  label: "场景名称",
553
579
  "min-width": "150",
554
580
  "show-overflow-tooltip": ""
555
581
  }),
556
- i(B, {
582
+ o(j, {
557
583
  label: "智能体",
558
584
  "min-width": "130",
559
585
  "show-overflow-tooltip": ""
560
586
  }, {
561
- default: r(({ row: p }) => [
562
- C(H(p.agentNickname || "-"), 1)
587
+ default: s(({ row: p }) => [
588
+ g(X(p.agentNickname || "-"), 1)
563
589
  ]),
564
590
  _: 1
565
591
  }),
566
- i(B, {
592
+ o(j, {
567
593
  label: "创建时间",
568
594
  "min-width": "170"
569
595
  }, {
570
- default: r(({ row: p }) => [
571
- C(H(Ie(p.createdAt)), 1)
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
- [He, ae.value]
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
- }), vt = (b, Z) => {
588
- const X = b.__vccOpts || b;
589
- for (const [o, ee] of Z)
590
- X[o] = ee;
591
- return X;
592
- }, be = /* @__PURE__ */ vt(ct, [["__scopeId", "data-v-f0ca27ea"]]), dt = "usdp-eacp-conversation", gt = {
593
- install(b) {
594
- b.component(dt, be), b.component("UsdpEacpConversation", be);
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
- be as ConversationSession,
599
- gt as default
624
+ Te as ConversationSession,
625
+ ht as default
600
626
  };
601
627
  //# sourceMappingURL=index.js.map