st-comp 0.0.257 → 0.0.259

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.
@@ -1,15 +1,15 @@
1
- import { b as se, p as q, e as ae, u as ne, c as oe, n as re, _ as ie, w as le } from "./base-29f73b05.js";
2
- import { E as ce } from "./el-dialog-eedcfd3e.js";
1
+ import { b as le, p as Z, e as ce, u as ue, c as de, n as me, _ as pe, w as fe } from "./base-29f73b05.js";
2
+ import { E as ve } from "./el-dialog-eedcfd3e.js";
3
3
  import "./el-overlay-1ee0338d.js";
4
- import { E as ue } from "./el-button-e2c63c08.js";
5
- import { E as de } from "./el-input-d47281da.js";
6
- import { defineComponent as X, ref as T, computed as L, watch as G, openBlock as f, createElementBlock as _, normalizeClass as Q, unref as M, normalizeStyle as R, createBlock as K, withCtx as P, resolveDynamicComponent as me, renderSlot as pe, inject as fe, reactive as ve, nextTick as I, Fragment as A, createVNode as E, createElementVNode as n, renderList as ge, toDisplayString as U, createCommentVNode as x, createTextVNode as J, pushScopeId as _e, popScopeId as he } from "vue";
7
- import { d as O } from "./dayjs.min-8313b006.js";
8
- import { V as be } from "./index-7ed0999e.js";
9
- import { E as ye, u as ke, s as W, p as Te } from "./index-c2b9bbfd.js";
10
- import { _ as Se } from "./_plugin-vue_export-helper-dad06003.js";
11
- import { E as z } from "./index-f30561d3.js";
12
- import { k as we, i as Ce } from "./use-form-common-props-cb0ca65c.js";
4
+ import { E as ge } from "./el-button-e2c63c08.js";
5
+ import { E as he } from "./el-input-d47281da.js";
6
+ import { defineComponent as ee, ref as T, computed as I, watch as R, openBlock as v, createElementBlock as y, normalizeClass as te, unref as P, normalizeStyle as W, createBlock as X, withCtx as H, resolveDynamicComponent as _e, renderSlot as ye, inject as be, reactive as Te, onMounted as ke, nextTick as J, Fragment as O, createVNode as M, createElementVNode as o, renderList as Se, toDisplayString as G, createCommentVNode as $, createTextVNode as j, pushScopeId as we, popScopeId as Ce } from "vue";
7
+ import { d as B } from "./dayjs.min-8313b006.js";
8
+ import { V as Ee } from "./index-7ed0999e.js";
9
+ import { E as Ne, u as De, s as Q, p as Me } from "./index-c2b9bbfd.js";
10
+ import { _ as Ve } from "./_plugin-vue_export-helper-dad06003.js";
11
+ import { E as L } from "./index-f30561d3.js";
12
+ import { k as Pe, i as Ye } from "./use-form-common-props-cb0ca65c.js";
13
13
  import "./index-0f79095c.js";
14
14
  import "./index-8391a3df.js";
15
15
  import "./index-de24705f.js";
@@ -22,12 +22,12 @@ import "./index-657047bb.js";
22
22
  import "./typescript-7ae59c4c.js";
23
23
  import "./index-c71e37dc.js";
24
24
  import "./config-provider-7860903c.js";
25
- const Ee = se({
25
+ const He = le({
26
26
  size: {
27
27
  type: [Number, String],
28
- values: we,
28
+ values: Pe,
29
29
  default: "",
30
- validator: (u) => q(u)
30
+ validator: (c) => Z(c)
31
31
  },
32
32
  shape: {
33
33
  type: String,
@@ -35,7 +35,7 @@ const Ee = se({
35
35
  default: "circle"
36
36
  },
37
37
  icon: {
38
- type: Ce
38
+ type: Ye
39
39
  },
40
40
  src: {
41
41
  type: String,
@@ -44,166 +44,166 @@ const Ee = se({
44
44
  alt: String,
45
45
  srcSet: String,
46
46
  fit: {
47
- type: ae(String),
47
+ type: ce(String),
48
48
  default: "cover"
49
49
  }
50
- }), De = {
51
- error: (u) => u instanceof Event
52
- }, Ve = X({
50
+ }), Fe = {
51
+ error: (c) => c instanceof Event
52
+ }, Ae = ee({
53
53
  name: "ElAvatar"
54
- }), Me = /* @__PURE__ */ X({
55
- ...Ve,
56
- props: Ee,
57
- emits: De,
58
- setup(u, { emit: S }) {
59
- const b = u, i = ne("avatar"), v = T(!1), c = L(() => {
60
- const { size: s, icon: w, shape: a } = b, m = [i.b()];
61
- return oe(s) && m.push(i.m(s)), w && m.push(i.m("icon")), a && m.push(i.m(a)), m;
62
- }), y = L(() => {
63
- const { size: s } = b;
64
- return q(s) ? i.cssVarBlock({
65
- size: re(s) || ""
54
+ }), xe = /* @__PURE__ */ ee({
55
+ ...Ae,
56
+ props: He,
57
+ emits: Fe,
58
+ setup(c, { emit: E }) {
59
+ const k = c, r = ue("avatar"), g = T(!1), l = I(() => {
60
+ const { size: a, icon: w, shape: N } = k, s = [r.b()];
61
+ return de(a) && s.push(r.m(a)), w && s.push(r.m("icon")), N && s.push(r.m(N)), s;
62
+ }), S = I(() => {
63
+ const { size: a } = k;
64
+ return Z(a) ? r.cssVarBlock({
65
+ size: me(a) || ""
66
66
  }) : void 0;
67
- }), p = L(() => ({
68
- objectFit: b.fit
67
+ }), m = I(() => ({
68
+ objectFit: k.fit
69
69
  }));
70
- G(() => b.src, () => v.value = !1);
71
- function l(s) {
72
- v.value = !0, S("error", s);
70
+ R(() => k.src, () => g.value = !1);
71
+ function d(a) {
72
+ g.value = !0, E("error", a);
73
73
  }
74
- return (s, w) => (f(), _("span", {
75
- class: Q(M(c)),
76
- style: R(M(y))
74
+ return (a, w) => (v(), y("span", {
75
+ class: te(P(l)),
76
+ style: W(P(S))
77
77
  }, [
78
- (s.src || s.srcSet) && !v.value ? (f(), _("img", {
78
+ (a.src || a.srcSet) && !g.value ? (v(), y("img", {
79
79
  key: 0,
80
- src: s.src,
81
- alt: s.alt,
82
- srcset: s.srcSet,
83
- style: R(M(p)),
84
- onError: l
85
- }, null, 44, ["src", "alt", "srcset"])) : s.icon ? (f(), K(M(ye), { key: 1 }, {
86
- default: P(() => [
87
- (f(), K(me(s.icon)))
80
+ src: a.src,
81
+ alt: a.alt,
82
+ srcset: a.srcSet,
83
+ style: W(P(m)),
84
+ onError: d
85
+ }, null, 44, ["src", "alt", "srcset"])) : a.icon ? (v(), X(P(Ne), { key: 1 }, {
86
+ default: H(() => [
87
+ (v(), X(_e(a.icon)))
88
88
  ]),
89
89
  _: 1
90
- })) : pe(s.$slots, "default", { key: 2 })
90
+ })) : ye(a.$slots, "default", { key: 2 })
91
91
  ], 6));
92
92
  }
93
93
  });
94
- var Ne = /* @__PURE__ */ ie(Me, [["__file", "avatar.vue"]]);
95
- const Pe = le(Ne);
96
- const Ye = async ({ appId: u, apiKey: S, value: b, callback: i }) => {
97
- var v;
94
+ var Oe = /* @__PURE__ */ pe(xe, [["__file", "avatar.vue"]]);
95
+ const $e = fe(Oe);
96
+ const Be = async ({ appId: c, apiKey: E, value: k, callback: r }) => {
97
+ var g;
98
98
  try {
99
- const c = await fetch(`https://dashscope.aliyuncs.com/api/v1/apps/${u}/completion`, {
99
+ const l = await fetch(`https://dashscope.aliyuncs.com/api/v1/apps/${c}/completion`, {
100
100
  method: "POST",
101
101
  body: JSON.stringify({
102
- input: { prompt: b },
102
+ input: { prompt: k },
103
103
  parameters: { incremental_output: "true" },
104
104
  debug: {}
105
105
  }),
106
106
  headers: {
107
- Authorization: `Bearer ${S}`,
107
+ Authorization: `Bearer ${E}`,
108
108
  "Content-Type": "application/json",
109
109
  "X-DashScope-SSE": "enable"
110
110
  }
111
111
  });
112
- if (!c.ok) {
113
- i("error", `HTTP ${c.status}: ${c.statusText}`);
112
+ if (!l.ok) {
113
+ r("error", `HTTP ${l.status}: ${l.statusText}`);
114
114
  return;
115
115
  }
116
- const y = c.body.getReader(), p = new TextDecoder();
117
- let l = "", s = null;
116
+ const S = l.body.getReader(), m = new TextDecoder();
117
+ let d = "", a = null;
118
118
  for (; ; ) {
119
- const { done: w, value: a } = await y.read();
119
+ const { done: w, value: N } = await S.read();
120
120
  if (w) {
121
- l.trim() && He(l, i), i("finish", "");
121
+ d.trim() && ze(d, r), r("finish", "");
122
122
  break;
123
123
  }
124
- l += p.decode(a, { stream: !0 });
125
- let m;
126
- for (; (m = l.indexOf(`
124
+ d += m.decode(N, { stream: !0 });
125
+ let s;
126
+ for (; (s = d.indexOf(`
127
127
  `)) !== -1; ) {
128
- const k = l.substring(0, m).trim();
129
- if (l = l.substring(m + 1), k.startsWith("event:")) {
130
- s = k.substring(6).trim();
128
+ const _ = d.substring(0, s).trim();
129
+ if (d = d.substring(s + 1), _.startsWith("event:")) {
130
+ a = _.substring(6).trim();
131
131
  continue;
132
132
  }
133
- if (k.startsWith("data:")) {
134
- const C = k.substring(5).trim();
135
- if (s === "error" || C && C.startsWith("{"))
133
+ if (_.startsWith("data:")) {
134
+ const b = _.substring(5).trim();
135
+ if (a === "error" || b && b.startsWith("{"))
136
136
  try {
137
- const h = JSON.parse(C);
138
- if (h.code || h.message || s === "error") {
139
- const B = h.message || h.code || "未知错误";
140
- i("error", `百炼服务端错误: ${B}`);
137
+ const p = JSON.parse(b);
138
+ if (p.code || p.message || a === "error") {
139
+ const z = p.message || p.code || "未知错误";
140
+ r("error", `百炼服务端错误: ${z}`);
141
141
  return;
142
142
  }
143
- const F = (v = h == null ? void 0 : h.output) == null ? void 0 : v.text;
144
- F && i && i("message", F);
143
+ const x = (g = p == null ? void 0 : p.output) == null ? void 0 : g.text;
144
+ x && r && r("message", x);
145
145
  } catch {
146
- console.debug("JSON 解析失败:", C);
146
+ console.debug("JSON 解析失败:", b);
147
147
  }
148
- s = null;
148
+ a = null;
149
149
  }
150
150
  }
151
151
  }
152
- } catch (c) {
153
- console.error("流式请求失败:", c), i("error", c.message);
152
+ } catch (l) {
153
+ console.error("流式请求失败:", l), r("error", l.message);
154
154
  }
155
- }, He = (u, S) => {
156
- var v;
157
- const b = u.split(`
155
+ }, ze = (c, E) => {
156
+ var g;
157
+ const k = c.split(`
158
158
  `);
159
- let i = null;
160
- for (const c of b) {
161
- if (c.startsWith("event:")) {
162
- i = c.substring(6).trim();
159
+ let r = null;
160
+ for (const l of k) {
161
+ if (l.startsWith("event:")) {
162
+ r = l.substring(6).trim();
163
163
  continue;
164
164
  }
165
- if (c.startsWith("data:")) {
166
- const y = c.substring(5).trim();
167
- if (y && y !== "[DONE]")
165
+ if (l.startsWith("data:")) {
166
+ const S = l.substring(5).trim();
167
+ if (S && S !== "[DONE]")
168
168
  try {
169
- const p = JSON.parse(y);
170
- if (i === "error" || p.code || p.message) {
171
- const s = p.message || p.code || "未知错误";
172
- S("error", `百炼服务端错误: ${s}`);
169
+ const m = JSON.parse(S);
170
+ if (r === "error" || m.code || m.message) {
171
+ const a = m.message || m.code || "未知错误";
172
+ E("error", `百炼服务端错误: ${a}`);
173
173
  return;
174
174
  }
175
- const l = (v = p == null ? void 0 : p.output) == null ? void 0 : v.text;
176
- l && S && S("message", l);
175
+ const d = (g = m == null ? void 0 : m.output) == null ? void 0 : g.text;
176
+ d && E && E("message", d);
177
177
  } catch {
178
178
  }
179
- i = null;
179
+ r = null;
180
180
  }
181
181
  }
182
182
  };
183
- const D = (u) => (_e("data-v-485f55b8"), u = u(), he(), u), Fe = { class: "ai-dialog-body" }, Ae = { class: "avatar" }, xe = { class: "message-content" }, Oe = ["innerHTML"], $e = {
183
+ const V = (c) => (we("data-v-94f32fe5"), c = c(), Ce(), c), Le = { class: "ai-dialog-body" }, Ie = { class: "avatar" }, Je = { class: "message-content" }, je = ["innerHTML"], Re = {
184
184
  key: 1,
185
185
  class: "message-text"
186
- }, ze = { class: "message-createTime" }, Be = /* @__PURE__ */ D(() => /* @__PURE__ */ n("div", { class: "message-createTime" }, "请问对本轮查询结果是否满意?", -1)), Le = { class: "feedback-buttons" }, Ie = ["onClick"], Je = /* @__PURE__ */ D(() => /* @__PURE__ */ n("span", { class: "btn-emoji" }, "👍", -1)), je = /* @__PURE__ */ D(() => /* @__PURE__ */ n("span", { class: "btn-text" }, "满意", -1)), Re = [
187
- Je,
188
- je
189
- ], Ke = ["onClick"], Ue = /* @__PURE__ */ D(() => /* @__PURE__ */ n("span", { class: "btn-emoji" }, "👎", -1)), We = /* @__PURE__ */ D(() => /* @__PURE__ */ n("span", { class: "btn-text" }, "不满意", -1)), qe = [
190
- Ue,
191
- We
192
- ], Xe = {
186
+ }, qe = { class: "message-createTime" }, Ue = /* @__PURE__ */ V(() => /* @__PURE__ */ o("div", { class: "message-createTime" }, "请问对本轮查询结果是否满意?", -1)), Ke = { class: "feedback-buttons" }, We = ["onClick"], Xe = /* @__PURE__ */ V(() => /* @__PURE__ */ o("span", { class: "btn-emoji" }, "👍", -1)), Ge = /* @__PURE__ */ V(() => /* @__PURE__ */ o("span", { class: "btn-text" }, "满意", -1)), Qe = [
187
+ Xe,
188
+ Ge
189
+ ], Ze = ["onClick"], et = /* @__PURE__ */ V(() => /* @__PURE__ */ o("span", { class: "btn-emoji" }, "👎", -1)), tt = /* @__PURE__ */ V(() => /* @__PURE__ */ o("span", { class: "btn-text" }, "不满意", -1)), st = [
190
+ et,
191
+ tt
192
+ ], at = {
193
193
  key: 1,
194
194
  class: "message-createTime"
195
- }, Ge = {
195
+ }, nt = {
196
196
  key: 0,
197
197
  class: "message-item assistant"
198
- }, Qe = { class: "avatar" }, Ze = /* @__PURE__ */ D(() => /* @__PURE__ */ n("div", { class: "message-content" }, [
199
- /* @__PURE__ */ n("div", { class: "typing-indicator" }, [
200
- /* @__PURE__ */ n("span"),
201
- /* @__PURE__ */ n("span"),
202
- /* @__PURE__ */ n("span")
198
+ }, ot = { class: "avatar" }, rt = /* @__PURE__ */ V(() => /* @__PURE__ */ o("div", { class: "message-content" }, [
199
+ /* @__PURE__ */ o("div", { class: "typing-indicator" }, [
200
+ /* @__PURE__ */ o("span"),
201
+ /* @__PURE__ */ o("span"),
202
+ /* @__PURE__ */ o("span")
203
203
  ])
204
- ], -1)), et = { class: "input-area" }, tt = { class: "input-actions" }, st = /* @__PURE__ */ D(() => /* @__PURE__ */ n("div", { class: "input-hint" }, [
205
- /* @__PURE__ */ n("span", null, "Enter 发送 | Ctrl + Enter 换行")
206
- ], -1)), at = { class: "feedback-dialog-content" }, nt = /* @__PURE__ */ D(() => /* @__PURE__ */ n("div", { class: "feedback-emoji" }, "😟", -1)), ot = /* @__PURE__ */ D(() => /* @__PURE__ */ n("p", { class: "feedback-tip" }, "很抱歉没能帮到您,请告诉我们哪里需要改进:", -1)), rt = { class: "dialog-footer" }, it = {
204
+ ], -1)), it = { class: "input-area" }, lt = { class: "input-actions" }, ct = /* @__PURE__ */ V(() => /* @__PURE__ */ o("div", { class: "input-hint" }, [
205
+ /* @__PURE__ */ o("span", null, "Enter 发送 | Ctrl + Enter 换行")
206
+ ], -1)), ut = { class: "feedback-dialog-content" }, dt = /* @__PURE__ */ V(() => /* @__PURE__ */ o("div", { class: "feedback-emoji" }, "😟", -1)), mt = /* @__PURE__ */ V(() => /* @__PURE__ */ o("p", { class: "feedback-tip" }, "很抱歉没能帮到您,请告诉我们哪里需要改进:", -1)), pt = { class: "dialog-footer" }, ft = {
207
207
  __name: "index",
208
208
  props: {
209
209
  defaultMessage: {
@@ -215,58 +215,58 @@ const D = (u) => (_e("data-v-485f55b8"), u = u(), he(), u), Fe = { class: "ai-di
215
215
  }
216
216
  },
217
217
  emits: ["callBack"],
218
- setup(u, { expose: S, emit: b }) {
219
- const i = fe("stConfig"), v = ve(be()), c = T(!1), y = b, p = u, l = T(!1), s = T(!1), w = T(null), a = T([
218
+ setup(c, { expose: E, emit: k }) {
219
+ const r = be("stConfig"), g = Te(Ee()), l = T(!1), S = k, m = c, d = T(), a = T(!1), w = T(!1), N = T(null), s = T([
220
220
  {
221
221
  role: "assistant",
222
222
  // AI-assistant, 用户-user
223
- content: p.defaultMessage,
223
+ content: m.defaultMessage,
224
224
  userContent: null,
225
225
  showFeedback: !1,
226
226
  // 是否展示反馈按钮(默认信息不用展示)
227
227
  hasFeedback: !1,
228
228
  // 是否已进行过反馈
229
- createTime: O().format("YYYY-MM-DD HH:mm:ss"),
229
+ createTime: B().format("YYYY-MM-DD HH:mm:ss"),
230
230
  // 消息发起时间
231
231
  resTime: 0,
232
232
  // 响应总耗时
233
233
  firstPackageTime: 0
234
234
  // 首包响应耗时
235
235
  }
236
- ]), m = T(""), k = T(!1), C = T(""), h = T({}), F = (o) => {
237
- if (typeof o != "string")
236
+ ]), _ = T(""), b = T(!1), p = T(""), x = T({}), z = (n) => {
237
+ if (typeof n != "string")
238
238
  return !1;
239
239
  try {
240
- const e = JSON.parse(o);
240
+ const e = JSON.parse(n);
241
241
  return e !== null && typeof e == "object";
242
242
  } catch {
243
243
  return !1;
244
244
  }
245
- }, B = (o) => {
246
- if (!F(o))
245
+ }, se = (n) => {
246
+ if (!z(n))
247
247
  return null;
248
248
  try {
249
- const e = JSON.parse(o), { parsedConditions: t, ...d } = e;
249
+ const e = JSON.parse(n), { parsedConditions: t, ...i } = e;
250
250
  return {
251
251
  parsedConditions: t,
252
- webParams: d
252
+ webParams: i
253
253
  };
254
254
  } catch {
255
255
  return null;
256
256
  }
257
- }, Z = (o) => {
257
+ }, ae = (n) => {
258
258
  var t;
259
- if (!o)
259
+ if (!n)
260
260
  return "";
261
261
  let e = "";
262
- return (t = o.parsedConditions) != null && t.length && (e += '<div class="parsed-conditions">', o.parsedConditions.forEach((d) => {
263
- e += `<div class="parsed-conditions-item">${d}</div>`;
262
+ return (t = n.parsedConditions) != null && t.length && (e += '<div class="parsed-conditions">', n.parsedConditions.forEach((i) => {
263
+ e += `<div class="parsed-conditions-item">${i}</div>`;
264
264
  }), e += "</div>"), e;
265
- }, Y = async (o, e) => {
266
- switch (o) {
265
+ }, F = async (n, e) => {
266
+ switch (n) {
267
267
  case "satisfied": {
268
- const t = a.value[e], d = {
269
- userName: v.username,
268
+ const t = s.value[e], i = {
269
+ userName: g.username,
270
270
  userContent: t.userContent,
271
271
  aiContent: t.content,
272
272
  type: 1,
@@ -278,18 +278,18 @@ const D = (u) => (_e("data-v-485f55b8"), u = u(), he(), u), Fe = { class: "ai-di
278
278
  logOrigin: 1
279
279
  // 日志来源
280
280
  };
281
- await i.request.post("/alarm/deliversign/addVarietyAiHelperLog", d), z.success("感谢您的评价!"), a.value[e].hasFeedback = !0;
281
+ await r.request.post("/alarm/deliversign/addVarietyAiHelperLog", i), L.success("感谢您的评价!"), s.value[e].hasFeedback = !0;
282
282
  break;
283
283
  }
284
284
  case "open": {
285
- h.value = e, k.value = !0;
285
+ x.value = e, b.value = !0;
286
286
  break;
287
287
  }
288
288
  case "unsatisfied": {
289
- const t = a.value[e], d = {
290
- userName: v.username,
289
+ const t = s.value[e], i = {
290
+ userName: g.username,
291
291
  userContent: t.userContent,
292
- userSuggestion: C.value,
292
+ userSuggestion: p.value,
293
293
  aiContent: t.content,
294
294
  type: 2,
295
295
  resTime: t.resTime,
@@ -300,14 +300,14 @@ const D = (u) => (_e("data-v-485f55b8"), u = u(), he(), u), Fe = { class: "ai-di
300
300
  logOrigin: 1
301
301
  // 日志来源
302
302
  };
303
- await i.request.post("/alarm/deliversign/addVarietyAiHelperLog", d), z.success("感谢您的反馈!我们将持续跟踪并进行优化"), k.value = !1, a.value[e].hasFeedback = !0;
303
+ await r.request.post("/alarm/deliversign/addVarietyAiHelperLog", i), L.success("感谢您的反馈!我们将持续跟踪并进行优化"), b.value = !1, s.value[e].hasFeedback = !0;
304
304
  break;
305
305
  }
306
306
  case "default": {
307
- const t = a.value[e], d = {
308
- userName: v.username,
307
+ const t = s.value[e], i = {
308
+ userName: g.username,
309
309
  userContent: t.userContent,
310
- userSuggestion: C.value,
310
+ userSuggestion: p.value,
311
311
  aiContent: t.content,
312
312
  type: null,
313
313
  resTime: t.resTime,
@@ -318,110 +318,137 @@ const D = (u) => (_e("data-v-485f55b8"), u = u(), he(), u), Fe = { class: "ai-di
318
318
  logOrigin: 1
319
319
  // 日志来源
320
320
  };
321
- await i.request.post("/alarm/deliversign/addVarietyAiHelperLog", d);
321
+ await r.request.post("/alarm/deliversign/addVarietyAiHelperLog", i);
322
322
  }
323
323
  }
324
- }, j = async () => {
325
- const o = m.value.trim();
326
- if (!o)
327
- return z.warning("请输入消息内容");
328
- if (l.value)
324
+ }, q = async () => {
325
+ const n = _.value.trim();
326
+ if (!n)
327
+ return L.warning("请输入消息内容");
328
+ if (a.value)
329
329
  return;
330
- a.value.push({
330
+ s.value.push({
331
331
  role: "user",
332
- content: o,
333
- createTime: O().format("YYYY-MM-DD HH:mm:ss")
334
- }), m.value = "", await N(), a.value.push({
332
+ content: n,
333
+ createTime: B().format("YYYY-MM-DD HH:mm:ss")
334
+ }), _.value = "", await Y(), s.value.push({
335
335
  role: "assistant",
336
336
  content: "",
337
- userContent: o,
337
+ userContent: n,
338
338
  showFeedback: !1,
339
339
  hasFeedback: !1,
340
- createTime: O().format("YYYY-MM-DD HH:mm:ss"),
340
+ createTime: B().format("YYYY-MM-DD HH:mm:ss"),
341
341
  resTime: 0,
342
342
  firstPackageTime: 0
343
- }), await N(), l.value = !0, s.value = !0;
343
+ }), await Y(), a.value = !0, w.value = !0;
344
344
  let e = "", t = (/* @__PURE__ */ new Date()).getTime();
345
345
  try {
346
- await Ye({
346
+ await Be({
347
347
  appId: "9e54d112acfe4531bd1fc4fee8827fef",
348
348
  apiKey: "sk-d995eb26a4334bdeb2ccb4cbfaf51de8",
349
- value: o,
350
- callback: (H, g) => {
351
- if (H === "error") {
352
- s.value = !1, l.value = !1, a.value.pop(), a.value.push({
349
+ value: n,
350
+ callback: (D, h) => {
351
+ var u;
352
+ if (D === "error") {
353
+ w.value = !1, a.value = !1, s.value.pop(), s.value.push({
353
354
  role: "assistant",
354
- userContent: o,
355
- content: `❌ ${g}`,
355
+ userContent: n,
356
+ content: `❌ ${h}`,
356
357
  showFeedback: !1,
357
358
  hasFeedback: !1,
358
- createTime: O().format("YYYY-MM-DD HH:mm:ss"),
359
+ createTime: B().format("YYYY-MM-DD HH:mm:ss"),
359
360
  resTime: (/* @__PURE__ */ new Date()).getTime() - t,
360
361
  firstPackageTime: 0
361
- }), Y("default", a.value.length - 1), N();
362
+ }), F("default", s.value.length - 1), Y();
362
363
  return;
363
- } else if (H === "message") {
364
- e += g;
365
- const r = a.value[a.value.length - 1];
366
- r && r.role === "assistant" && (r.content = e, N()), r.firstPackageTime === 0 && (r.firstPackageTime = (/* @__PURE__ */ new Date()).getTime() - t);
367
- } else if (H === "finish") {
368
- s.value = !1, l.value = !1;
369
- const r = a.value[a.value.length - 1];
370
- r && r.role === "assistant" && (r.showFeedback = !0, r.resTime = (/* @__PURE__ */ new Date()).getTime() - t, Y("default", a.value.length - 1));
364
+ } else if (D === "message") {
365
+ e += h;
366
+ const f = s.value[s.value.length - 1];
367
+ f && f.role === "assistant" && (f.content = e, Y()), f.firstPackageTime === 0 && (f.firstPackageTime = (/* @__PURE__ */ new Date()).getTime() - t);
368
+ } else if (D === "finish") {
369
+ w.value = !1, a.value = !1;
370
+ const f = s.value[s.value.length - 1];
371
+ f && f.role === "assistant" && (f.showFeedback = !0, f.resTime = (/* @__PURE__ */ new Date()).getTime() - t, F("default", s.value.length - 1)), console.log(e);
371
372
  try {
372
- const V = JSON.parse(e);
373
- delete V.parsedConditions, console.log(V), y("callBack", V);
373
+ const C = JSON.parse(e);
374
+ if (C.parsedConditions && delete C.parsedConditions, (u = C.customTagNames) != null && u.length) {
375
+ const re = C.customTagNames.reduce((U, ie) => {
376
+ const K = d.value[ie];
377
+ return K && U.push(K), U;
378
+ }, []);
379
+ delete C.customTagNames, C.customTag = re;
380
+ }
381
+ S("callBack", C);
374
382
  } catch {
375
- y("callBack", e);
383
+ S("callBack", e);
376
384
  }
377
385
  }
378
386
  }
379
387
  });
380
- } catch (d) {
381
- z.error(`AI响应异常: ${d}`), a.value.pop(), a.value.push({
388
+ } catch (i) {
389
+ L.error(`AI响应异常: ${i}`), s.value.pop(), s.value.push({
382
390
  role: "assistant",
383
- userContent: o,
391
+ userContent: n,
384
392
  content: "❌ 抱歉,AI服务响应异常,请稍后重试。",
385
393
  showFeedback: !0,
386
394
  hasFeedback: !1,
387
- createTime: O().format("YYYY-MM-DD HH:mm:ss"),
395
+ createTime: B().format("YYYY-MM-DD HH:mm:ss"),
388
396
  resTime: (/* @__PURE__ */ new Date()).getTime() - t,
389
397
  firstPackageTime: 0
390
- }), Y("default", a.value.length - 1), await N(), l.value = !1, s.value = !1;
398
+ }), F("default", s.value.length - 1), await Y(), a.value = !1, w.value = !1;
391
399
  }
392
- }, ee = (o) => {
393
- if (o.key === "Enter")
394
- if (o.ctrlKey) {
395
- o.preventDefault();
396
- const e = o.target, t = e.selectionStart, d = e.selectionEnd;
397
- m.value = m.value.substring(0, t) + `
398
- ` + m.value.substring(d), I(() => {
400
+ }, ne = (n) => {
401
+ if (n.key === "Enter")
402
+ if (n.ctrlKey) {
403
+ n.preventDefault();
404
+ const e = n.target, t = e.selectionStart, i = e.selectionEnd;
405
+ _.value = _.value.substring(0, t) + `
406
+ ` + _.value.substring(i), J(() => {
399
407
  e.selectionStart = e.selectionEnd = t + 1;
400
408
  });
401
409
  } else
402
- o.preventDefault(), j();
403
- }, N = async () => {
404
- await I(), w.value && (w.value.scrollTop = w.value.scrollHeight);
410
+ n.preventDefault(), q();
411
+ }, Y = async () => {
412
+ await J(), N.value && (N.value.scrollTop = N.value.scrollHeight);
413
+ }, oe = async () => {
414
+ const n = await Promise.all([r.request.post("/alarm/deliversign/findTagsByUserId"), r.request.post("/alarm/deliversign/findSystemTagsByTagName")]);
415
+ d.value = n.reduce((e, t) => {
416
+ var i;
417
+ return {
418
+ ...e,
419
+ ...(i = t.body) == null ? void 0 : i.reduce((A, D) => ({
420
+ ...A,
421
+ [D.tagName]: D.id
422
+ }), {})
423
+ };
424
+ }, {});
405
425
  };
406
- return G(
407
- () => a.value,
426
+ return ke(() => {
427
+ oe();
428
+ }), R(
429
+ () => s.value,
408
430
  () => {
409
- N();
431
+ Y();
410
432
  },
411
433
  { deep: !0 }
412
- ), S({
434
+ ), R(
435
+ () => b.value,
436
+ (n) => {
437
+ n || (p.value = "");
438
+ }
439
+ ), E({
413
440
  open: () => {
414
- c.value = !0, I(() => {
415
- N();
441
+ l.value = !0, J(() => {
442
+ Y();
416
443
  });
417
444
  }
418
- }), (o, e) => {
419
- const t = Pe, d = de, $ = ue, H = ce;
420
- return f(), _(A, null, [
421
- E(H, {
445
+ }), (n, e) => {
446
+ const t = $e, i = he, A = ge, D = ve;
447
+ return v(), y(O, null, [
448
+ M(D, {
422
449
  class: "ai-dialog",
423
- modelValue: c.value,
424
- "onUpdate:modelValue": e[1] || (e[1] = (g) => c.value = g),
450
+ modelValue: l.value,
451
+ "onUpdate:modelValue": e[1] || (e[1] = (h) => l.value = h),
425
452
  title: "✨ 品种池参数解析AI助手",
426
453
  width: "500px",
427
454
  center: "",
@@ -430,85 +457,85 @@ const D = (u) => (_e("data-v-485f55b8"), u = u(), he(), u), Fe = { class: "ai-di
430
457
  modal: !1,
431
458
  "modal-penetrable": !0
432
459
  }, {
433
- default: P(() => {
434
- var g;
460
+ default: H(() => {
461
+ var h;
435
462
  return [
436
- n("div", Fe, [
437
- n("div", {
463
+ o("div", Le, [
464
+ o("div", {
438
465
  ref_key: "messageListRef",
439
- ref: w,
466
+ ref: N,
440
467
  class: "message-list"
441
468
  }, [
442
- (f(!0), _(A, null, ge(a.value, (r, V) => (f(), _("div", {
443
- key: V,
444
- class: Q([r.role, "message-item"])
469
+ (v(!0), y(O, null, Se(s.value, (u, f) => (v(), y("div", {
470
+ key: f,
471
+ class: te([u.role, "message-item"])
445
472
  }, [
446
- r.content ? (f(), _(A, { key: 0 }, [
447
- n("div", Ae, [
448
- E(t, {
473
+ u.content ? (v(), y(O, { key: 0 }, [
474
+ o("div", Ie, [
475
+ M(t, {
449
476
  size: 32,
450
- icon: r.role === "user" ? M(ke) : M(W)
477
+ icon: u.role === "user" ? P(De) : P(Q)
451
478
  }, null, 8, ["icon"])
452
479
  ]),
453
- n("div", xe, [
454
- F(r.content) ? (f(), _("div", {
480
+ o("div", Je, [
481
+ z(u.content) ? (v(), y("div", {
455
482
  key: 0,
456
483
  class: "message-json",
457
- innerHTML: Z(B(r.content))
458
- }, null, 8, Oe)) : (f(), _("div", $e, U(r.content), 1)),
459
- n("div", ze, U(r.createTime), 1),
460
- r.role === "assistant" ? (f(), _(A, { key: 2 }, [
461
- r.showFeedback && !r.hasFeedback ? (f(), _(A, { key: 0 }, [
462
- Be,
463
- n("div", Le, [
464
- n("button", {
484
+ innerHTML: ae(se(u.content))
485
+ }, null, 8, je)) : (v(), y("div", Re, G(u.content), 1)),
486
+ o("div", qe, G(u.createTime), 1),
487
+ u.role === "assistant" ? (v(), y(O, { key: 2 }, [
488
+ u.showFeedback && !u.hasFeedback ? (v(), y(O, { key: 0 }, [
489
+ Ue,
490
+ o("div", Ke, [
491
+ o("button", {
465
492
  class: "feedback-btn satisfied-btn",
466
- onClick: (te) => Y("satisfied", V)
467
- }, Re, 8, Ie),
468
- n("button", {
493
+ onClick: (C) => F("satisfied", f)
494
+ }, Qe, 8, We),
495
+ o("button", {
469
496
  class: "feedback-btn unsatisfied-btn",
470
- onClick: (te) => Y("open", V)
471
- }, qe, 8, Ke)
497
+ onClick: (C) => F("open", f)
498
+ }, st, 8, Ze)
472
499
  ])
473
- ], 64)) : x("", !0),
474
- r.showFeedback && r.hasFeedback ? (f(), _("div", Xe, "感谢您进行的评价反馈")) : x("", !0)
475
- ], 64)) : x("", !0)
500
+ ], 64)) : $("", !0),
501
+ u.showFeedback && u.hasFeedback ? (v(), y("div", at, "感谢您进行的评价反馈")) : $("", !0)
502
+ ], 64)) : $("", !0)
476
503
  ])
477
- ], 64)) : x("", !0)
504
+ ], 64)) : $("", !0)
478
505
  ], 2))), 128)),
479
- s.value && !((g = a.value[a.value.length - 1]) != null && g.content) ? (f(), _("div", Ge, [
480
- n("div", Qe, [
481
- E(t, {
506
+ w.value && !((h = s.value[s.value.length - 1]) != null && h.content) ? (v(), y("div", nt, [
507
+ o("div", ot, [
508
+ M(t, {
482
509
  size: 32,
483
- icon: M(W)
510
+ icon: P(Q)
484
511
  }, null, 8, ["icon"])
485
512
  ]),
486
- Ze
487
- ])) : x("", !0)
513
+ rt
514
+ ])) : $("", !0)
488
515
  ], 512),
489
- n("div", et, [
490
- E(d, {
516
+ o("div", it, [
517
+ M(i, {
491
518
  class: "message-input",
492
- modelValue: m.value,
493
- "onUpdate:modelValue": e[0] || (e[0] = (r) => m.value = r),
519
+ modelValue: _.value,
520
+ "onUpdate:modelValue": e[0] || (e[0] = (u) => _.value = u),
494
521
  type: "textarea",
495
522
  rows: 4,
496
523
  autosize: { minRows: 2, maxRows: 4 },
497
- placeholder: "输入您想查询的品种条件... (Ctrl+Enter换行,Enter发送)",
498
- onKeydown: ee
524
+ placeholder: "输入您想查询的品种条件...",
525
+ onKeydown: ne
499
526
  }, null, 8, ["modelValue"]),
500
- n("div", tt, [
501
- st,
502
- E($, {
527
+ o("div", lt, [
528
+ ct,
529
+ M(A, {
503
530
  class: "send-btn",
504
531
  type: "primary",
505
- icon: M(Te),
506
- loading: l.value,
507
- onClick: j,
532
+ icon: P(Me),
533
+ loading: a.value,
534
+ onClick: q,
508
535
  round: ""
509
536
  }, {
510
- default: P(() => [
511
- J(" 发送 ")
537
+ default: H(() => [
538
+ j(" 发送 ")
512
539
  ]),
513
540
  _: 1
514
541
  }, 8, ["icon", "loading"])
@@ -519,40 +546,40 @@ const D = (u) => (_e("data-v-485f55b8"), u = u(), he(), u), Fe = { class: "ai-di
519
546
  }),
520
547
  _: 1
521
548
  }, 8, ["modelValue"]),
522
- E(H, {
523
- modelValue: k.value,
524
- "onUpdate:modelValue": e[5] || (e[5] = (g) => k.value = g),
549
+ M(D, {
550
+ modelValue: b.value,
551
+ "onUpdate:modelValue": e[5] || (e[5] = (h) => b.value = h),
525
552
  title: "📝 反馈意见",
526
553
  width: "400px"
527
554
  }, {
528
- footer: P(() => [
529
- n("span", rt, [
530
- E($, {
531
- onClick: e[3] || (e[3] = (g) => k.value = !1)
555
+ footer: H(() => [
556
+ o("span", pt, [
557
+ M(A, {
558
+ onClick: e[3] || (e[3] = (h) => b.value = !1)
532
559
  }, {
533
- default: P(() => [
534
- J("取消")
560
+ default: H(() => [
561
+ j("取消")
535
562
  ]),
536
563
  _: 1
537
564
  }),
538
- E($, {
565
+ M(A, {
539
566
  type: "primary",
540
- onClick: e[4] || (e[4] = (g) => Y("unsatisfied", h.value))
567
+ onClick: e[4] || (e[4] = (h) => F("unsatisfied", x.value))
541
568
  }, {
542
- default: P(() => [
543
- J("提交反馈")
569
+ default: H(() => [
570
+ j("提交反馈")
544
571
  ]),
545
572
  _: 1
546
573
  })
547
574
  ])
548
575
  ]),
549
- default: P(() => [
550
- n("div", at, [
551
- nt,
552
- ot,
553
- E(d, {
554
- modelValue: C.value,
555
- "onUpdate:modelValue": e[2] || (e[2] = (g) => C.value = g),
576
+ default: H(() => [
577
+ o("div", ut, [
578
+ dt,
579
+ mt,
580
+ M(i, {
581
+ modelValue: p.value,
582
+ "onUpdate:modelValue": e[2] || (e[2] = (h) => p.value = h),
556
583
  type: "textarea",
557
584
  rows: 4,
558
585
  placeholder: "[非必填]例如:回答不够准确、查询结果有误、界面体验不佳..."
@@ -564,11 +591,11 @@ const D = (u) => (_e("data-v-485f55b8"), u = u(), he(), u), Fe = { class: "ai-di
564
591
  ], 64);
565
592
  };
566
593
  }
567
- }, lt = /* @__PURE__ */ Se(it, [["__scopeId", "data-v-485f55b8"]]), Ht = {
568
- install(u) {
569
- u.component("st-varietyAiHelper", lt);
594
+ }, vt = /* @__PURE__ */ Ve(ft, [["__scopeId", "data-v-94f32fe5"]]), zt = {
595
+ install(c) {
596
+ c.component("st-varietyAiHelper", vt);
570
597
  }
571
598
  };
572
599
  export {
573
- Ht as default
600
+ zt as default
574
601
  };