st-comp 0.0.254 → 0.0.255

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