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.
- package/es/MonacoEditor.cjs +1 -1
- package/es/MonacoEditor.js +1 -1
- package/es/VarietyAiHelper.cjs +5 -5
- package/es/VarietyAiHelper.js +311 -279
- package/es/VarietySearch.cjs +1 -1
- package/es/VarietySearch.js +1 -1
- package/es/{index-5befc414.cjs → index-40f05e2c.cjs} +2 -2
- package/es/{index-8f9d0d17.js → index-8a54ceeb.js} +2 -2
- package/es/{python-27ece6fa.cjs → python-02c3937a.cjs} +1 -1
- package/es/{python-656db04f.js → python-99011a53.js} +1 -1
- package/es/style.css +1 -1
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +82 -82
- package/lib/{index-73a5aa87.js → index-00866046.js} +3363 -3331
- package/lib/{python-8821365d.js → python-a25c0b5b.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/VarietyAiHelper/index.vue +344 -331
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,163 +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
|
|
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"])) :
|
|
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
|
-
(
|
|
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 c = await fetch(`https://dashscope.aliyuncs.com/api/v1/apps/${
|
|
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
112
|
if (!c.ok) {
|
|
113
|
-
|
|
113
|
+
i("error", `HTTP ${c.status}: ${c.statusText}`);
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
|
-
const
|
|
117
|
-
let
|
|
116
|
+
const y = c.body.getReader(), p = new TextDecoder();
|
|
117
|
+
let l = "", s = null;
|
|
118
118
|
for (; ; ) {
|
|
119
|
-
const { done:
|
|
120
|
-
if (
|
|
121
|
-
|
|
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
|
-
|
|
125
|
-
let
|
|
126
|
-
for (; (
|
|
124
|
+
l += p.decode(a, { stream: !0 });
|
|
125
|
+
let m;
|
|
126
|
+
for (; (m = l.indexOf(`
|
|
127
127
|
`)) !== -1; ) {
|
|
128
|
-
const
|
|
129
|
-
if (
|
|
130
|
-
|
|
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 (
|
|
134
|
-
const C =
|
|
135
|
-
if (
|
|
133
|
+
if (k.startsWith("data:")) {
|
|
134
|
+
const C = k.substring(5).trim();
|
|
135
|
+
if (s === "error" || C && C.startsWith("{"))
|
|
136
136
|
try {
|
|
137
|
-
const
|
|
138
|
-
if (
|
|
139
|
-
const
|
|
140
|
-
|
|
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
|
|
144
|
-
|
|
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
|
-
|
|
148
|
+
s = null;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
} catch (c) {
|
|
153
|
-
console.error("流式请求失败:", c),
|
|
153
|
+
console.error("流式请求失败:", c), i("error", c.message);
|
|
154
154
|
}
|
|
155
|
-
},
|
|
156
|
-
var
|
|
157
|
-
const
|
|
155
|
+
}, He = (u, S) => {
|
|
156
|
+
var v;
|
|
157
|
+
const b = u.split(`
|
|
158
158
|
`);
|
|
159
|
-
let
|
|
160
|
-
for (const c of
|
|
159
|
+
let i = null;
|
|
160
|
+
for (const c of b) {
|
|
161
161
|
if (c.startsWith("event:")) {
|
|
162
|
-
|
|
162
|
+
i = c.substring(6).trim();
|
|
163
163
|
continue;
|
|
164
164
|
}
|
|
165
165
|
if (c.startsWith("data:")) {
|
|
166
|
-
const
|
|
167
|
-
if (
|
|
166
|
+
const y = c.substring(5).trim();
|
|
167
|
+
if (y && y !== "[DONE]")
|
|
168
168
|
try {
|
|
169
|
-
const
|
|
170
|
-
if (
|
|
171
|
-
const
|
|
172
|
-
|
|
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
|
|
176
|
-
|
|
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
|
-
|
|
179
|
+
i = null;
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
};
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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
|
-
},
|
|
195
|
+
}, Ge = {
|
|
193
196
|
key: 0,
|
|
194
197
|
class: "message-item assistant"
|
|
195
|
-
},
|
|
196
|
-
/* @__PURE__ */
|
|
197
|
-
/* @__PURE__ */
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
-
/* @__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")
|
|
200
203
|
])
|
|
201
|
-
], -1)),
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
-
], -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 = {
|
|
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(
|
|
216
|
-
const
|
|
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:
|
|
223
|
+
content: p.defaultMessage,
|
|
221
224
|
userContent: null,
|
|
222
225
|
showFeedback: !1,
|
|
223
226
|
// 是否展示反馈按钮(默认信息不用展示)
|
|
224
227
|
hasFeedback: !1,
|
|
225
228
|
// 是否已进行过反馈
|
|
226
|
-
createTime:
|
|
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
|
-
]),
|
|
234
|
-
|
|
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
|
|
237
|
-
userName:
|
|
238
|
-
userContent:
|
|
239
|
-
aiContent:
|
|
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:
|
|
242
|
-
resTime:
|
|
243
|
-
firstPackageTime:
|
|
273
|
+
createTime: t.createTime,
|
|
274
|
+
resTime: t.resTime,
|
|
275
|
+
firstPackageTime: t.firstPackageTime
|
|
244
276
|
};
|
|
245
|
-
await
|
|
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
|
-
|
|
281
|
+
h.value = e, k.value = !0;
|
|
250
282
|
break;
|
|
251
283
|
}
|
|
252
284
|
case "unsatisfied": {
|
|
253
|
-
const
|
|
254
|
-
userName:
|
|
255
|
-
userContent:
|
|
285
|
+
const t = a.value[e], d = {
|
|
286
|
+
userName: v.username,
|
|
287
|
+
userContent: t.userContent,
|
|
256
288
|
userSuggestion: C.value,
|
|
257
|
-
aiContent:
|
|
289
|
+
aiContent: t.content,
|
|
258
290
|
type: 2,
|
|
259
|
-
resTime:
|
|
260
|
-
createTime:
|
|
261
|
-
firstPackageTime:
|
|
291
|
+
resTime: t.resTime,
|
|
292
|
+
createTime: t.createTime,
|
|
293
|
+
firstPackageTime: t.firstPackageTime
|
|
262
294
|
};
|
|
263
|
-
await
|
|
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
|
|
268
|
-
userName:
|
|
269
|
-
userContent:
|
|
299
|
+
const t = a.value[e], d = {
|
|
300
|
+
userName: v.username,
|
|
301
|
+
userContent: t.userContent,
|
|
270
302
|
userSuggestion: C.value,
|
|
271
|
-
aiContent:
|
|
303
|
+
aiContent: t.content,
|
|
272
304
|
type: null,
|
|
273
|
-
resTime:
|
|
274
|
-
createTime:
|
|
275
|
-
firstPackageTime:
|
|
305
|
+
resTime: t.resTime,
|
|
306
|
+
createTime: t.createTime,
|
|
307
|
+
firstPackageTime: t.firstPackageTime
|
|
276
308
|
};
|
|
277
|
-
await
|
|
309
|
+
await i.request.post("/alarm/deliversign/addVarietyAiHelperLog", d);
|
|
278
310
|
}
|
|
279
311
|
}
|
|
280
|
-
},
|
|
281
|
-
const
|
|
282
|
-
if (!
|
|
283
|
-
return
|
|
284
|
-
if (
|
|
312
|
+
}, j = async () => {
|
|
313
|
+
const o = m.value.trim();
|
|
314
|
+
if (!o)
|
|
315
|
+
return O.warning("请输入消息内容");
|
|
316
|
+
if (l.value)
|
|
285
317
|
return;
|
|
286
|
-
|
|
318
|
+
a.value.push({
|
|
287
319
|
role: "user",
|
|
288
|
-
content:
|
|
289
|
-
createTime:
|
|
290
|
-
}),
|
|
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:
|
|
325
|
+
userContent: o,
|
|
294
326
|
showFeedback: !1,
|
|
295
327
|
hasFeedback: !1,
|
|
296
|
-
createTime:
|
|
328
|
+
createTime: $().format("YYYY-MM-DD HH:mm:ss"),
|
|
297
329
|
resTime: 0,
|
|
298
330
|
firstPackageTime: 0
|
|
299
|
-
}), await
|
|
300
|
-
let
|
|
331
|
+
}), await M(), l.value = !0, s.value = !0;
|
|
332
|
+
let e = "", t = (/* @__PURE__ */ new Date()).getTime();
|
|
301
333
|
try {
|
|
302
|
-
await
|
|
334
|
+
await Ye({
|
|
303
335
|
appId: "9e54d112acfe4531bd1fc4fee8827fef",
|
|
304
336
|
apiKey: "sk-d995eb26a4334bdeb2ccb4cbfaf51de8",
|
|
305
|
-
value:
|
|
306
|
-
callback: (
|
|
307
|
-
if (
|
|
308
|
-
|
|
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:
|
|
311
|
-
content: `❌ ${
|
|
342
|
+
userContent: o,
|
|
343
|
+
content: `❌ ${g}`,
|
|
312
344
|
showFeedback: !1,
|
|
313
345
|
hasFeedback: !1,
|
|
314
|
-
createTime:
|
|
315
|
-
resTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
346
|
+
createTime: $().format("YYYY-MM-DD HH:mm:ss"),
|
|
347
|
+
resTime: (/* @__PURE__ */ new Date()).getTime() - t,
|
|
316
348
|
firstPackageTime: 0
|
|
317
|
-
}),
|
|
349
|
+
}), Y("default", a.value.length - 1), M();
|
|
318
350
|
return;
|
|
319
|
-
} else if (
|
|
320
|
-
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
} else if (
|
|
324
|
-
|
|
325
|
-
const
|
|
326
|
-
|
|
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
|
|
329
|
-
|
|
360
|
+
const N = JSON.parse(e);
|
|
361
|
+
delete N.parsedConditions, y("callBack", N);
|
|
330
362
|
} catch {
|
|
331
|
-
|
|
363
|
+
y("callBack", e);
|
|
332
364
|
}
|
|
333
365
|
}
|
|
334
366
|
}
|
|
335
367
|
});
|
|
336
|
-
} catch (
|
|
337
|
-
|
|
368
|
+
} catch (d) {
|
|
369
|
+
O.error(`AI响应异常: ${d}`), a.value.pop(), a.value.push({
|
|
338
370
|
role: "assistant",
|
|
339
|
-
userContent:
|
|
371
|
+
userContent: o,
|
|
340
372
|
content: "❌ 抱歉,AI服务响应异常,请稍后重试。",
|
|
341
373
|
showFeedback: !0,
|
|
342
374
|
hasFeedback: !1,
|
|
343
|
-
createTime:
|
|
344
|
-
resTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
375
|
+
createTime: $().format("YYYY-MM-DD HH:mm:ss"),
|
|
376
|
+
resTime: (/* @__PURE__ */ new Date()).getTime() - t,
|
|
345
377
|
firstPackageTime: 0
|
|
346
|
-
}),
|
|
378
|
+
}), Y("default", a.value.length - 1), await M(), l.value = !1, s.value = !1;
|
|
347
379
|
}
|
|
348
|
-
},
|
|
349
|
-
if (
|
|
350
|
-
if (
|
|
351
|
-
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
` +
|
|
355
|
-
|
|
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
|
-
|
|
359
|
-
},
|
|
360
|
-
await
|
|
390
|
+
o.preventDefault(), j();
|
|
391
|
+
}, M = async () => {
|
|
392
|
+
await I(), w.value && (w.value.scrollTop = w.value.scrollHeight);
|
|
361
393
|
};
|
|
362
|
-
return
|
|
363
|
-
() =>
|
|
394
|
+
return G(
|
|
395
|
+
() => a.value,
|
|
364
396
|
() => {
|
|
365
|
-
|
|
397
|
+
M();
|
|
366
398
|
},
|
|
367
399
|
{ deep: !0 }
|
|
368
|
-
),
|
|
400
|
+
), S({
|
|
369
401
|
open: () => {
|
|
370
|
-
|
|
371
|
-
|
|
402
|
+
c.value = !0, I(() => {
|
|
403
|
+
M();
|
|
372
404
|
});
|
|
373
405
|
}
|
|
374
|
-
}), (
|
|
375
|
-
const
|
|
376
|
-
return
|
|
377
|
-
|
|
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:
|
|
380
|
-
"onUpdate:modelValue":
|
|
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
|
|
422
|
+
var g;
|
|
391
423
|
return [
|
|
392
|
-
|
|
393
|
-
|
|
424
|
+
n("div", Fe, [
|
|
425
|
+
n("div", {
|
|
394
426
|
ref_key: "messageListRef",
|
|
395
|
-
ref:
|
|
427
|
+
ref: w,
|
|
396
428
|
class: "message-list"
|
|
397
429
|
}, [
|
|
398
|
-
(
|
|
399
|
-
key:
|
|
400
|
-
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"])
|
|
401
433
|
}, [
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
]
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
])
|
|
432
|
-
]
|
|
433
|
-
],
|
|
434
|
-
]))), 128)),
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
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:
|
|
471
|
+
icon: V(W)
|
|
440
472
|
}, null, 8, ["icon"])
|
|
441
473
|
]),
|
|
442
|
-
|
|
474
|
+
Ze
|
|
443
475
|
])) : x("", !0)
|
|
444
476
|
], 512),
|
|
445
|
-
|
|
446
|
-
|
|
477
|
+
n("div", et, [
|
|
478
|
+
E(d, {
|
|
447
479
|
class: "message-input",
|
|
448
|
-
modelValue:
|
|
449
|
-
"onUpdate:modelValue":
|
|
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:
|
|
486
|
+
onKeydown: ee
|
|
455
487
|
}, null, 8, ["modelValue"]),
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
488
|
+
n("div", tt, [
|
|
489
|
+
st,
|
|
490
|
+
E(z, {
|
|
459
491
|
class: "send-btn",
|
|
460
492
|
type: "primary",
|
|
461
|
-
icon:
|
|
462
|
-
loading:
|
|
463
|
-
onClick:
|
|
493
|
+
icon: V(Te),
|
|
494
|
+
loading: l.value,
|
|
495
|
+
onClick: j,
|
|
464
496
|
round: ""
|
|
465
497
|
}, {
|
|
466
498
|
default: P(() => [
|
|
467
|
-
|
|
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
|
-
|
|
479
|
-
modelValue:
|
|
480
|
-
"onUpdate:modelValue":
|
|
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
|
-
|
|
486
|
-
|
|
487
|
-
onClick:
|
|
517
|
+
n("span", rt, [
|
|
518
|
+
E(z, {
|
|
519
|
+
onClick: e[3] || (e[3] = (g) => k.value = !1)
|
|
488
520
|
}, {
|
|
489
521
|
default: P(() => [
|
|
490
|
-
|
|
522
|
+
J("取消")
|
|
491
523
|
]),
|
|
492
524
|
_: 1
|
|
493
525
|
}),
|
|
494
|
-
|
|
526
|
+
E(z, {
|
|
495
527
|
type: "primary",
|
|
496
|
-
onClick:
|
|
528
|
+
onClick: e[4] || (e[4] = (g) => Y("unsatisfied", h.value))
|
|
497
529
|
}, {
|
|
498
530
|
default: P(() => [
|
|
499
|
-
|
|
531
|
+
J("提交反馈")
|
|
500
532
|
]),
|
|
501
533
|
_: 1
|
|
502
534
|
})
|
|
503
535
|
])
|
|
504
536
|
]),
|
|
505
537
|
default: P(() => [
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
538
|
+
n("div", at, [
|
|
539
|
+
nt,
|
|
540
|
+
ot,
|
|
541
|
+
E(d, {
|
|
510
542
|
modelValue: C.value,
|
|
511
|
-
"onUpdate:modelValue":
|
|
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
|
-
},
|
|
524
|
-
install(
|
|
525
|
-
|
|
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
|
-
|
|
561
|
+
Ht as default
|
|
530
562
|
};
|