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