st-comp 0.0.276 → 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 +303 -276
- package/es/VarietySearch.cjs +1 -1
- package/es/VarietySearch.js +1 -1
- package/es/{aiTools-d7bd47c3.js → aiTools-a3b095f6.js} +19 -19
- package/es/aiTools-f36136a4.cjs +2 -0
- package/es/aiTools.js +4 -0
- package/es/style.css +1 -1
- package/lib/aiTools.js +4 -0
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +46 -46
- package/lib/{index-8b55d8c8.js → index-2a269748.js} +37 -10
- package/lib/{python-f164f783.js → python-41da18e5.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/VarietyAiHelper/index.vue +42 -6
- package/public/aiTools.js +4 -0
- package/src/App.vue +16 -16
- package/es/aiTools-9fd42de8.cjs +0 -2
package/package.json
CHANGED
|
@@ -27,6 +27,7 @@ const messageList = ref([
|
|
|
27
27
|
role: "defaultMessage", // defaultMessage-组件内置, assistant-智能体, user-用户
|
|
28
28
|
content: props.defaultMessage,
|
|
29
29
|
fullQuery: "",
|
|
30
|
+
historyList: [],
|
|
30
31
|
userContent: null,
|
|
31
32
|
showFeedback: false,
|
|
32
33
|
createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
|
@@ -73,6 +74,7 @@ const sendMessage = async () => {
|
|
|
73
74
|
role: "assistant",
|
|
74
75
|
content: "",
|
|
75
76
|
fullQuery: "",
|
|
77
|
+
historyList: [],
|
|
76
78
|
userContent: content,
|
|
77
79
|
showFeedback: false,
|
|
78
80
|
createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
|
@@ -98,10 +100,13 @@ const sendMessage = async () => {
|
|
|
98
100
|
if (type === "session") {
|
|
99
101
|
sessionId.value = data;
|
|
100
102
|
}
|
|
103
|
+
if (type === "historyList") {
|
|
104
|
+
const lastMessage = messageList.value[messageList.value.length - 1];
|
|
105
|
+
lastMessage.historyList = data;
|
|
106
|
+
}
|
|
101
107
|
if (type === "fullQuery") {
|
|
102
108
|
const lastMessage = messageList.value[messageList.value.length - 1];
|
|
103
109
|
lastMessage.fullQuery = data;
|
|
104
|
-
console.log(data);
|
|
105
110
|
}
|
|
106
111
|
if (type === "node") {
|
|
107
112
|
if (!firstNodeReceived) {
|
|
@@ -178,7 +183,7 @@ const sendMessage = async () => {
|
|
|
178
183
|
isThinking.value = false;
|
|
179
184
|
}
|
|
180
185
|
};
|
|
181
|
-
//
|
|
186
|
+
// 确认查询
|
|
182
187
|
const lookResult = (content) => {
|
|
183
188
|
const { parsedConditions, ...webParams } = JSON.parse(content);
|
|
184
189
|
console.log({ parsedConditions, webParams });
|
|
@@ -187,11 +192,15 @@ const lookResult = (content) => {
|
|
|
187
192
|
// 用户反馈
|
|
188
193
|
const handleFeedbackAction = async (action, messageIndex) => {
|
|
189
194
|
switch (action) {
|
|
195
|
+
// 满意
|
|
190
196
|
case "satisfied": {
|
|
191
197
|
const message = messageList.value[messageIndex];
|
|
192
198
|
await stConfig.request.post("/alarm/deliversign/addVarietyAiHelperLog", {
|
|
193
199
|
userName: userData.username,
|
|
194
200
|
userContent: message.userContent,
|
|
201
|
+
sessionId: sessionId.value,
|
|
202
|
+
fullQuery: message.fullQuery,
|
|
203
|
+
historyList: JSON.stringify(message.historyList ?? []),
|
|
195
204
|
aiContent: message.content,
|
|
196
205
|
type: 1,
|
|
197
206
|
createTime: message.createTime,
|
|
@@ -204,16 +213,21 @@ const handleFeedbackAction = async (action, messageIndex) => {
|
|
|
204
213
|
messageList.value[messageIndex].showFeedback = false;
|
|
205
214
|
break;
|
|
206
215
|
}
|
|
216
|
+
// 不满意-打开窗口
|
|
207
217
|
case "open": {
|
|
208
218
|
feedbackMessageIndex.value = messageIndex;
|
|
209
219
|
feedbackDialogVisible.value = true;
|
|
210
220
|
break;
|
|
211
221
|
}
|
|
222
|
+
// 不满意-确认提交
|
|
212
223
|
case "unsatisfied": {
|
|
213
224
|
const message = messageList.value[messageIndex];
|
|
214
225
|
await stConfig.request.post("/alarm/deliversign/addVarietyAiHelperLog", {
|
|
215
226
|
userName: userData.username,
|
|
216
227
|
userContent: message.userContent,
|
|
228
|
+
sessionId: sessionId.value,
|
|
229
|
+
fullQuery: message.fullQuery,
|
|
230
|
+
historyList: JSON.stringify(message.historyList ?? []),
|
|
217
231
|
userSuggestion: feedbackContent.value,
|
|
218
232
|
aiContent: message.content,
|
|
219
233
|
type: 2,
|
|
@@ -228,12 +242,29 @@ const handleFeedbackAction = async (action, messageIndex) => {
|
|
|
228
242
|
messageList.value[messageIndex].showFeedback = false;
|
|
229
243
|
break;
|
|
230
244
|
}
|
|
245
|
+
// 默认记录
|
|
231
246
|
case "default": {
|
|
232
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
|
+
});
|
|
233
262
|
await stConfig.request.post("/alarm/deliversign/addVarietyAiHelperLog", {
|
|
234
263
|
userName: userData.username,
|
|
235
264
|
userContent: message.userContent,
|
|
236
|
-
|
|
265
|
+
sessionId: sessionId.value,
|
|
266
|
+
fullQuery: message.fullQuery,
|
|
267
|
+
historyList: JSON.stringify(message.historyList ?? []),
|
|
237
268
|
aiContent: message.content,
|
|
238
269
|
type: null,
|
|
239
270
|
resTime: message.resTime,
|
|
@@ -353,7 +384,12 @@ defineExpose({
|
|
|
353
384
|
</div>
|
|
354
385
|
<!-- 响应 -->
|
|
355
386
|
<div class="message-content">
|
|
356
|
-
<div
|
|
387
|
+
<div
|
|
388
|
+
v-if="message.fullQuery"
|
|
389
|
+
style="font-weight: bold; margin-bottom: 10px"
|
|
390
|
+
>
|
|
391
|
+
筛选结果: {{ message.fullQuery }}
|
|
392
|
+
</div>
|
|
357
393
|
<!-- 节点展示 -->
|
|
358
394
|
<div
|
|
359
395
|
v-if="index === messageList.length - 1 && message.role === 'assistant' && nodeProgressList.length > 0 && !showFinalResult"
|
|
@@ -436,13 +472,13 @@ defineExpose({
|
|
|
436
472
|
/>
|
|
437
473
|
</el-tooltip>
|
|
438
474
|
</div>
|
|
439
|
-
<!--
|
|
475
|
+
<!-- 确认查询 -->
|
|
440
476
|
<el-button
|
|
441
477
|
v-if="isJSONSerializable(message.content)"
|
|
442
478
|
class="confirm-btn"
|
|
443
479
|
@click="lookResult(message.content)"
|
|
444
480
|
>
|
|
445
|
-
|
|
481
|
+
确认查询
|
|
446
482
|
</el-button>
|
|
447
483
|
</div>
|
|
448
484
|
</div>
|
package/public/aiTools.js
CHANGED
|
@@ -89,6 +89,10 @@ 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
|
+
}
|
|
92
96
|
// 一句话概括用户查询内容
|
|
93
97
|
if (data.type === "fullQuery") {
|
|
94
98
|
callback("fullQuery", data.fullQuery);
|
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-9fd42de8.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const g=async({baseUrl:d,path:u,token:c,value:o,sessionId:s,origin:a="web",getSSE:n})=>{try{const r=await fetch(`${d}${u}`,{method:"POST",headers:{"Content-Type":"application/json",token:c},body:JSON.stringify({query:o,origin:a,sessionId:s,stream:!0})});if(!r.ok){n("error",`HTTP ${r.status}: ${r.statusText}`);return}const t=r.body.getReader(),m=new TextDecoder;let i="",e;for(;;){const{done:f,value:p}=await t.read();if(f){n("finish");break}i+=m.decode(p,{stream:!0});let y;for(;(y=i.indexOf(`
|
|
2
|
-
`))!==-1;){const T=i.substring(0,y).trim();if(i=i.substring(y+1),T.startsWith("data: ")){const h=T.substring(6).trim();if(!h||h==="[DONE]")continue;n("message",h)}}}}catch(r){console.error("SSE请求失败:",r),n("error",r.message||"sendToNodeSSE检测到异常")}},w=async({baseUrl:d,token:u,value:c,sessionId:o,callback:s})=>{const a={};return g({baseUrl:d,path:"/middleLayer/ai/varietyAiHelper",token:u,value:c,sessionId:o,origin:"web",getSSE:(r,t)=>{var m,i;switch(r){case"message":{try{const e=JSON.parse(t);if(e.type==="session"&&s("session",e.sessionId),e.type==="fullQuery"&&s("fullQuery",e.fullQuery),e.node_name&&e.node_status){const f=e.node_name,p=e.node_status==="success"?"success":"executing";a[f]!==p&&(a[f]=p,s("node",{name:f,status:p}))}((m=e.output)==null?void 0:m.finish_reason)==="stop"&&((i=e.output)!=null&&i.text)&&s("message",e.output.text),e.error&&s("error",e.error)}catch{}break}case"finish":{s("finish");break}case"error":{s("error",t);break}}}})},N=async({baseUrl:d,token:u,value:c,callback:o})=>g({baseUrl:d,path:"/middleLayer/ai/factorAiTest",token:u,value:c,origin:"web",getSSE:(a,n)=>{var r;switch(a){case"message":{try{const t=JSON.parse(n);t.output&&o("message",(r=t.output)==null?void 0:r.content),t.error&&o("error",t.error)}catch{}break}case"finish":{o("finish");break}case"error":{o("error",n);break}}}});exports.sendToNodeFactorAiTest=N;exports.sendToNodeVarietyAiHelper=w;
|