st-comp 0.0.255 → 0.0.256

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