st-comp 0.0.255 → 0.0.257

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