st-comp 0.0.255 → 0.0.257
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 +323 -279
- package/es/VarietySearch.cjs +2 -2
- package/es/VarietySearch.js +6 -6
- 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 +123 -123
- package/lib/{index-73a5aa87.js → index-845576f9.js} +3378 -3334
- package/lib/{python-8821365d.js → python-9f6f8113.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/VarietyAiHelper/index.vue +354 -331
- 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 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 M, 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 O } 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 z } 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(M(c)),
|
|
76
|
+
style: R(M(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(M(p)),
|
|
84
|
+
onError: l
|
|
85
|
+
}, null, 44, ["src", "alt", "srcset"])) : s.icon ? (f(), K(M(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-485f55b8"), u = u(), he(), u), Fe = { class: "ai-dialog-body" }, Ae = { class: "avatar" }, xe = { class: "message-content" }, Oe = ["innerHTML"], $e = {
|
|
184
|
+
key: 1,
|
|
185
|
+
class: "message-text"
|
|
186
|
+
}, ze = { 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,213 @@ 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: O().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,
|
|
276
|
+
isSolved: 1,
|
|
277
|
+
// 是否解决
|
|
278
|
+
logOrigin: 1
|
|
279
|
+
// 日志来源
|
|
244
280
|
};
|
|
245
|
-
await
|
|
281
|
+
await i.request.post("/alarm/deliversign/addVarietyAiHelperLog", d), z.success("感谢您的评价!"), a.value[e].hasFeedback = !0;
|
|
246
282
|
break;
|
|
247
283
|
}
|
|
248
284
|
case "open": {
|
|
249
|
-
|
|
285
|
+
h.value = e, k.value = !0;
|
|
250
286
|
break;
|
|
251
287
|
}
|
|
252
288
|
case "unsatisfied": {
|
|
253
|
-
const
|
|
254
|
-
userName:
|
|
255
|
-
userContent:
|
|
289
|
+
const t = a.value[e], d = {
|
|
290
|
+
userName: v.username,
|
|
291
|
+
userContent: t.userContent,
|
|
256
292
|
userSuggestion: C.value,
|
|
257
|
-
aiContent:
|
|
293
|
+
aiContent: t.content,
|
|
258
294
|
type: 2,
|
|
259
|
-
resTime:
|
|
260
|
-
createTime:
|
|
261
|
-
firstPackageTime:
|
|
295
|
+
resTime: t.resTime,
|
|
296
|
+
createTime: t.createTime,
|
|
297
|
+
firstPackageTime: t.firstPackageTime,
|
|
298
|
+
isSolved: 0,
|
|
299
|
+
// 是否解决
|
|
300
|
+
logOrigin: 1
|
|
301
|
+
// 日志来源
|
|
262
302
|
};
|
|
263
|
-
await
|
|
303
|
+
await i.request.post("/alarm/deliversign/addVarietyAiHelperLog", d), z.success("感谢您的反馈!我们将持续跟踪并进行优化"), k.value = !1, a.value[e].hasFeedback = !0;
|
|
264
304
|
break;
|
|
265
305
|
}
|
|
266
306
|
case "default": {
|
|
267
|
-
const
|
|
268
|
-
userName:
|
|
269
|
-
userContent:
|
|
307
|
+
const t = a.value[e], d = {
|
|
308
|
+
userName: v.username,
|
|
309
|
+
userContent: t.userContent,
|
|
270
310
|
userSuggestion: C.value,
|
|
271
|
-
aiContent:
|
|
311
|
+
aiContent: t.content,
|
|
272
312
|
type: null,
|
|
273
|
-
resTime:
|
|
274
|
-
createTime:
|
|
275
|
-
firstPackageTime:
|
|
313
|
+
resTime: t.resTime,
|
|
314
|
+
createTime: t.createTime,
|
|
315
|
+
firstPackageTime: t.firstPackageTime,
|
|
316
|
+
isSolved: 1,
|
|
317
|
+
// 是否解决
|
|
318
|
+
logOrigin: 1
|
|
319
|
+
// 日志来源
|
|
276
320
|
};
|
|
277
|
-
await
|
|
321
|
+
await i.request.post("/alarm/deliversign/addVarietyAiHelperLog", d);
|
|
278
322
|
}
|
|
279
323
|
}
|
|
280
|
-
},
|
|
281
|
-
const
|
|
282
|
-
if (!
|
|
283
|
-
return
|
|
284
|
-
if (
|
|
324
|
+
}, j = async () => {
|
|
325
|
+
const o = m.value.trim();
|
|
326
|
+
if (!o)
|
|
327
|
+
return z.warning("请输入消息内容");
|
|
328
|
+
if (l.value)
|
|
285
329
|
return;
|
|
286
|
-
|
|
330
|
+
a.value.push({
|
|
287
331
|
role: "user",
|
|
288
|
-
content:
|
|
289
|
-
createTime:
|
|
290
|
-
}),
|
|
332
|
+
content: o,
|
|
333
|
+
createTime: O().format("YYYY-MM-DD HH:mm:ss")
|
|
334
|
+
}), m.value = "", await N(), a.value.push({
|
|
291
335
|
role: "assistant",
|
|
292
336
|
content: "",
|
|
293
|
-
userContent:
|
|
337
|
+
userContent: o,
|
|
294
338
|
showFeedback: !1,
|
|
295
339
|
hasFeedback: !1,
|
|
296
|
-
createTime:
|
|
340
|
+
createTime: O().format("YYYY-MM-DD HH:mm:ss"),
|
|
297
341
|
resTime: 0,
|
|
298
342
|
firstPackageTime: 0
|
|
299
|
-
}), await
|
|
300
|
-
let
|
|
343
|
+
}), await N(), l.value = !0, s.value = !0;
|
|
344
|
+
let e = "", t = (/* @__PURE__ */ new Date()).getTime();
|
|
301
345
|
try {
|
|
302
|
-
await
|
|
346
|
+
await Ye({
|
|
303
347
|
appId: "9e54d112acfe4531bd1fc4fee8827fef",
|
|
304
348
|
apiKey: "sk-d995eb26a4334bdeb2ccb4cbfaf51de8",
|
|
305
|
-
value:
|
|
306
|
-
callback: (
|
|
307
|
-
if (
|
|
308
|
-
|
|
349
|
+
value: o,
|
|
350
|
+
callback: (H, g) => {
|
|
351
|
+
if (H === "error") {
|
|
352
|
+
s.value = !1, l.value = !1, a.value.pop(), a.value.push({
|
|
309
353
|
role: "assistant",
|
|
310
|
-
userContent:
|
|
311
|
-
content: `❌ ${
|
|
354
|
+
userContent: o,
|
|
355
|
+
content: `❌ ${g}`,
|
|
312
356
|
showFeedback: !1,
|
|
313
357
|
hasFeedback: !1,
|
|
314
|
-
createTime:
|
|
315
|
-
resTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
358
|
+
createTime: O().format("YYYY-MM-DD HH:mm:ss"),
|
|
359
|
+
resTime: (/* @__PURE__ */ new Date()).getTime() - t,
|
|
316
360
|
firstPackageTime: 0
|
|
317
|
-
}),
|
|
361
|
+
}), Y("default", a.value.length - 1), N();
|
|
318
362
|
return;
|
|
319
|
-
} else if (
|
|
320
|
-
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
} else if (
|
|
324
|
-
|
|
325
|
-
const
|
|
326
|
-
|
|
363
|
+
} else if (H === "message") {
|
|
364
|
+
e += g;
|
|
365
|
+
const r = a.value[a.value.length - 1];
|
|
366
|
+
r && r.role === "assistant" && (r.content = e, N()), r.firstPackageTime === 0 && (r.firstPackageTime = (/* @__PURE__ */ new Date()).getTime() - t);
|
|
367
|
+
} else if (H === "finish") {
|
|
368
|
+
s.value = !1, l.value = !1;
|
|
369
|
+
const r = a.value[a.value.length - 1];
|
|
370
|
+
r && r.role === "assistant" && (r.showFeedback = !0, r.resTime = (/* @__PURE__ */ new Date()).getTime() - t, Y("default", a.value.length - 1));
|
|
327
371
|
try {
|
|
328
|
-
const
|
|
329
|
-
|
|
372
|
+
const V = JSON.parse(e);
|
|
373
|
+
delete V.parsedConditions, console.log(V), y("callBack", V);
|
|
330
374
|
} catch {
|
|
331
|
-
|
|
375
|
+
y("callBack", e);
|
|
332
376
|
}
|
|
333
377
|
}
|
|
334
378
|
}
|
|
335
379
|
});
|
|
336
|
-
} catch (
|
|
337
|
-
|
|
380
|
+
} catch (d) {
|
|
381
|
+
z.error(`AI响应异常: ${d}`), a.value.pop(), a.value.push({
|
|
338
382
|
role: "assistant",
|
|
339
|
-
userContent:
|
|
383
|
+
userContent: o,
|
|
340
384
|
content: "❌ 抱歉,AI服务响应异常,请稍后重试。",
|
|
341
385
|
showFeedback: !0,
|
|
342
386
|
hasFeedback: !1,
|
|
343
|
-
createTime:
|
|
344
|
-
resTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
387
|
+
createTime: O().format("YYYY-MM-DD HH:mm:ss"),
|
|
388
|
+
resTime: (/* @__PURE__ */ new Date()).getTime() - t,
|
|
345
389
|
firstPackageTime: 0
|
|
346
|
-
}),
|
|
390
|
+
}), Y("default", a.value.length - 1), await N(), l.value = !1, s.value = !1;
|
|
347
391
|
}
|
|
348
|
-
},
|
|
349
|
-
if (
|
|
350
|
-
if (
|
|
351
|
-
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
` +
|
|
355
|
-
|
|
392
|
+
}, ee = (o) => {
|
|
393
|
+
if (o.key === "Enter")
|
|
394
|
+
if (o.ctrlKey) {
|
|
395
|
+
o.preventDefault();
|
|
396
|
+
const e = o.target, t = e.selectionStart, d = e.selectionEnd;
|
|
397
|
+
m.value = m.value.substring(0, t) + `
|
|
398
|
+
` + m.value.substring(d), I(() => {
|
|
399
|
+
e.selectionStart = e.selectionEnd = t + 1;
|
|
356
400
|
});
|
|
357
401
|
} else
|
|
358
|
-
|
|
359
|
-
},
|
|
360
|
-
await
|
|
402
|
+
o.preventDefault(), j();
|
|
403
|
+
}, N = async () => {
|
|
404
|
+
await I(), w.value && (w.value.scrollTop = w.value.scrollHeight);
|
|
361
405
|
};
|
|
362
|
-
return
|
|
363
|
-
() =>
|
|
406
|
+
return G(
|
|
407
|
+
() => a.value,
|
|
364
408
|
() => {
|
|
365
|
-
|
|
409
|
+
N();
|
|
366
410
|
},
|
|
367
411
|
{ deep: !0 }
|
|
368
|
-
),
|
|
412
|
+
), S({
|
|
369
413
|
open: () => {
|
|
370
|
-
|
|
371
|
-
|
|
414
|
+
c.value = !0, I(() => {
|
|
415
|
+
N();
|
|
372
416
|
});
|
|
373
417
|
}
|
|
374
|
-
}), (
|
|
375
|
-
const
|
|
376
|
-
return
|
|
377
|
-
|
|
418
|
+
}), (o, e) => {
|
|
419
|
+
const t = Pe, d = de, $ = ue, H = ce;
|
|
420
|
+
return f(), _(A, null, [
|
|
421
|
+
E(H, {
|
|
378
422
|
class: "ai-dialog",
|
|
379
|
-
modelValue:
|
|
380
|
-
"onUpdate:modelValue":
|
|
423
|
+
modelValue: c.value,
|
|
424
|
+
"onUpdate:modelValue": e[1] || (e[1] = (g) => c.value = g),
|
|
381
425
|
title: "✨ 品种池参数解析AI助手",
|
|
382
426
|
width: "500px",
|
|
383
427
|
center: "",
|
|
@@ -387,84 +431,84 @@ const V = (l) => (fe("data-v-b571a3f5"), l = l(), ve(), l), Pe = { class: "chat-
|
|
|
387
431
|
"modal-penetrable": !0
|
|
388
432
|
}, {
|
|
389
433
|
default: P(() => {
|
|
390
|
-
var
|
|
434
|
+
var g;
|
|
391
435
|
return [
|
|
392
|
-
|
|
393
|
-
|
|
436
|
+
n("div", Fe, [
|
|
437
|
+
n("div", {
|
|
394
438
|
ref_key: "messageListRef",
|
|
395
|
-
ref:
|
|
439
|
+
ref: w,
|
|
396
440
|
class: "message-list"
|
|
397
441
|
}, [
|
|
398
|
-
(
|
|
399
|
-
key:
|
|
400
|
-
class: "message-item
|
|
442
|
+
(f(!0), _(A, null, ge(a.value, (r, V) => (f(), _("div", {
|
|
443
|
+
key: V,
|
|
444
|
+
class: Q([r.role, "message-item"])
|
|
401
445
|
}, [
|
|
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
|
-
|
|
446
|
+
r.content ? (f(), _(A, { key: 0 }, [
|
|
447
|
+
n("div", Ae, [
|
|
448
|
+
E(t, {
|
|
449
|
+
size: 32,
|
|
450
|
+
icon: r.role === "user" ? M(ke) : M(W)
|
|
451
|
+
}, null, 8, ["icon"])
|
|
452
|
+
]),
|
|
453
|
+
n("div", xe, [
|
|
454
|
+
F(r.content) ? (f(), _("div", {
|
|
455
|
+
key: 0,
|
|
456
|
+
class: "message-json",
|
|
457
|
+
innerHTML: Z(B(r.content))
|
|
458
|
+
}, null, 8, Oe)) : (f(), _("div", $e, U(r.content), 1)),
|
|
459
|
+
n("div", ze, U(r.createTime), 1),
|
|
460
|
+
r.role === "assistant" ? (f(), _(A, { key: 2 }, [
|
|
461
|
+
r.showFeedback && !r.hasFeedback ? (f(), _(A, { key: 0 }, [
|
|
462
|
+
Be,
|
|
463
|
+
n("div", Le, [
|
|
464
|
+
n("button", {
|
|
465
|
+
class: "feedback-btn satisfied-btn",
|
|
466
|
+
onClick: (te) => Y("satisfied", V)
|
|
467
|
+
}, Re, 8, Ie),
|
|
468
|
+
n("button", {
|
|
469
|
+
class: "feedback-btn unsatisfied-btn",
|
|
470
|
+
onClick: (te) => Y("open", V)
|
|
471
|
+
}, qe, 8, Ke)
|
|
472
|
+
])
|
|
473
|
+
], 64)) : x("", !0),
|
|
474
|
+
r.showFeedback && r.hasFeedback ? (f(), _("div", Xe, "感谢您进行的评价反馈")) : x("", !0)
|
|
475
|
+
], 64)) : x("", !0)
|
|
476
|
+
])
|
|
477
|
+
], 64)) : x("", !0)
|
|
478
|
+
], 2))), 128)),
|
|
479
|
+
s.value && !((g = a.value[a.value.length - 1]) != null && g.content) ? (f(), _("div", Ge, [
|
|
480
|
+
n("div", Qe, [
|
|
481
|
+
E(t, {
|
|
438
482
|
size: 32,
|
|
439
|
-
icon: M(
|
|
483
|
+
icon: M(W)
|
|
440
484
|
}, null, 8, ["icon"])
|
|
441
485
|
]),
|
|
442
|
-
|
|
486
|
+
Ze
|
|
443
487
|
])) : x("", !0)
|
|
444
488
|
], 512),
|
|
445
|
-
|
|
446
|
-
|
|
489
|
+
n("div", et, [
|
|
490
|
+
E(d, {
|
|
447
491
|
class: "message-input",
|
|
448
|
-
modelValue:
|
|
449
|
-
"onUpdate:modelValue":
|
|
492
|
+
modelValue: m.value,
|
|
493
|
+
"onUpdate:modelValue": e[0] || (e[0] = (r) => m.value = r),
|
|
450
494
|
type: "textarea",
|
|
451
495
|
rows: 4,
|
|
452
496
|
autosize: { minRows: 2, maxRows: 4 },
|
|
453
497
|
placeholder: "输入您想查询的品种条件... (Ctrl+Enter换行,Enter发送)",
|
|
454
|
-
onKeydown:
|
|
498
|
+
onKeydown: ee
|
|
455
499
|
}, null, 8, ["modelValue"]),
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
500
|
+
n("div", tt, [
|
|
501
|
+
st,
|
|
502
|
+
E($, {
|
|
459
503
|
class: "send-btn",
|
|
460
504
|
type: "primary",
|
|
461
|
-
icon: M(
|
|
462
|
-
loading:
|
|
463
|
-
onClick:
|
|
505
|
+
icon: M(Te),
|
|
506
|
+
loading: l.value,
|
|
507
|
+
onClick: j,
|
|
464
508
|
round: ""
|
|
465
509
|
}, {
|
|
466
510
|
default: P(() => [
|
|
467
|
-
|
|
511
|
+
J(" 发送 ")
|
|
468
512
|
]),
|
|
469
513
|
_: 1
|
|
470
514
|
}, 8, ["icon", "loading"])
|
|
@@ -475,40 +519,40 @@ const V = (l) => (fe("data-v-b571a3f5"), l = l(), ve(), l), Pe = { class: "chat-
|
|
|
475
519
|
}),
|
|
476
520
|
_: 1
|
|
477
521
|
}, 8, ["modelValue"]),
|
|
478
|
-
|
|
479
|
-
modelValue:
|
|
480
|
-
"onUpdate:modelValue":
|
|
522
|
+
E(H, {
|
|
523
|
+
modelValue: k.value,
|
|
524
|
+
"onUpdate:modelValue": e[5] || (e[5] = (g) => k.value = g),
|
|
481
525
|
title: "📝 反馈意见",
|
|
482
526
|
width: "400px"
|
|
483
527
|
}, {
|
|
484
528
|
footer: P(() => [
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
onClick:
|
|
529
|
+
n("span", rt, [
|
|
530
|
+
E($, {
|
|
531
|
+
onClick: e[3] || (e[3] = (g) => k.value = !1)
|
|
488
532
|
}, {
|
|
489
533
|
default: P(() => [
|
|
490
|
-
|
|
534
|
+
J("取消")
|
|
491
535
|
]),
|
|
492
536
|
_: 1
|
|
493
537
|
}),
|
|
494
|
-
|
|
538
|
+
E($, {
|
|
495
539
|
type: "primary",
|
|
496
|
-
onClick:
|
|
540
|
+
onClick: e[4] || (e[4] = (g) => Y("unsatisfied", h.value))
|
|
497
541
|
}, {
|
|
498
542
|
default: P(() => [
|
|
499
|
-
|
|
543
|
+
J("提交反馈")
|
|
500
544
|
]),
|
|
501
545
|
_: 1
|
|
502
546
|
})
|
|
503
547
|
])
|
|
504
548
|
]),
|
|
505
549
|
default: P(() => [
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
550
|
+
n("div", at, [
|
|
551
|
+
nt,
|
|
552
|
+
ot,
|
|
553
|
+
E(d, {
|
|
510
554
|
modelValue: C.value,
|
|
511
|
-
"onUpdate:modelValue":
|
|
555
|
+
"onUpdate:modelValue": e[2] || (e[2] = (g) => C.value = g),
|
|
512
556
|
type: "textarea",
|
|
513
557
|
rows: 4,
|
|
514
558
|
placeholder: "[非必填]例如:回答不够准确、查询结果有误、界面体验不佳..."
|
|
@@ -520,11 +564,11 @@ const V = (l) => (fe("data-v-b571a3f5"), l = l(), ve(), l), Pe = { class: "chat-
|
|
|
520
564
|
], 64);
|
|
521
565
|
};
|
|
522
566
|
}
|
|
523
|
-
},
|
|
524
|
-
install(
|
|
525
|
-
|
|
567
|
+
}, lt = /* @__PURE__ */ Se(it, [["__scopeId", "data-v-485f55b8"]]), Ht = {
|
|
568
|
+
install(u) {
|
|
569
|
+
u.component("st-varietyAiHelper", lt);
|
|
526
570
|
}
|
|
527
571
|
};
|
|
528
572
|
export {
|
|
529
|
-
|
|
573
|
+
Ht as default
|
|
530
574
|
};
|