st-comp 0.0.275 → 0.0.277
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 +7 -7
- package/es/VarietyAiHelper.js +317 -280
- package/es/VarietySearch.cjs +1 -1
- package/es/VarietySearch.js +1 -1
- package/es/aiTools-a3b095f6.js +113 -0
- package/es/aiTools-f36136a4.cjs +2 -0
- package/es/aiTools.js +8 -0
- package/es/style.css +1 -1
- package/lib/aiTools.js +8 -0
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +74 -74
- package/lib/{index-298ca804.js → index-2a269748.js} +1112 -1075
- package/lib/{python-4b8051bd.js → python-41da18e5.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/VarietyAiHelper/index.vue +49 -4
- package/public/aiTools.js +8 -0
- package/src/App.vue +16 -16
- package/es/aiTools-0c653fa6.js +0 -113
- package/es/aiTools-336e4de3.cjs +0 -2
package/package.json
CHANGED
|
@@ -26,6 +26,8 @@ const messageList = ref([
|
|
|
26
26
|
{
|
|
27
27
|
role: "defaultMessage", // defaultMessage-组件内置, assistant-智能体, user-用户
|
|
28
28
|
content: props.defaultMessage,
|
|
29
|
+
fullQuery: "",
|
|
30
|
+
historyList: [],
|
|
29
31
|
userContent: null,
|
|
30
32
|
showFeedback: false,
|
|
31
33
|
createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
|
@@ -71,6 +73,8 @@ const sendMessage = async () => {
|
|
|
71
73
|
messageList.value.push({
|
|
72
74
|
role: "assistant",
|
|
73
75
|
content: "",
|
|
76
|
+
fullQuery: "",
|
|
77
|
+
historyList: [],
|
|
74
78
|
userContent: content,
|
|
75
79
|
showFeedback: false,
|
|
76
80
|
createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
|
@@ -96,6 +100,14 @@ const sendMessage = async () => {
|
|
|
96
100
|
if (type === "session") {
|
|
97
101
|
sessionId.value = data;
|
|
98
102
|
}
|
|
103
|
+
if (type === "historyList") {
|
|
104
|
+
const lastMessage = messageList.value[messageList.value.length - 1];
|
|
105
|
+
lastMessage.historyList = data;
|
|
106
|
+
}
|
|
107
|
+
if (type === "fullQuery") {
|
|
108
|
+
const lastMessage = messageList.value[messageList.value.length - 1];
|
|
109
|
+
lastMessage.fullQuery = data;
|
|
110
|
+
}
|
|
99
111
|
if (type === "node") {
|
|
100
112
|
if (!firstNodeReceived) {
|
|
101
113
|
firstNodeReceived = true;
|
|
@@ -171,7 +183,7 @@ const sendMessage = async () => {
|
|
|
171
183
|
isThinking.value = false;
|
|
172
184
|
}
|
|
173
185
|
};
|
|
174
|
-
//
|
|
186
|
+
// 确认查询
|
|
175
187
|
const lookResult = (content) => {
|
|
176
188
|
const { parsedConditions, ...webParams } = JSON.parse(content);
|
|
177
189
|
console.log({ parsedConditions, webParams });
|
|
@@ -180,11 +192,15 @@ const lookResult = (content) => {
|
|
|
180
192
|
// 用户反馈
|
|
181
193
|
const handleFeedbackAction = async (action, messageIndex) => {
|
|
182
194
|
switch (action) {
|
|
195
|
+
// 满意
|
|
183
196
|
case "satisfied": {
|
|
184
197
|
const message = messageList.value[messageIndex];
|
|
185
198
|
await stConfig.request.post("/alarm/deliversign/addVarietyAiHelperLog", {
|
|
186
199
|
userName: userData.username,
|
|
187
200
|
userContent: message.userContent,
|
|
201
|
+
sessionId: sessionId.value,
|
|
202
|
+
fullQuery: message.fullQuery,
|
|
203
|
+
historyList: JSON.stringify(message.historyList ?? []),
|
|
188
204
|
aiContent: message.content,
|
|
189
205
|
type: 1,
|
|
190
206
|
createTime: message.createTime,
|
|
@@ -197,16 +213,21 @@ const handleFeedbackAction = async (action, messageIndex) => {
|
|
|
197
213
|
messageList.value[messageIndex].showFeedback = false;
|
|
198
214
|
break;
|
|
199
215
|
}
|
|
216
|
+
// 不满意-打开窗口
|
|
200
217
|
case "open": {
|
|
201
218
|
feedbackMessageIndex.value = messageIndex;
|
|
202
219
|
feedbackDialogVisible.value = true;
|
|
203
220
|
break;
|
|
204
221
|
}
|
|
222
|
+
// 不满意-确认提交
|
|
205
223
|
case "unsatisfied": {
|
|
206
224
|
const message = messageList.value[messageIndex];
|
|
207
225
|
await stConfig.request.post("/alarm/deliversign/addVarietyAiHelperLog", {
|
|
208
226
|
userName: userData.username,
|
|
209
227
|
userContent: message.userContent,
|
|
228
|
+
sessionId: sessionId.value,
|
|
229
|
+
fullQuery: message.fullQuery,
|
|
230
|
+
historyList: JSON.stringify(message.historyList ?? []),
|
|
210
231
|
userSuggestion: feedbackContent.value,
|
|
211
232
|
aiContent: message.content,
|
|
212
233
|
type: 2,
|
|
@@ -221,12 +242,29 @@ const handleFeedbackAction = async (action, messageIndex) => {
|
|
|
221
242
|
messageList.value[messageIndex].showFeedback = false;
|
|
222
243
|
break;
|
|
223
244
|
}
|
|
245
|
+
// 默认记录
|
|
224
246
|
case "default": {
|
|
225
247
|
const message = messageList.value[messageIndex];
|
|
248
|
+
console.log({
|
|
249
|
+
userName: userData.username,
|
|
250
|
+
userContent: message.userContent,
|
|
251
|
+
sessionId: sessionId.value,
|
|
252
|
+
fullQuery: message.fullQuery,
|
|
253
|
+
historyList: JSON.stringify(message.historyList ?? []),
|
|
254
|
+
aiContent: message.content,
|
|
255
|
+
type: null,
|
|
256
|
+
resTime: message.resTime,
|
|
257
|
+
createTime: message.createTime,
|
|
258
|
+
firstPackageTime: message.firstPackageTime,
|
|
259
|
+
isSolved: 1,
|
|
260
|
+
logOrigin: 1,
|
|
261
|
+
});
|
|
226
262
|
await stConfig.request.post("/alarm/deliversign/addVarietyAiHelperLog", {
|
|
227
263
|
userName: userData.username,
|
|
228
264
|
userContent: message.userContent,
|
|
229
|
-
|
|
265
|
+
sessionId: sessionId.value,
|
|
266
|
+
fullQuery: message.fullQuery,
|
|
267
|
+
historyList: JSON.stringify(message.historyList ?? []),
|
|
230
268
|
aiContent: message.content,
|
|
231
269
|
type: null,
|
|
232
270
|
resTime: message.resTime,
|
|
@@ -346,6 +384,12 @@ defineExpose({
|
|
|
346
384
|
</div>
|
|
347
385
|
<!-- 响应 -->
|
|
348
386
|
<div class="message-content">
|
|
387
|
+
<div
|
|
388
|
+
v-if="message.fullQuery"
|
|
389
|
+
style="font-weight: bold; margin-bottom: 10px"
|
|
390
|
+
>
|
|
391
|
+
筛选结果: {{ message.fullQuery }}
|
|
392
|
+
</div>
|
|
349
393
|
<!-- 节点展示 -->
|
|
350
394
|
<div
|
|
351
395
|
v-if="index === messageList.length - 1 && message.role === 'assistant' && nodeProgressList.length > 0 && !showFinalResult"
|
|
@@ -428,13 +472,13 @@ defineExpose({
|
|
|
428
472
|
/>
|
|
429
473
|
</el-tooltip>
|
|
430
474
|
</div>
|
|
431
|
-
<!--
|
|
475
|
+
<!-- 确认查询 -->
|
|
432
476
|
<el-button
|
|
433
477
|
v-if="isJSONSerializable(message.content)"
|
|
434
478
|
class="confirm-btn"
|
|
435
479
|
@click="lookResult(message.content)"
|
|
436
480
|
>
|
|
437
|
-
|
|
481
|
+
确认查询
|
|
438
482
|
</el-button>
|
|
439
483
|
</div>
|
|
440
484
|
</div>
|
|
@@ -679,6 +723,7 @@ defineExpose({
|
|
|
679
723
|
}
|
|
680
724
|
}
|
|
681
725
|
.confirm-btn {
|
|
726
|
+
margin-left: auto;
|
|
682
727
|
margin-top: 8px;
|
|
683
728
|
padding: 6px 20px;
|
|
684
729
|
font-size: 13px;
|
package/public/aiTools.js
CHANGED
|
@@ -89,6 +89,14 @@ export const sendToNodeVarietyAiHelper = async ({ baseUrl, token, value, session
|
|
|
89
89
|
if (data.type === "session") {
|
|
90
90
|
callback("session", data.sessionId);
|
|
91
91
|
}
|
|
92
|
+
// 历史消息
|
|
93
|
+
if (data.type === "historyList") {
|
|
94
|
+
callback("historyList", data.historyList);
|
|
95
|
+
}
|
|
96
|
+
// 一句话概括用户查询内容
|
|
97
|
+
if (data.type === "fullQuery") {
|
|
98
|
+
callback("fullQuery", data.fullQuery);
|
|
99
|
+
}
|
|
92
100
|
// 节点状态
|
|
93
101
|
if (data.node_name && data.node_status) {
|
|
94
102
|
const nodeName = data.node_name;
|
package/src/App.vue
CHANGED
|
@@ -46,31 +46,31 @@ const route = useRoute();
|
|
|
46
46
|
/**
|
|
47
47
|
* @description: 组件库Demo本地
|
|
48
48
|
*/
|
|
49
|
-
const VITE_RUN_ENV = {
|
|
50
|
-
VITE_PROJECT_NAME: "迈幻量化",
|
|
51
|
-
VITE_PROJECT_CLIENTID: "7",
|
|
52
|
-
VITE_BASE_URL: "http://127.0.0.1:7001",
|
|
53
|
-
BASE_URL: "/",
|
|
54
|
-
MODE: "localhost",
|
|
55
|
-
DEV: true,
|
|
56
|
-
PROD: false,
|
|
57
|
-
SSR: false,
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @description: 组件库Demo测试
|
|
62
|
-
*/
|
|
63
49
|
// const VITE_RUN_ENV = {
|
|
64
50
|
// VITE_PROJECT_NAME: "迈幻量化",
|
|
65
51
|
// VITE_PROJECT_CLIENTID: "7",
|
|
66
|
-
// VITE_BASE_URL: "http://
|
|
52
|
+
// VITE_BASE_URL: "http://127.0.0.1:7001",
|
|
67
53
|
// BASE_URL: "/",
|
|
68
|
-
// MODE: "
|
|
54
|
+
// MODE: "localhost",
|
|
69
55
|
// DEV: true,
|
|
70
56
|
// PROD: false,
|
|
71
57
|
// SSR: false,
|
|
72
58
|
// };
|
|
73
59
|
|
|
60
|
+
/**
|
|
61
|
+
* @description: 组件库Demo测试
|
|
62
|
+
*/
|
|
63
|
+
const VITE_RUN_ENV = {
|
|
64
|
+
VITE_PROJECT_NAME: "迈幻量化",
|
|
65
|
+
VITE_PROJECT_CLIENTID: "7",
|
|
66
|
+
VITE_BASE_URL: "http://192.168.12.38:5173",
|
|
67
|
+
BASE_URL: "/",
|
|
68
|
+
MODE: "test49",
|
|
69
|
+
DEV: true,
|
|
70
|
+
PROD: false,
|
|
71
|
+
SSR: false,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
74
|
/**
|
|
75
75
|
* @description: 组件库Demo线上
|
|
76
76
|
*/
|
package/es/aiTools-0c653fa6.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
const w = async ({ baseUrl: d, path: c, token: u, value: o, sessionId: t, origin: i = "web", getSSE: n }) => {
|
|
2
|
-
try {
|
|
3
|
-
const r = await fetch(`${d}${c}`, {
|
|
4
|
-
method: "POST",
|
|
5
|
-
headers: {
|
|
6
|
-
"Content-Type": "application/json",
|
|
7
|
-
token: u
|
|
8
|
-
},
|
|
9
|
-
body: JSON.stringify({
|
|
10
|
-
query: o,
|
|
11
|
-
origin: i,
|
|
12
|
-
sessionId: t,
|
|
13
|
-
stream: !0
|
|
14
|
-
})
|
|
15
|
-
});
|
|
16
|
-
if (!r.ok) {
|
|
17
|
-
n("error", `HTTP ${r.status}: ${r.statusText}`);
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const s = r.body.getReader(), m = new TextDecoder();
|
|
21
|
-
let a = "", e;
|
|
22
|
-
for (; ; ) {
|
|
23
|
-
const { done: f, value: p } = await s.read();
|
|
24
|
-
if (f) {
|
|
25
|
-
n("finish");
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
a += m.decode(p, { stream: !0 });
|
|
29
|
-
let h;
|
|
30
|
-
for (; (h = a.indexOf(`
|
|
31
|
-
`)) !== -1; ) {
|
|
32
|
-
const g = a.substring(0, h).trim();
|
|
33
|
-
if (a = a.substring(h + 1), g.startsWith("data: ")) {
|
|
34
|
-
const y = g.substring(6).trim();
|
|
35
|
-
if (!y || y === "[DONE]")
|
|
36
|
-
continue;
|
|
37
|
-
n("message", y);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
} catch (r) {
|
|
42
|
-
console.error("SSE请求失败:", r), n("error", r.message || "sendToNodeSSE检测到异常");
|
|
43
|
-
}
|
|
44
|
-
}, T = async ({ baseUrl: d, token: c, value: u, sessionId: o, callback: t }) => {
|
|
45
|
-
const i = {};
|
|
46
|
-
return w({
|
|
47
|
-
baseUrl: d,
|
|
48
|
-
path: "/middleLayer/ai/varietyAiHelper",
|
|
49
|
-
token: c,
|
|
50
|
-
value: u,
|
|
51
|
-
sessionId: o,
|
|
52
|
-
origin: "web",
|
|
53
|
-
getSSE: (r, s) => {
|
|
54
|
-
var m, a;
|
|
55
|
-
switch (r) {
|
|
56
|
-
case "message": {
|
|
57
|
-
try {
|
|
58
|
-
const e = JSON.parse(s);
|
|
59
|
-
if (e.type === "session" && t("session", e.sessionId), e.node_name && e.node_status) {
|
|
60
|
-
const f = e.node_name, p = e.node_status === "success" ? "success" : "executing";
|
|
61
|
-
i[f] !== p && (i[f] = p, t("node", {
|
|
62
|
-
name: f,
|
|
63
|
-
status: p
|
|
64
|
-
}));
|
|
65
|
-
}
|
|
66
|
-
((m = e.output) == null ? void 0 : m.finish_reason) === "stop" && ((a = e.output) != null && a.text) && t("message", e.output.text), e.error && t("error", e.error);
|
|
67
|
-
} catch {
|
|
68
|
-
}
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
case "finish": {
|
|
72
|
-
t("finish");
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
case "error": {
|
|
76
|
-
t("error", s);
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}, S = async ({ baseUrl: d, token: c, value: u, callback: o }) => w({
|
|
83
|
-
baseUrl: d,
|
|
84
|
-
path: "/middleLayer/ai/factorAiTest",
|
|
85
|
-
token: c,
|
|
86
|
-
value: u,
|
|
87
|
-
origin: "web",
|
|
88
|
-
getSSE: (i, n) => {
|
|
89
|
-
var r;
|
|
90
|
-
switch (i) {
|
|
91
|
-
case "message": {
|
|
92
|
-
try {
|
|
93
|
-
const s = JSON.parse(n);
|
|
94
|
-
s.output && o("message", (r = s.output) == null ? void 0 : r.content), s.error && o("error", s.error);
|
|
95
|
-
} catch {
|
|
96
|
-
}
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
case "finish": {
|
|
100
|
-
o("finish");
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
case "error": {
|
|
104
|
-
o("error", n);
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
export {
|
|
111
|
-
S as a,
|
|
112
|
-
T as s
|
|
113
|
-
};
|
package/es/aiTools-336e4de3.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const g=async({baseUrl:d,path:c,token:u,value:o,sessionId:t,origin:a="web",getSSE:n})=>{try{const r=await fetch(`${d}${c}`,{method:"POST",headers:{"Content-Type":"application/json",token:u},body:JSON.stringify({query:o,origin:a,sessionId:t,stream:!0})});if(!r.ok){n("error",`HTTP ${r.status}: ${r.statusText}`);return}const s=r.body.getReader(),m=new TextDecoder;let i="",e;for(;;){const{done:f,value:p}=await s.read();if(f){n("finish");break}i+=m.decode(p,{stream:!0});let h;for(;(h=i.indexOf(`
|
|
2
|
-
`))!==-1;){const T=i.substring(0,h).trim();if(i=i.substring(h+1),T.startsWith("data: ")){const y=T.substring(6).trim();if(!y||y==="[DONE]")continue;n("message",y)}}}}catch(r){console.error("SSE请求失败:",r),n("error",r.message||"sendToNodeSSE检测到异常")}},w=async({baseUrl:d,token:c,value:u,sessionId:o,callback:t})=>{const a={};return g({baseUrl:d,path:"/middleLayer/ai/varietyAiHelper",token:c,value:u,sessionId:o,origin:"web",getSSE:(r,s)=>{var m,i;switch(r){case"message":{try{const e=JSON.parse(s);if(e.type==="session"&&t("session",e.sessionId),e.node_name&&e.node_status){const f=e.node_name,p=e.node_status==="success"?"success":"executing";a[f]!==p&&(a[f]=p,t("node",{name:f,status:p}))}((m=e.output)==null?void 0:m.finish_reason)==="stop"&&((i=e.output)!=null&&i.text)&&t("message",e.output.text),e.error&&t("error",e.error)}catch{}break}case"finish":{t("finish");break}case"error":{t("error",s);break}}}})},N=async({baseUrl:d,token:c,value:u,callback:o})=>g({baseUrl:d,path:"/middleLayer/ai/factorAiTest",token:c,value:u,origin:"web",getSSE:(a,n)=>{var r;switch(a){case"message":{try{const s=JSON.parse(n);s.output&&o("message",(r=s.output)==null?void 0:r.content),s.error&&o("error",s.error)}catch{}break}case"finish":{o("finish");break}case"error":{o("error",n);break}}}});exports.sendToNodeFactorAiTest=N;exports.sendToNodeVarietyAiHelper=w;
|