st-comp 0.0.254 → 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/MonacoEditor.cjs +1 -1
- package/es/MonacoEditor.js +1 -1
- package/es/VarietyAiHelper.cjs +5 -5
- package/es/VarietyAiHelper.js +274 -237
- package/es/VarietySearch.cjs +1 -1
- package/es/VarietySearch.js +1 -1
- package/es/aiTools.js +59 -18
- package/es/{index-40f05e2c.cjs → index-5befc414.cjs} +2 -2
- package/es/{index-8a54ceeb.js → index-8f9d0d17.js} +2 -2
- package/es/{python-02c3937a.cjs → python-27ece6fa.cjs} +1 -1
- package/es/{python-99011a53.js → python-656db04f.js} +1 -1
- package/es/style.css +1 -1
- package/lib/aiTools.js +59 -18
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +5 -5
- package/lib/{index-28225e49.js → index-73a5aa87.js} +172 -135
- package/lib/{python-b13b7faa.js → python-8821365d.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/VarietyAiHelper/index.vue +35 -9
- package/public/aiTools.js +59 -18
package/es/VarietyAiHelper.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { b as Z, p 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
|
-
import { E as
|
|
4
|
+
import { E as ie } from "./el-button-e2c63c08.js";
|
|
5
5
|
import { E as le } from "./el-input-d47281da.js";
|
|
6
|
-
import { defineComponent as
|
|
7
|
-
import { d as
|
|
8
|
-
import { V as
|
|
9
|
-
import { E as
|
|
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
|
+
import { V as ge } from "./index-7ed0999e.js";
|
|
9
|
+
import { E as _e, u as he, s as K, p as be } from "./index-c2b9bbfd.js";
|
|
10
10
|
import { _ as ke } from "./_plugin-vue_export-helper-dad06003.js";
|
|
11
11
|
import { E as B } from "./index-f30561d3.js";
|
|
12
12
|
import { k as ye, i as Te } from "./use-form-common-props-cb0ca65c.js";
|
|
@@ -27,7 +27,7 @@ const we = Z({
|
|
|
27
27
|
type: [Number, String],
|
|
28
28
|
values: ye,
|
|
29
29
|
default: "",
|
|
30
|
-
validator: (
|
|
30
|
+
validator: (l) => U(l)
|
|
31
31
|
},
|
|
32
32
|
shape: {
|
|
33
33
|
type: String,
|
|
@@ -48,134 +48,159 @@ const we = Z({
|
|
|
48
48
|
default: "cover"
|
|
49
49
|
}
|
|
50
50
|
}), Se = {
|
|
51
|
-
error: (
|
|
52
|
-
}, Ce =
|
|
51
|
+
error: (l) => l instanceof Event
|
|
52
|
+
}, Ce = W({
|
|
53
53
|
name: "ElAvatar"
|
|
54
|
-
}), Ee = /* @__PURE__ */
|
|
54
|
+
}), Ee = /* @__PURE__ */ W({
|
|
55
55
|
...Ce,
|
|
56
56
|
props: we,
|
|
57
57
|
emits: Se,
|
|
58
|
-
setup(
|
|
59
|
-
const
|
|
60
|
-
const { size:
|
|
61
|
-
return se(
|
|
62
|
-
}),
|
|
63
|
-
const { size:
|
|
64
|
-
return
|
|
65
|
-
size: ae(
|
|
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: O(
|
|
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: O(
|
|
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
|
-
})) : ue(
|
|
90
|
+
})) : ue(e.$slots, "default", { key: 2 })
|
|
91
91
|
], 6));
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
94
|
var De = /* @__PURE__ */ oe(Ee, [["__file", "avatar.vue"]]);
|
|
95
95
|
const Ve = ne(De);
|
|
96
|
-
const
|
|
97
|
-
var
|
|
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 _ = 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
|
-
|
|
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,
|
|
160
185
|
Ie
|
|
161
|
-
], je = ["onClick"], Oe = /* @__PURE__ */
|
|
186
|
+
], je = ["onClick"], Oe = /* @__PURE__ */ V(() => /* @__PURE__ */ s("span", { class: "btn-emoji" }, "👎", -1)), Re = /* @__PURE__ */ V(() => /* @__PURE__ */ s("span", { class: "btn-text" }, "不满意", -1)), Je = [
|
|
162
187
|
Oe,
|
|
163
188
|
Re
|
|
164
|
-
],
|
|
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
|
-
},
|
|
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)), Xe = { class: "input-area" }, Ge = { class: "input-actions" }, Qe = /* @__PURE__ */
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
], -1)), Ze = { class: "feedback-dialog-content" }, et = /* @__PURE__ */
|
|
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,160 +212,172 @@ const C = (r) => (fe("data-v-24220a5f"), r = r(), ve(), 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
|
-
]),
|
|
209
|
-
switch (
|
|
233
|
+
]), d = k(""), b = k(!1), C = k(""), _ = k({}), E = async (m, t) => {
|
|
234
|
+
switch (m) {
|
|
210
235
|
case "satisfied": {
|
|
211
|
-
const
|
|
212
|
-
userName:
|
|
213
|
-
userContent:
|
|
214
|
-
aiContent:
|
|
236
|
+
const a = o.value[t], f = {
|
|
237
|
+
userName: p.username,
|
|
238
|
+
userContent: a.userContent,
|
|
239
|
+
aiContent: a.content,
|
|
215
240
|
type: 1,
|
|
216
|
-
createTime:
|
|
217
|
-
resTime:
|
|
218
|
-
firstPackageTime:
|
|
241
|
+
createTime: a.createTime,
|
|
242
|
+
resTime: a.resTime,
|
|
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
|
|
229
|
-
userName:
|
|
230
|
-
userContent:
|
|
231
|
-
userSuggestion:
|
|
232
|
-
aiContent:
|
|
253
|
+
const a = o.value[t], f = {
|
|
254
|
+
userName: p.username,
|
|
255
|
+
userContent: a.userContent,
|
|
256
|
+
userSuggestion: C.value,
|
|
257
|
+
aiContent: a.content,
|
|
233
258
|
type: 2,
|
|
234
|
-
resTime:
|
|
235
|
-
createTime:
|
|
236
|
-
firstPackageTime:
|
|
259
|
+
resTime: a.resTime,
|
|
260
|
+
createTime: a.createTime,
|
|
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
|
|
243
|
-
userName:
|
|
244
|
-
userContent:
|
|
245
|
-
userSuggestion:
|
|
246
|
-
aiContent:
|
|
267
|
+
const a = o.value[t], f = {
|
|
268
|
+
userName: p.username,
|
|
269
|
+
userContent: a.userContent,
|
|
270
|
+
userSuggestion: C.value,
|
|
271
|
+
aiContent: a.content,
|
|
247
272
|
type: null,
|
|
248
|
-
resTime:
|
|
249
|
-
createTime:
|
|
250
|
-
firstPackageTime:
|
|
273
|
+
resTime: a.resTime,
|
|
274
|
+
createTime: a.createTime,
|
|
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
|
-
}),
|
|
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
|
-
e
|
|
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
|
-
} catch (
|
|
300
|
-
B.error(`AI响应异常: ${
|
|
336
|
+
} catch (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:
|
|
307
|
-
resTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
343
|
+
createTime: N().format("YYYY-MM-DD HH:mm:ss"),
|
|
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
|
-
}, G = (
|
|
312
|
-
if (
|
|
313
|
-
if (
|
|
314
|
-
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
` +
|
|
318
|
-
|
|
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;
|
|
319
356
|
});
|
|
320
357
|
} else
|
|
321
|
-
|
|
322
|
-
},
|
|
323
|
-
await
|
|
358
|
+
m.preventDefault(), $();
|
|
359
|
+
}, Y = async () => {
|
|
360
|
+
await L(), S.value && (S.value.scrollTop = S.value.scrollHeight);
|
|
324
361
|
};
|
|
325
|
-
return
|
|
326
|
-
() =>
|
|
362
|
+
return q(
|
|
363
|
+
() => o.value,
|
|
327
364
|
() => {
|
|
328
|
-
|
|
365
|
+
Y();
|
|
329
366
|
},
|
|
330
367
|
{ deep: !0 }
|
|
331
|
-
),
|
|
368
|
+
), T({
|
|
332
369
|
open: () => {
|
|
333
|
-
|
|
334
|
-
|
|
370
|
+
u.value = !0, L(() => {
|
|
371
|
+
Y();
|
|
335
372
|
});
|
|
336
373
|
}
|
|
337
|
-
}), (
|
|
338
|
-
const
|
|
339
|
-
return
|
|
340
|
-
|
|
374
|
+
}), (m, t) => {
|
|
375
|
+
const a = Ve, f = le, z = ie, F = re;
|
|
376
|
+
return g(), y(H, null, [
|
|
377
|
+
D(F, {
|
|
341
378
|
class: "ai-dialog",
|
|
342
|
-
modelValue:
|
|
343
|
-
"onUpdate:modelValue":
|
|
379
|
+
modelValue: u.value,
|
|
380
|
+
"onUpdate:modelValue": t[1] || (t[1] = (v) => u.value = v),
|
|
344
381
|
title: "✨ 品种池参数解析AI助手",
|
|
345
382
|
width: "500px",
|
|
346
383
|
center: "",
|
|
@@ -349,85 +386,85 @@ const C = (r) => (fe("data-v-24220a5f"), r = r(), ve(), r), Fe = { class: "chat-
|
|
|
349
386
|
modal: !1,
|
|
350
387
|
"modal-penetrable": !0
|
|
351
388
|
}, {
|
|
352
|
-
default:
|
|
353
|
-
var
|
|
389
|
+
default: P(() => {
|
|
390
|
+
var v;
|
|
354
391
|
return [
|
|
355
|
-
|
|
356
|
-
|
|
392
|
+
s("div", Pe, [
|
|
393
|
+
s("div", {
|
|
357
394
|
ref_key: "messageListRef",
|
|
358
|
-
ref:
|
|
395
|
+
ref: S,
|
|
359
396
|
class: "message-list"
|
|
360
397
|
}, [
|
|
361
|
-
(
|
|
398
|
+
(g(!0), y(H, null, pe(o.value, (n, A) => (g(), y("div", {
|
|
362
399
|
key: A,
|
|
363
400
|
class: "message-item-wrapper"
|
|
364
401
|
}, [
|
|
365
|
-
|
|
402
|
+
s("div", {
|
|
366
403
|
class: X(["message-item", n.role])
|
|
367
404
|
}, [
|
|
368
|
-
n.content ? (
|
|
369
|
-
|
|
370
|
-
|
|
405
|
+
n.content ? (g(), y(H, { key: 0 }, [
|
|
406
|
+
s("div", Fe, [
|
|
407
|
+
D(a, {
|
|
371
408
|
size: 32,
|
|
372
|
-
icon: n.role === "user" ?
|
|
409
|
+
icon: n.role === "user" ? M(he) : M(K)
|
|
373
410
|
}, null, 8, ["icon"])
|
|
374
411
|
]),
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
n.role === "assistant" ? (
|
|
379
|
-
n.showFeedback && !n.hasFeedback ? (
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
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", {
|
|
383
420
|
class: "feedback-btn satisfied-btn",
|
|
384
|
-
onClick: (Q) =>
|
|
385
|
-
}, Le, 8,
|
|
386
|
-
|
|
421
|
+
onClick: (Q) => E("satisfied", A)
|
|
422
|
+
}, Le, 8, ze),
|
|
423
|
+
s("button", {
|
|
387
424
|
class: "feedback-btn unsatisfied-btn",
|
|
388
|
-
onClick: (Q) =>
|
|
389
|
-
},
|
|
425
|
+
onClick: (Q) => E("open", A)
|
|
426
|
+
}, Je, 8, je)
|
|
390
427
|
])
|
|
391
428
|
], 64)) : x("", !0),
|
|
392
|
-
n.showFeedback && n.hasFeedback ? (
|
|
429
|
+
n.showFeedback && n.hasFeedback ? (g(), y("div", Ke, "感谢您进行的评价反馈")) : x("", !0)
|
|
393
430
|
], 64)) : x("", !0)
|
|
394
431
|
])
|
|
395
432
|
], 64)) : x("", !0)
|
|
396
433
|
], 2)
|
|
397
434
|
]))), 128)),
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
435
|
+
e.value && !((v = o.value[o.value.length - 1]) != null && v.content) ? (g(), y("div", Ue, [
|
|
436
|
+
s("div", We, [
|
|
437
|
+
D(a, {
|
|
401
438
|
size: 32,
|
|
402
|
-
icon:
|
|
439
|
+
icon: M(K)
|
|
403
440
|
}, null, 8, ["icon"])
|
|
404
441
|
]),
|
|
405
|
-
|
|
442
|
+
qe
|
|
406
443
|
])) : x("", !0)
|
|
407
444
|
], 512),
|
|
408
|
-
|
|
409
|
-
|
|
445
|
+
s("div", Xe, [
|
|
446
|
+
D(f, {
|
|
410
447
|
class: "message-input",
|
|
411
|
-
modelValue:
|
|
412
|
-
"onUpdate:modelValue":
|
|
448
|
+
modelValue: d.value,
|
|
449
|
+
"onUpdate:modelValue": t[0] || (t[0] = (n) => d.value = n),
|
|
413
450
|
type: "textarea",
|
|
414
451
|
rows: 4,
|
|
415
452
|
autosize: { minRows: 2, maxRows: 4 },
|
|
416
453
|
placeholder: "输入您想查询的品种条件... (Ctrl+Enter换行,Enter发送)",
|
|
417
454
|
onKeydown: G
|
|
418
455
|
}, null, 8, ["modelValue"]),
|
|
419
|
-
|
|
456
|
+
s("div", Ge, [
|
|
420
457
|
Qe,
|
|
421
|
-
|
|
458
|
+
D(z, {
|
|
422
459
|
class: "send-btn",
|
|
423
460
|
type: "primary",
|
|
424
|
-
icon:
|
|
425
|
-
loading:
|
|
426
|
-
onClick:
|
|
461
|
+
icon: M(be),
|
|
462
|
+
loading: i.value,
|
|
463
|
+
onClick: $,
|
|
427
464
|
round: ""
|
|
428
465
|
}, {
|
|
429
|
-
default:
|
|
430
|
-
|
|
466
|
+
default: P(() => [
|
|
467
|
+
j(" 发送 ")
|
|
431
468
|
]),
|
|
432
469
|
_: 1
|
|
433
470
|
}, 8, ["icon", "loading"])
|
|
@@ -438,40 +475,40 @@ const C = (r) => (fe("data-v-24220a5f"), r = r(), ve(), r), Fe = { class: "chat-
|
|
|
438
475
|
}),
|
|
439
476
|
_: 1
|
|
440
477
|
}, 8, ["modelValue"]),
|
|
441
|
-
|
|
442
|
-
modelValue:
|
|
443
|
-
"onUpdate:modelValue":
|
|
478
|
+
D(F, {
|
|
479
|
+
modelValue: b.value,
|
|
480
|
+
"onUpdate:modelValue": t[5] || (t[5] = (v) => b.value = v),
|
|
444
481
|
title: "📝 反馈意见",
|
|
445
482
|
width: "400px"
|
|
446
483
|
}, {
|
|
447
|
-
footer:
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
onClick:
|
|
484
|
+
footer: P(() => [
|
|
485
|
+
s("span", st, [
|
|
486
|
+
D(z, {
|
|
487
|
+
onClick: t[3] || (t[3] = (v) => b.value = !1)
|
|
451
488
|
}, {
|
|
452
|
-
default:
|
|
453
|
-
|
|
489
|
+
default: P(() => [
|
|
490
|
+
j("取消")
|
|
454
491
|
]),
|
|
455
492
|
_: 1
|
|
456
493
|
}),
|
|
457
|
-
|
|
494
|
+
D(z, {
|
|
458
495
|
type: "primary",
|
|
459
|
-
onClick:
|
|
496
|
+
onClick: t[4] || (t[4] = (v) => E("unsatisfied", _.value))
|
|
460
497
|
}, {
|
|
461
|
-
default:
|
|
462
|
-
|
|
498
|
+
default: P(() => [
|
|
499
|
+
j("提交反馈")
|
|
463
500
|
]),
|
|
464
501
|
_: 1
|
|
465
502
|
})
|
|
466
503
|
])
|
|
467
504
|
]),
|
|
468
|
-
default:
|
|
469
|
-
|
|
505
|
+
default: P(() => [
|
|
506
|
+
s("div", Ze, [
|
|
470
507
|
et,
|
|
471
508
|
tt,
|
|
472
|
-
|
|
473
|
-
modelValue:
|
|
474
|
-
"onUpdate:modelValue":
|
|
509
|
+
D(f, {
|
|
510
|
+
modelValue: C.value,
|
|
511
|
+
"onUpdate:modelValue": t[2] || (t[2] = (v) => C.value = v),
|
|
475
512
|
type: "textarea",
|
|
476
513
|
rows: 4,
|
|
477
514
|
placeholder: "[非必填]例如:回答不够准确、查询结果有误、界面体验不佳..."
|
|
@@ -483,11 +520,11 @@ const C = (r) => (fe("data-v-24220a5f"), r = r(), ve(), r), Fe = { class: "chat-
|
|
|
483
520
|
], 64);
|
|
484
521
|
};
|
|
485
522
|
}
|
|
486
|
-
}, ot = /* @__PURE__ */ ke(at, [["__scopeId", "data-v-
|
|
487
|
-
install(
|
|
488
|
-
|
|
523
|
+
}, ot = /* @__PURE__ */ ke(at, [["__scopeId", "data-v-b571a3f5"]]), Mt = {
|
|
524
|
+
install(l) {
|
|
525
|
+
l.component("st-varietyAiHelper", ot);
|
|
489
526
|
}
|
|
490
527
|
};
|
|
491
528
|
export {
|
|
492
|
-
|
|
529
|
+
Mt as default
|
|
493
530
|
};
|