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