st-comp 0.0.275 → 0.0.276

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "st-comp",
3
3
  "public": true,
4
- "version": "0.0.275",
4
+ "version": "0.0.276",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -26,6 +26,7 @@ const messageList = ref([
26
26
  {
27
27
  role: "defaultMessage", // defaultMessage-组件内置, assistant-智能体, user-用户
28
28
  content: props.defaultMessage,
29
+ fullQuery: "",
29
30
  userContent: null,
30
31
  showFeedback: false,
31
32
  createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
@@ -71,6 +72,7 @@ const sendMessage = async () => {
71
72
  messageList.value.push({
72
73
  role: "assistant",
73
74
  content: "",
75
+ fullQuery: "",
74
76
  userContent: content,
75
77
  showFeedback: false,
76
78
  createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
@@ -96,6 +98,11 @@ const sendMessage = async () => {
96
98
  if (type === "session") {
97
99
  sessionId.value = data;
98
100
  }
101
+ if (type === "fullQuery") {
102
+ const lastMessage = messageList.value[messageList.value.length - 1];
103
+ lastMessage.fullQuery = data;
104
+ console.log(data);
105
+ }
99
106
  if (type === "node") {
100
107
  if (!firstNodeReceived) {
101
108
  firstNodeReceived = true;
@@ -346,6 +353,7 @@ defineExpose({
346
353
  </div>
347
354
  <!-- 响应 -->
348
355
  <div class="message-content">
356
+ <div v-if="message.fullQuery" style="font-weight: bold; margin-bottom: 10px;">筛选结果: {{ message.fullQuery }}</div>
349
357
  <!-- 节点展示 -->
350
358
  <div
351
359
  v-if="index === messageList.length - 1 && message.role === 'assistant' && nodeProgressList.length > 0 && !showFinalResult"
@@ -679,6 +687,7 @@ defineExpose({
679
687
  }
680
688
  }
681
689
  .confirm-btn {
690
+ margin-left: auto;
682
691
  margin-top: 8px;
683
692
  padding: 6px 20px;
684
693
  font-size: 13px;
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 === "fullQuery") {
94
+ callback("fullQuery", data.fullQuery);
95
+ }
92
96
  // 节点状态
93
97
  if (data.node_name && data.node_status) {
94
98
  const nodeName = data.node_name;
@@ -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;