st-comp 0.0.256 → 0.0.258

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 V, 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 $ } 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 O } 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(V(c)),
76
- style: R(V(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(V(p)),
84
- onError: l
85
- }, null, 44, ["src", "alt", "srcset"])) : s.icon ? (f(), K(V(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-50a97ff3"), u = u(), he(), u), Fe = { class: "ai-dialog-body" }, Ae = { class: "avatar" }, xe = { class: "message-content" }, $e = ["innerHTML"], ze = {
183
+ const V = (c) => (we("data-v-51517f38"), 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
- }, Oe = { 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,201 +215,240 @@ const D = (u) => (_e("data-v-50a97ff3"), 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: $().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,
273
273
  createTime: t.createTime,
274
274
  resTime: t.resTime,
275
- firstPackageTime: t.firstPackageTime
275
+ firstPackageTime: t.firstPackageTime,
276
+ isSolved: 1,
277
+ // 是否解决
278
+ logOrigin: 1
279
+ // 日志来源
276
280
  };
277
- await i.request.post("/alarm/deliversign/addVarietyAiHelperLog", d), O.success("感谢您的评价!"), a.value[e].hasFeedback = !0;
281
+ await r.request.post("/alarm/deliversign/addVarietyAiHelperLog", i), L.success("感谢您的评价!"), s.value[e].hasFeedback = !0;
278
282
  break;
279
283
  }
280
284
  case "open": {
281
- h.value = e, k.value = !0;
285
+ x.value = e, b.value = !0;
282
286
  break;
283
287
  }
284
288
  case "unsatisfied": {
285
- const t = a.value[e], d = {
286
- userName: v.username,
289
+ const t = s.value[e], i = {
290
+ userName: g.username,
287
291
  userContent: t.userContent,
288
- userSuggestion: C.value,
292
+ userSuggestion: p.value,
289
293
  aiContent: t.content,
290
294
  type: 2,
291
295
  resTime: t.resTime,
292
296
  createTime: t.createTime,
293
- firstPackageTime: t.firstPackageTime
297
+ firstPackageTime: t.firstPackageTime,
298
+ isSolved: 0,
299
+ // 是否解决
300
+ logOrigin: 1
301
+ // 日志来源
294
302
  };
295
- await i.request.post("/alarm/deliversign/addVarietyAiHelperLog", d), O.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;
296
304
  break;
297
305
  }
298
306
  case "default": {
299
- const t = a.value[e], d = {
300
- userName: v.username,
307
+ const t = s.value[e], i = {
308
+ userName: g.username,
301
309
  userContent: t.userContent,
302
- userSuggestion: C.value,
310
+ userSuggestion: p.value,
303
311
  aiContent: t.content,
304
312
  type: null,
305
313
  resTime: t.resTime,
306
314
  createTime: t.createTime,
307
- firstPackageTime: t.firstPackageTime
315
+ firstPackageTime: t.firstPackageTime,
316
+ isSolved: 1,
317
+ // 是否解决
318
+ logOrigin: 1
319
+ // 日志来源
308
320
  };
309
- await i.request.post("/alarm/deliversign/addVarietyAiHelperLog", d);
321
+ await r.request.post("/alarm/deliversign/addVarietyAiHelperLog", i);
310
322
  }
311
323
  }
312
- }, j = async () => {
313
- const o = m.value.trim();
314
- if (!o)
315
- return O.warning("请输入消息内容");
316
- if (l.value)
324
+ }, q = async () => {
325
+ const n = _.value.trim();
326
+ if (!n)
327
+ return L.warning("请输入消息内容");
328
+ if (a.value)
317
329
  return;
318
- a.value.push({
330
+ s.value.push({
319
331
  role: "user",
320
- content: o,
321
- createTime: $().format("YYYY-MM-DD HH:mm:ss")
322
- }), m.value = "", await M(), a.value.push({
332
+ content: n,
333
+ createTime: B().format("YYYY-MM-DD HH:mm:ss")
334
+ }), _.value = "", await Y(), s.value.push({
323
335
  role: "assistant",
324
336
  content: "",
325
- userContent: o,
337
+ userContent: n,
326
338
  showFeedback: !1,
327
339
  hasFeedback: !1,
328
- createTime: $().format("YYYY-MM-DD HH:mm:ss"),
340
+ createTime: B().format("YYYY-MM-DD HH:mm:ss"),
329
341
  resTime: 0,
330
342
  firstPackageTime: 0
331
- }), await M(), l.value = !0, s.value = !0;
343
+ }), await Y(), a.value = !0, w.value = !0;
332
344
  let e = "", t = (/* @__PURE__ */ new Date()).getTime();
333
345
  try {
334
- await Ye({
346
+ await Be({
335
347
  appId: "9e54d112acfe4531bd1fc4fee8827fef",
336
348
  apiKey: "sk-d995eb26a4334bdeb2ccb4cbfaf51de8",
337
- value: o,
338
- callback: (H, g) => {
339
- if (H === "error") {
340
- 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({
341
354
  role: "assistant",
342
- userContent: o,
343
- content: `❌ ${g}`,
355
+ userContent: n,
356
+ content: `❌ ${h}`,
344
357
  showFeedback: !1,
345
358
  hasFeedback: !1,
346
- createTime: $().format("YYYY-MM-DD HH:mm:ss"),
359
+ createTime: B().format("YYYY-MM-DD HH:mm:ss"),
347
360
  resTime: (/* @__PURE__ */ new Date()).getTime() - t,
348
361
  firstPackageTime: 0
349
- }), Y("default", a.value.length - 1), M();
362
+ }), F("default", s.value.length - 1), Y();
350
363
  return;
351
- } else if (H === "message") {
352
- e += g;
353
- const r = a.value[a.value.length - 1];
354
- r && r.role === "assistant" && (r.content = e, M()), r.firstPackageTime === 0 && (r.firstPackageTime = (/* @__PURE__ */ new Date()).getTime() - t);
355
- } else if (H === "finish") {
356
- s.value = !1, l.value = !1;
357
- const r = a.value[a.value.length - 1];
358
- 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);
359
372
  try {
360
- const N = JSON.parse(e);
361
- delete N.parsedConditions, y("callBack", N);
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);
362
382
  } catch {
363
- y("callBack", e);
383
+ S("callBack", e);
364
384
  }
365
385
  }
366
386
  }
367
387
  });
368
- } catch (d) {
369
- O.error(`AI响应异常: ${d}`), a.value.pop(), a.value.push({
388
+ } catch (i) {
389
+ L.error(`AI响应异常: ${i}`), s.value.pop(), s.value.push({
370
390
  role: "assistant",
371
- userContent: o,
391
+ userContent: n,
372
392
  content: "❌ 抱歉,AI服务响应异常,请稍后重试。",
373
393
  showFeedback: !0,
374
394
  hasFeedback: !1,
375
- createTime: $().format("YYYY-MM-DD HH:mm:ss"),
395
+ createTime: B().format("YYYY-MM-DD HH:mm:ss"),
376
396
  resTime: (/* @__PURE__ */ new Date()).getTime() - t,
377
397
  firstPackageTime: 0
378
- }), Y("default", a.value.length - 1), await M(), l.value = !1, s.value = !1;
398
+ }), F("default", s.value.length - 1), await Y(), a.value = !1, w.value = !1;
379
399
  }
380
- }, ee = (o) => {
381
- if (o.key === "Enter")
382
- if (o.ctrlKey) {
383
- o.preventDefault();
384
- const e = o.target, t = e.selectionStart, d = e.selectionEnd;
385
- m.value = m.value.substring(0, t) + `
386
- ` + 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(() => {
387
407
  e.selectionStart = e.selectionEnd = t + 1;
388
408
  });
389
409
  } else
390
- o.preventDefault(), j();
391
- }, M = async () => {
392
- 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
+ }, {});
393
425
  };
394
- return G(
395
- () => a.value,
426
+ return ke(() => {
427
+ oe();
428
+ }), R(
429
+ () => s.value,
396
430
  () => {
397
- M();
431
+ Y();
398
432
  },
399
433
  { deep: !0 }
400
- ), S({
434
+ ), R(
435
+ () => b.value,
436
+ (n) => {
437
+ n || (p.value = "");
438
+ }
439
+ ), E({
401
440
  open: () => {
402
- c.value = !0, I(() => {
403
- M();
441
+ l.value = !0, J(() => {
442
+ Y();
404
443
  });
405
444
  }
406
- }), (o, e) => {
407
- const t = Pe, d = de, z = ue, H = ce;
408
- return f(), _(A, null, [
409
- E(H, {
445
+ }), (n, e) => {
446
+ const t = $e, i = he, A = ge, D = ve;
447
+ return v(), y(O, null, [
448
+ M(D, {
410
449
  class: "ai-dialog",
411
- modelValue: c.value,
412
- "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),
413
452
  title: "✨ 品种池参数解析AI助手",
414
453
  width: "500px",
415
454
  center: "",
@@ -418,85 +457,85 @@ const D = (u) => (_e("data-v-50a97ff3"), u = u(), he(), u), Fe = { class: "ai-di
418
457
  modal: !1,
419
458
  "modal-penetrable": !0
420
459
  }, {
421
- default: P(() => {
422
- var g;
460
+ default: H(() => {
461
+ var h;
423
462
  return [
424
- n("div", Fe, [
425
- n("div", {
463
+ o("div", Le, [
464
+ o("div", {
426
465
  ref_key: "messageListRef",
427
- ref: w,
466
+ ref: N,
428
467
  class: "message-list"
429
468
  }, [
430
- (f(!0), _(A, null, ge(a.value, (r, N) => (f(), _("div", {
431
- key: N,
432
- 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"])
433
472
  }, [
434
- r.content ? (f(), _(A, { key: 0 }, [
435
- n("div", Ae, [
436
- E(t, {
473
+ u.content ? (v(), y(O, { key: 0 }, [
474
+ o("div", Ie, [
475
+ M(t, {
437
476
  size: 32,
438
- icon: r.role === "user" ? V(ke) : V(W)
477
+ icon: u.role === "user" ? P(De) : P(Q)
439
478
  }, null, 8, ["icon"])
440
479
  ]),
441
- n("div", xe, [
442
- F(r.content) ? (f(), _("div", {
480
+ o("div", Je, [
481
+ z(u.content) ? (v(), y("div", {
443
482
  key: 0,
444
483
  class: "message-json",
445
- innerHTML: Z(B(r.content))
446
- }, null, 8, $e)) : (f(), _("div", ze, U(r.content), 1)),
447
- n("div", Oe, U(r.createTime), 1),
448
- r.role === "assistant" ? (f(), _(A, { key: 2 }, [
449
- r.showFeedback && !r.hasFeedback ? (f(), _(A, { key: 0 }, [
450
- Be,
451
- n("div", Le, [
452
- 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", {
453
492
  class: "feedback-btn satisfied-btn",
454
- onClick: (te) => Y("satisfied", N)
455
- }, Re, 8, Ie),
456
- n("button", {
493
+ onClick: (C) => F("satisfied", f)
494
+ }, Qe, 8, We),
495
+ o("button", {
457
496
  class: "feedback-btn unsatisfied-btn",
458
- onClick: (te) => Y("open", N)
459
- }, qe, 8, Ke)
497
+ onClick: (C) => F("open", f)
498
+ }, st, 8, Ze)
460
499
  ])
461
- ], 64)) : x("", !0),
462
- r.showFeedback && r.hasFeedback ? (f(), _("div", Xe, "感谢您进行的评价反馈")) : x("", !0)
463
- ], 64)) : x("", !0)
500
+ ], 64)) : $("", !0),
501
+ u.showFeedback && u.hasFeedback ? (v(), y("div", at, "感谢您进行的评价反馈")) : $("", !0)
502
+ ], 64)) : $("", !0)
464
503
  ])
465
- ], 64)) : x("", !0)
504
+ ], 64)) : $("", !0)
466
505
  ], 2))), 128)),
467
- s.value && !((g = a.value[a.value.length - 1]) != null && g.content) ? (f(), _("div", Ge, [
468
- n("div", Qe, [
469
- 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, {
470
509
  size: 32,
471
- icon: V(W)
510
+ icon: P(Q)
472
511
  }, null, 8, ["icon"])
473
512
  ]),
474
- Ze
475
- ])) : x("", !0)
513
+ rt
514
+ ])) : $("", !0)
476
515
  ], 512),
477
- n("div", et, [
478
- E(d, {
516
+ o("div", it, [
517
+ M(i, {
479
518
  class: "message-input",
480
- modelValue: m.value,
481
- "onUpdate:modelValue": e[0] || (e[0] = (r) => m.value = r),
519
+ modelValue: _.value,
520
+ "onUpdate:modelValue": e[0] || (e[0] = (u) => _.value = u),
482
521
  type: "textarea",
483
522
  rows: 4,
484
523
  autosize: { minRows: 2, maxRows: 4 },
485
- placeholder: "输入您想查询的品种条件... (Ctrl+Enter换行,Enter发送)",
486
- onKeydown: ee
524
+ placeholder: "输入您想查询的品种条件...",
525
+ onKeydown: ne
487
526
  }, null, 8, ["modelValue"]),
488
- n("div", tt, [
489
- st,
490
- E(z, {
527
+ o("div", lt, [
528
+ ct,
529
+ M(A, {
491
530
  class: "send-btn",
492
531
  type: "primary",
493
- icon: V(Te),
494
- loading: l.value,
495
- onClick: j,
532
+ icon: P(Me),
533
+ loading: a.value,
534
+ onClick: q,
496
535
  round: ""
497
536
  }, {
498
- default: P(() => [
499
- J(" 发送 ")
537
+ default: H(() => [
538
+ j(" 发送 ")
500
539
  ]),
501
540
  _: 1
502
541
  }, 8, ["icon", "loading"])
@@ -507,40 +546,40 @@ const D = (u) => (_e("data-v-50a97ff3"), u = u(), he(), u), Fe = { class: "ai-di
507
546
  }),
508
547
  _: 1
509
548
  }, 8, ["modelValue"]),
510
- E(H, {
511
- modelValue: k.value,
512
- "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),
513
552
  title: "📝 反馈意见",
514
553
  width: "400px"
515
554
  }, {
516
- footer: P(() => [
517
- n("span", rt, [
518
- E(z, {
519
- 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)
520
559
  }, {
521
- default: P(() => [
522
- J("取消")
560
+ default: H(() => [
561
+ j("取消")
523
562
  ]),
524
563
  _: 1
525
564
  }),
526
- E(z, {
565
+ M(A, {
527
566
  type: "primary",
528
- onClick: e[4] || (e[4] = (g) => Y("unsatisfied", h.value))
567
+ onClick: e[4] || (e[4] = (h) => F("unsatisfied", x.value))
529
568
  }, {
530
- default: P(() => [
531
- J("提交反馈")
569
+ default: H(() => [
570
+ j("提交反馈")
532
571
  ]),
533
572
  _: 1
534
573
  })
535
574
  ])
536
575
  ]),
537
- default: P(() => [
538
- n("div", at, [
539
- nt,
540
- ot,
541
- E(d, {
542
- modelValue: C.value,
543
- "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),
544
583
  type: "textarea",
545
584
  rows: 4,
546
585
  placeholder: "[非必填]例如:回答不够准确、查询结果有误、界面体验不佳..."
@@ -552,11 +591,11 @@ const D = (u) => (_e("data-v-50a97ff3"), u = u(), he(), u), Fe = { class: "ai-di
552
591
  ], 64);
553
592
  };
554
593
  }
555
- }, lt = /* @__PURE__ */ Se(it, [["__scopeId", "data-v-50a97ff3"]]), Ht = {
556
- install(u) {
557
- u.component("st-varietyAiHelper", lt);
594
+ }, vt = /* @__PURE__ */ Ve(ft, [["__scopeId", "data-v-51517f38"]]), zt = {
595
+ install(c) {
596
+ c.component("st-varietyAiHelper", vt);
558
597
  }
559
598
  };
560
599
  export {
561
- Ht as default
600
+ zt as default
562
601
  };