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