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