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