st-comp 0.0.257 → 0.0.259
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 +305 -278
- package/es/style.css +1 -1
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +101 -101
- package/lib/{index-845576f9.js → index-57609953.js} +6087 -6060
- package/lib/{python-9f6f8113.js → python-6f1ca3f1.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/VarietyAiHelper/index.vue +50 -35
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-94f32fe5"), 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,58 +215,58 @@ const D = (u) => (_e("data-v-485f55b8"), 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,
|
|
@@ -278,18 +278,18 @@ const D = (u) => (_e("data-v-485f55b8"), u = u(), he(), u), Fe = { class: "ai-di
|
|
|
278
278
|
logOrigin: 1
|
|
279
279
|
// 日志来源
|
|
280
280
|
};
|
|
281
|
-
await
|
|
281
|
+
await r.request.post("/alarm/deliversign/addVarietyAiHelperLog", i), L.success("感谢您的评价!"), s.value[e].hasFeedback = !0;
|
|
282
282
|
break;
|
|
283
283
|
}
|
|
284
284
|
case "open": {
|
|
285
|
-
|
|
285
|
+
x.value = e, b.value = !0;
|
|
286
286
|
break;
|
|
287
287
|
}
|
|
288
288
|
case "unsatisfied": {
|
|
289
|
-
const t =
|
|
290
|
-
userName:
|
|
289
|
+
const t = s.value[e], i = {
|
|
290
|
+
userName: g.username,
|
|
291
291
|
userContent: t.userContent,
|
|
292
|
-
userSuggestion:
|
|
292
|
+
userSuggestion: p.value,
|
|
293
293
|
aiContent: t.content,
|
|
294
294
|
type: 2,
|
|
295
295
|
resTime: t.resTime,
|
|
@@ -300,14 +300,14 @@ const D = (u) => (_e("data-v-485f55b8"), u = u(), he(), u), Fe = { class: "ai-di
|
|
|
300
300
|
logOrigin: 1
|
|
301
301
|
// 日志来源
|
|
302
302
|
};
|
|
303
|
-
await
|
|
303
|
+
await r.request.post("/alarm/deliversign/addVarietyAiHelperLog", i), L.success("感谢您的反馈!我们将持续跟踪并进行优化"), b.value = !1, s.value[e].hasFeedback = !0;
|
|
304
304
|
break;
|
|
305
305
|
}
|
|
306
306
|
case "default": {
|
|
307
|
-
const t =
|
|
308
|
-
userName:
|
|
307
|
+
const t = s.value[e], i = {
|
|
308
|
+
userName: g.username,
|
|
309
309
|
userContent: t.userContent,
|
|
310
|
-
userSuggestion:
|
|
310
|
+
userSuggestion: p.value,
|
|
311
311
|
aiContent: t.content,
|
|
312
312
|
type: null,
|
|
313
313
|
resTime: t.resTime,
|
|
@@ -318,110 +318,137 @@ const D = (u) => (_e("data-v-485f55b8"), u = u(), he(), u), Fe = { class: "ai-di
|
|
|
318
318
|
logOrigin: 1
|
|
319
319
|
// 日志来源
|
|
320
320
|
};
|
|
321
|
-
await
|
|
321
|
+
await r.request.post("/alarm/deliversign/addVarietyAiHelperLog", i);
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
|
-
},
|
|
325
|
-
const
|
|
326
|
-
if (!
|
|
327
|
-
return
|
|
328
|
-
if (
|
|
324
|
+
}, q = async () => {
|
|
325
|
+
const n = _.value.trim();
|
|
326
|
+
if (!n)
|
|
327
|
+
return L.warning("请输入消息内容");
|
|
328
|
+
if (a.value)
|
|
329
329
|
return;
|
|
330
|
-
|
|
330
|
+
s.value.push({
|
|
331
331
|
role: "user",
|
|
332
|
-
content:
|
|
333
|
-
createTime:
|
|
334
|
-
}),
|
|
332
|
+
content: n,
|
|
333
|
+
createTime: B().format("YYYY-MM-DD HH:mm:ss")
|
|
334
|
+
}), _.value = "", await Y(), s.value.push({
|
|
335
335
|
role: "assistant",
|
|
336
336
|
content: "",
|
|
337
|
-
userContent:
|
|
337
|
+
userContent: n,
|
|
338
338
|
showFeedback: !1,
|
|
339
339
|
hasFeedback: !1,
|
|
340
|
-
createTime:
|
|
340
|
+
createTime: B().format("YYYY-MM-DD HH:mm:ss"),
|
|
341
341
|
resTime: 0,
|
|
342
342
|
firstPackageTime: 0
|
|
343
|
-
}), await
|
|
343
|
+
}), await Y(), a.value = !0, w.value = !0;
|
|
344
344
|
let e = "", t = (/* @__PURE__ */ new Date()).getTime();
|
|
345
345
|
try {
|
|
346
|
-
await
|
|
346
|
+
await Be({
|
|
347
347
|
appId: "9e54d112acfe4531bd1fc4fee8827fef",
|
|
348
348
|
apiKey: "sk-d995eb26a4334bdeb2ccb4cbfaf51de8",
|
|
349
|
-
value:
|
|
350
|
-
callback: (
|
|
351
|
-
|
|
352
|
-
|
|
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({
|
|
353
354
|
role: "assistant",
|
|
354
|
-
userContent:
|
|
355
|
-
content: `❌ ${
|
|
355
|
+
userContent: n,
|
|
356
|
+
content: `❌ ${h}`,
|
|
356
357
|
showFeedback: !1,
|
|
357
358
|
hasFeedback: !1,
|
|
358
|
-
createTime:
|
|
359
|
+
createTime: B().format("YYYY-MM-DD HH:mm:ss"),
|
|
359
360
|
resTime: (/* @__PURE__ */ new Date()).getTime() - t,
|
|
360
361
|
firstPackageTime: 0
|
|
361
|
-
}),
|
|
362
|
+
}), F("default", s.value.length - 1), Y();
|
|
362
363
|
return;
|
|
363
|
-
} else if (
|
|
364
|
-
e +=
|
|
365
|
-
const
|
|
366
|
-
|
|
367
|
-
} else if (
|
|
368
|
-
|
|
369
|
-
const
|
|
370
|
-
|
|
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);
|
|
371
372
|
try {
|
|
372
|
-
const
|
|
373
|
-
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);
|
|
374
382
|
} catch {
|
|
375
|
-
|
|
383
|
+
S("callBack", e);
|
|
376
384
|
}
|
|
377
385
|
}
|
|
378
386
|
}
|
|
379
387
|
});
|
|
380
|
-
} catch (
|
|
381
|
-
|
|
388
|
+
} catch (i) {
|
|
389
|
+
L.error(`AI响应异常: ${i}`), s.value.pop(), s.value.push({
|
|
382
390
|
role: "assistant",
|
|
383
|
-
userContent:
|
|
391
|
+
userContent: n,
|
|
384
392
|
content: "❌ 抱歉,AI服务响应异常,请稍后重试。",
|
|
385
393
|
showFeedback: !0,
|
|
386
394
|
hasFeedback: !1,
|
|
387
|
-
createTime:
|
|
395
|
+
createTime: B().format("YYYY-MM-DD HH:mm:ss"),
|
|
388
396
|
resTime: (/* @__PURE__ */ new Date()).getTime() - t,
|
|
389
397
|
firstPackageTime: 0
|
|
390
|
-
}),
|
|
398
|
+
}), F("default", s.value.length - 1), await Y(), a.value = !1, w.value = !1;
|
|
391
399
|
}
|
|
392
|
-
},
|
|
393
|
-
if (
|
|
394
|
-
if (
|
|
395
|
-
|
|
396
|
-
const e =
|
|
397
|
-
|
|
398
|
-
` +
|
|
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(() => {
|
|
399
407
|
e.selectionStart = e.selectionEnd = t + 1;
|
|
400
408
|
});
|
|
401
409
|
} else
|
|
402
|
-
|
|
403
|
-
},
|
|
404
|
-
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
|
+
}, {});
|
|
405
425
|
};
|
|
406
|
-
return
|
|
407
|
-
()
|
|
426
|
+
return ke(() => {
|
|
427
|
+
oe();
|
|
428
|
+
}), R(
|
|
429
|
+
() => s.value,
|
|
408
430
|
() => {
|
|
409
|
-
|
|
431
|
+
Y();
|
|
410
432
|
},
|
|
411
433
|
{ deep: !0 }
|
|
412
|
-
),
|
|
434
|
+
), R(
|
|
435
|
+
() => b.value,
|
|
436
|
+
(n) => {
|
|
437
|
+
n || (p.value = "");
|
|
438
|
+
}
|
|
439
|
+
), E({
|
|
413
440
|
open: () => {
|
|
414
|
-
|
|
415
|
-
|
|
441
|
+
l.value = !0, J(() => {
|
|
442
|
+
Y();
|
|
416
443
|
});
|
|
417
444
|
}
|
|
418
|
-
}), (
|
|
419
|
-
const t =
|
|
420
|
-
return
|
|
421
|
-
|
|
445
|
+
}), (n, e) => {
|
|
446
|
+
const t = $e, i = he, A = ge, D = ve;
|
|
447
|
+
return v(), y(O, null, [
|
|
448
|
+
M(D, {
|
|
422
449
|
class: "ai-dialog",
|
|
423
|
-
modelValue:
|
|
424
|
-
"onUpdate:modelValue": e[1] || (e[1] = (
|
|
450
|
+
modelValue: l.value,
|
|
451
|
+
"onUpdate:modelValue": e[1] || (e[1] = (h) => l.value = h),
|
|
425
452
|
title: "✨ 品种池参数解析AI助手",
|
|
426
453
|
width: "500px",
|
|
427
454
|
center: "",
|
|
@@ -430,85 +457,85 @@ const D = (u) => (_e("data-v-485f55b8"), u = u(), he(), u), Fe = { class: "ai-di
|
|
|
430
457
|
modal: !1,
|
|
431
458
|
"modal-penetrable": !0
|
|
432
459
|
}, {
|
|
433
|
-
default:
|
|
434
|
-
var
|
|
460
|
+
default: H(() => {
|
|
461
|
+
var h;
|
|
435
462
|
return [
|
|
436
|
-
|
|
437
|
-
|
|
463
|
+
o("div", Le, [
|
|
464
|
+
o("div", {
|
|
438
465
|
ref_key: "messageListRef",
|
|
439
|
-
ref:
|
|
466
|
+
ref: N,
|
|
440
467
|
class: "message-list"
|
|
441
468
|
}, [
|
|
442
|
-
(
|
|
443
|
-
key:
|
|
444
|
-
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"])
|
|
445
472
|
}, [
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
473
|
+
u.content ? (v(), y(O, { key: 0 }, [
|
|
474
|
+
o("div", Ie, [
|
|
475
|
+
M(t, {
|
|
449
476
|
size: 32,
|
|
450
|
-
icon:
|
|
477
|
+
icon: u.role === "user" ? P(De) : P(Q)
|
|
451
478
|
}, null, 8, ["icon"])
|
|
452
479
|
]),
|
|
453
|
-
|
|
454
|
-
|
|
480
|
+
o("div", Je, [
|
|
481
|
+
z(u.content) ? (v(), y("div", {
|
|
455
482
|
key: 0,
|
|
456
483
|
class: "message-json",
|
|
457
|
-
innerHTML:
|
|
458
|
-
}, null, 8,
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
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", {
|
|
465
492
|
class: "feedback-btn satisfied-btn",
|
|
466
|
-
onClick: (
|
|
467
|
-
},
|
|
468
|
-
|
|
493
|
+
onClick: (C) => F("satisfied", f)
|
|
494
|
+
}, Qe, 8, We),
|
|
495
|
+
o("button", {
|
|
469
496
|
class: "feedback-btn unsatisfied-btn",
|
|
470
|
-
onClick: (
|
|
471
|
-
},
|
|
497
|
+
onClick: (C) => F("open", f)
|
|
498
|
+
}, st, 8, Ze)
|
|
472
499
|
])
|
|
473
|
-
], 64)) :
|
|
474
|
-
|
|
475
|
-
], 64)) :
|
|
500
|
+
], 64)) : $("", !0),
|
|
501
|
+
u.showFeedback && u.hasFeedback ? (v(), y("div", at, "感谢您进行的评价反馈")) : $("", !0)
|
|
502
|
+
], 64)) : $("", !0)
|
|
476
503
|
])
|
|
477
|
-
], 64)) :
|
|
504
|
+
], 64)) : $("", !0)
|
|
478
505
|
], 2))), 128)),
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
506
|
+
w.value && !((h = s.value[s.value.length - 1]) != null && h.content) ? (v(), y("div", nt, [
|
|
507
|
+
o("div", ot, [
|
|
508
|
+
M(t, {
|
|
482
509
|
size: 32,
|
|
483
|
-
icon:
|
|
510
|
+
icon: P(Q)
|
|
484
511
|
}, null, 8, ["icon"])
|
|
485
512
|
]),
|
|
486
|
-
|
|
487
|
-
])) :
|
|
513
|
+
rt
|
|
514
|
+
])) : $("", !0)
|
|
488
515
|
], 512),
|
|
489
|
-
|
|
490
|
-
|
|
516
|
+
o("div", it, [
|
|
517
|
+
M(i, {
|
|
491
518
|
class: "message-input",
|
|
492
|
-
modelValue:
|
|
493
|
-
"onUpdate:modelValue": e[0] || (e[0] = (
|
|
519
|
+
modelValue: _.value,
|
|
520
|
+
"onUpdate:modelValue": e[0] || (e[0] = (u) => _.value = u),
|
|
494
521
|
type: "textarea",
|
|
495
522
|
rows: 4,
|
|
496
523
|
autosize: { minRows: 2, maxRows: 4 },
|
|
497
|
-
placeholder: "输入您想查询的品种条件...
|
|
498
|
-
onKeydown:
|
|
524
|
+
placeholder: "输入您想查询的品种条件...",
|
|
525
|
+
onKeydown: ne
|
|
499
526
|
}, null, 8, ["modelValue"]),
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
527
|
+
o("div", lt, [
|
|
528
|
+
ct,
|
|
529
|
+
M(A, {
|
|
503
530
|
class: "send-btn",
|
|
504
531
|
type: "primary",
|
|
505
|
-
icon:
|
|
506
|
-
loading:
|
|
507
|
-
onClick:
|
|
532
|
+
icon: P(Me),
|
|
533
|
+
loading: a.value,
|
|
534
|
+
onClick: q,
|
|
508
535
|
round: ""
|
|
509
536
|
}, {
|
|
510
|
-
default:
|
|
511
|
-
|
|
537
|
+
default: H(() => [
|
|
538
|
+
j(" 发送 ")
|
|
512
539
|
]),
|
|
513
540
|
_: 1
|
|
514
541
|
}, 8, ["icon", "loading"])
|
|
@@ -519,40 +546,40 @@ const D = (u) => (_e("data-v-485f55b8"), u = u(), he(), u), Fe = { class: "ai-di
|
|
|
519
546
|
}),
|
|
520
547
|
_: 1
|
|
521
548
|
}, 8, ["modelValue"]),
|
|
522
|
-
|
|
523
|
-
modelValue:
|
|
524
|
-
"onUpdate:modelValue": e[5] || (e[5] = (
|
|
549
|
+
M(D, {
|
|
550
|
+
modelValue: b.value,
|
|
551
|
+
"onUpdate:modelValue": e[5] || (e[5] = (h) => b.value = h),
|
|
525
552
|
title: "📝 反馈意见",
|
|
526
553
|
width: "400px"
|
|
527
554
|
}, {
|
|
528
|
-
footer:
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
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)
|
|
532
559
|
}, {
|
|
533
|
-
default:
|
|
534
|
-
|
|
560
|
+
default: H(() => [
|
|
561
|
+
j("取消")
|
|
535
562
|
]),
|
|
536
563
|
_: 1
|
|
537
564
|
}),
|
|
538
|
-
|
|
565
|
+
M(A, {
|
|
539
566
|
type: "primary",
|
|
540
|
-
onClick: e[4] || (e[4] = (
|
|
567
|
+
onClick: e[4] || (e[4] = (h) => F("unsatisfied", x.value))
|
|
541
568
|
}, {
|
|
542
|
-
default:
|
|
543
|
-
|
|
569
|
+
default: H(() => [
|
|
570
|
+
j("提交反馈")
|
|
544
571
|
]),
|
|
545
572
|
_: 1
|
|
546
573
|
})
|
|
547
574
|
])
|
|
548
575
|
]),
|
|
549
|
-
default:
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
modelValue:
|
|
555
|
-
"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),
|
|
556
583
|
type: "textarea",
|
|
557
584
|
rows: 4,
|
|
558
585
|
placeholder: "[非必填]例如:回答不够准确、查询结果有误、界面体验不佳..."
|
|
@@ -564,11 +591,11 @@ const D = (u) => (_e("data-v-485f55b8"), u = u(), he(), u), Fe = { class: "ai-di
|
|
|
564
591
|
], 64);
|
|
565
592
|
};
|
|
566
593
|
}
|
|
567
|
-
},
|
|
568
|
-
install(
|
|
569
|
-
|
|
594
|
+
}, vt = /* @__PURE__ */ Ve(ft, [["__scopeId", "data-v-94f32fe5"]]), zt = {
|
|
595
|
+
install(c) {
|
|
596
|
+
c.component("st-varietyAiHelper", vt);
|
|
570
597
|
}
|
|
571
598
|
};
|
|
572
599
|
export {
|
|
573
|
-
|
|
600
|
+
zt as default
|
|
574
601
|
};
|