chd hai 4 meses
pai
achega
a65c42d7c2

+ 1 - 1
.env

@@ -1,6 +1,6 @@
 VITE_OPENAI_API_KEY_TONG=sk-e9855234f47346049809ce23ed3ebe3f
 VITE_MAX_FILE_NUMBER=10
-VITE_APP_BASE_API='http://192.168.1.202:13088'
+VITE_APP_BASE_API='http://192.168.1.166:7777'
 
 # 接口地址 (WebSocket)
 VITE_API_WS_URL = 'ws://192.168.1.166:7777'

+ 149 - 224
src/entrypoints/sidepanel/Chat.vue

@@ -47,13 +47,16 @@
       <ScrollToBottom :target="scrollbar" ref="scrollToBottomRef" />
     </div>
 
-    <Tools @read-click="readClick" @upload-file="(file) => createFileObj(file)" @handle-capture="handleCapture" @his-records="hisRecords"
+    <Tools :upload="type === FunctionList.File_Operation || !!formInfo" @read-click="readClick" @upload-file="(file) => createFileObj(file)" @handle-capture="handleCapture" @his-records="hisRecords"
       @add-new-dialogue="addNewDialogue" @handle-current-change="handleCurrentChange"
       @handel-intelligent-filling-click="handelIntelligentFillingClick" />
 
     <div>
       <!-- 输入区域 -->
       <div class="input-area">
+          <el-icon class="closeShow" :style="{ display: isShowPage ? 'block' : 'none'}" size="16px" color="#909399" @click="closePageInfo">
+                <CircleClose />
+              </el-icon>
         <div v-show="isShowPage" style="border-bottom: 1px solid #F0F0F0;">
           <div class="card_list">
             <div v-for="(v, i) in pageInfoList" :key="i"
@@ -71,6 +74,7 @@
                 <CircleClose />
               </el-icon>
             </div>
+           <div v-show="!pageInfoList.length && type === FunctionList.Intelligent_Form_filling">智能填表</div>
           </div>
 
           <div class="card-btn">
@@ -113,11 +117,8 @@ import { ElScrollbar, ElAvatar, ElInput, ElButton } from 'element-plus'
 import moment from 'moment'
 import fileLogo from '@/assets/svg/file.svg'
 import {
-  buildExcelUnderstandingPrompt,
-  getSummaryPrompt,
   getFileContent,
   buildObjPrompt,
-  modelFileUpload,
   controllerList,
   formatMessage
 } from '@/entrypoints/sidepanel/utils/ai-service.js'
@@ -132,7 +133,7 @@ import ScrollToBottom from '@/entrypoints/sidepanel/component/ScrollToBottom.vue
 import formTable from '@/entrypoints/sidepanel/component/formTable.vue'
 import userAvatar from '@/assets/images/user.png'
 import avatar from '@/public/icon/32.png'
-import { mockData, startMsg, mockData2, options, FunctionList } from '@/entrypoints/sidepanel/mock'
+import {  options, FunctionList } from '@/entrypoints/sidepanel/mock'
 import { useAutoResizeTextarea } from '@/entrypoints/sidepanel/hook/useAutoResizeTextarea.ts'
 import { getPageInfo, getXlsxValue, handleInput } from './utils/index.js'
 import { useMsgStore } from '@/store/modules/msg.ts'
@@ -140,14 +141,10 @@ import { useUserStore } from '@/store/modules/user'
 import { putChat, uploadFile } from "@/api/index.js";
 import {askQues,getFormKey} from '@/api/modal.js'
 import { debounce } from 'lodash'
-import request from '@/utils/request'
-import  EventSourcePolyfill  from 'eventsource-polyfill';
 const userStore = useUserStore()
-import { getChatDetail } from '@/api/index.js'
 // 在其他状态变量附近添加
 const isLoadingMore = ref(false)
 import { v4 as uuidv4 } from 'uuid';
-import content from '../content.js'
 // 滚动条引用
 const scrollbar = ref(null)
 const scrollToBottomRef = ref(null)
@@ -163,9 +160,6 @@ const {
   taklToHtml,
   sendLoading,
   type,
-  streamRes,
-  getFormKeyAndValue,
-  requestFlowFn,
   fetchRes
 } = useMsg(scrollbar)
 const inputMessage = ref('')
@@ -259,7 +253,6 @@ async function addMessage(msg, raw, type) {
 const handleSummary = async () => {
   if(sendLoading.value) return
   handleAsk(`请帮我总结当前${summaryHtml.value ? '页面' : '文件'}`)
- 
   summaryHtml.value = false
 }
 const handleSummaryFile = async () => {
@@ -269,55 +262,42 @@ const handleSummaryFile = async () => {
    const  userMsg = await addMessage(JSON.stringify([...pageInfoList.value, { type: 'text', value: '抽取表单' }]), '抽取表单', 'document')
     userMsg.fileId = pageInfoList.value[0].fileId
     userMsg.redisKey = pageInfoList.value[0].redisKey
-    await putChat(userMsg)
-    const msg = reactive({
-    type: '',
-    rawContent: '',
-    senderId: -1,
-    receiverId: userStore.userInfo.id, //大模型
-    content: '',
-    sortKey: moment().valueOf(),
-    role: 'system',
-    conversationId: msgUuid.value,
-    })
-  messages.value.push(msg)
+   await putChat(userMsg)
+   createWS(userMsg)
+    formInfo.value = ''
+  //   const msg = reactive({
+  //   type: '',
+  //   rawContent: '',
+  //   senderId: -1,
+  //   receiverId: userStore.userInfo.id, //大模型
+  //   content: '',
+  //   sortKey: moment().valueOf(),
+  //   role: 'system',
+  //   conversationId: msgUuid.value,
+  //   })
+  // messages.value.push(msg)
      isShowPage.value = false
-  pageInfoList.value = []
-    const resForm = await askQues({
-    conversationId: msgUuid.value,
-    modelName: '通义千问-Max',
-    question: buildObjPrompt(xlsxData.value,formInfo.value),
-    id: '699637194561691650',
-    // redisKey:msg.redisKey
-    })
-  return console.log(resForm);
+      pageInfoList.value = []
+  //   const resForm = await askQues({
+  //   conversationId: msgUuid.value,
+  //   modelName: '通义千问-Max',
+  //   question: buildObjPrompt(xlsxData.value,formInfo.value),
+  //   id: '699637194561691650',
+  //   // redisKey:msg.redisKey
+  //   })
+  // return console.log(resForm);
   
-  const formResult = resForm.data[0].content
-    let form = null
-    if (formResult.includes('json')) form = JSON.parse(formResult.split('json')[1].split('```')[0])
-          else form = JSON.parse(formResult)
-  msg.type = 'form'
-  // 保存原始内容
-  msg.rawContent = formResult
-  putChat({
-    ...msg
-  })
-  sendLoading.value = false
-  handleInput(xlsxData.value, form)
-    nextTick(() => {
-    if (scrollbar.value && scrollbar.value.wrapRef) {
-      scrollbar.value.setScrollTop(scrollbar.value.wrapRef.scrollHeight)
-    }
-  })
+ 
  } catch (error) {
+  console.log(error);
   
  } finally {
-   sendLoading.value = false
-  type.value = FunctionList.File_Operation
+  //  sendLoading.value = false
+  // type.value = FunctionList.File_Operation
  }
 }
 async function handelIntelligentFillingClick() {
-  // isShowPage.value = true
+  isShowPage.value = true
   // taklToHtml.value = true
   // const tempPageInfo = await getPageInfo()
   // pageInfo.value = tempPageInfo
@@ -343,6 +323,7 @@ function handleCurrentChange(e) {
 
 async function handleCurrentData(e) {
   drawerRef.value.drawer = false
+  isShowPage.value = false
   if (!e) {
     addNewDialogue()
     return
@@ -358,7 +339,15 @@ async function handleCurrentData(e) {
   }
 })
 }
+let SystemMsg = null
 
+watchEffect(() => {
+  if (!isShowPage.value) {
+    summaryHtml.value = false
+    type.value = FunctionList.File_Operation
+    SystemMsg = null
+  }
+})
 async function readClick() {
   if (type.value === FunctionList.Intelligent_Form_filling) {
     pageInfoList.value = []
@@ -393,6 +382,8 @@ function addNewDialogue() {
     ElMessage.warning('已经是新对话')
     return
   }
+  summaryHtml.value = false
+  type.value = FunctionList.File_Operation
   isShowPage.value = false
   taklToHtml.value = false
   messages.value = []
@@ -403,18 +394,26 @@ function addNewDialogue() {
   chrome.storage.local.set({ msgUuid: msgUuid.value })
 }
 const disabledBtn = computed(() => {
-  console.log(pageInfoList.value);
-  
  return  !!(pageInfoList.value.find(_ => _.loading ))
 })
+function closePageInfo() {
+  pageInfoList.value = []
+  type.value = FunctionList.File_Operation
+  isShowPage.value = false
+  formInfo.value = null
+}
 async function handleAsk(value) {
   const str = value ?? inputMessage.value.trim()
   inputMessage.value = ''
   if (type.value === FunctionList.Intelligent_Form_filling) {
-     await addMessage(str)
-     const res = await fetchRes(str)
+    const msg = await addMessage(str)
+    await putChat(msg)
+     const [res,obj] = await fetchRes(str)
     if (res.status === 'ok') {
+      console.log(obj);
+      
       formInfo.value = res.data
+      SystemMsg = obj
     } else {
       type.value = FunctionList.File_Operation
     }
@@ -430,9 +429,17 @@ async function handleAsk(value) {
    pageInfoList.value = []
   isShowPage.value = false
   await putChat(msg)
-  sendLoading.value = true
+  createWS(msg)
+}
+/**
+ * 
+ * @param msg 用户消息对象,调用askQues时需要
+ */
+function createWS(msg) {
+  try {
+    sendLoading.value = true
   const obj = reactive({
-    type: type || '',
+    type: type.value === FunctionList.Intelligent_Form_filling ? 'form' : '',
     rawContent: '',
     senderId: -1,
     receiverId: userStore.userInfo.id, //大模型
@@ -447,172 +454,74 @@ async function handleAsk(value) {
       scrollbar.value.setScrollTop(scrollbar.value.wrapRef.scrollHeight)
     }
   })
-  // request.post('/ai/model/question',{
-  //   conversationId: msgUuid.value,
-  //   modelName: '通义千问-Max',
-  //   question: msg.rawContent,
-  //   id: '699637194561691650',
-  //   // redisKey:msg.redisKey
-  //   }, {
-  //   onDownloadProgress: progressEvent => {
-  //     console.log('progressEvent', progressEvent)
-  //     let { responseText } = progressEvent.event.target
-  //     const newData = responseText.slice(buffer.length)
-  //     buffer += newData
-  //     // const events = buffer.split('\n\n')
-  //     const events = buffer.split('\n\n').map(item => {
-  //       const data = item.replace(/^data: /, '').trim()
-  //       // return data
-  //       try {
-  //         return JSON.parse(data)
-  //       } catch (error) {
-  //         return ''
-  //       }
-  //     })
-  //     debugger
-  //     buffer = events.pop() // 剩余部分保留到下一次
-  //     // events.forEach(event => {
-  //     //   if (event.trim()) {
-  //     //     const data = event.replace(/^data: /, '').trim();
-  //     //     const infoData = JSON.parse(data);
-  //     //     console.log('Received event:', infoData.message);
-  //     //   }
-  //     // });
-  //     console.log('Received data:', events, 'aaa', buffer)
-  //   }
-  // })
-  // 使用 WebSocket 替代 EventSource
-  try {
-    // 创建 WebSocket 连接
-
-    const res =  await askQues({
+   const wsUrl = `${import.meta.env.VITE_API_WS_URL}/webSocket/clue/${msgUuid.value}`;
+    const socket = new WebSocket(wsUrl);
+     askQues({
     conversationId: msgUuid.value,
     modelName: '通义千问-Max',
-    question: msg.rawContent,
+    question: type.value === FunctionList.File_Operation ? msg.rawContent : buildObjPrompt(xlsxData.value,formInfo.value),
     id: '699637194561691650',
     redisKey:msg.redisKey
     })
-        const   eventSource = new EventSource(`${import.meta.env.VITE_APP_BASE_API}/ai/model/createSse?uid=${msgUuid.value}`);
-        eventSource.onopen = function (event) {
-            console.log('SSE链接成功');
-        }
-    eventSource.onmessage = function (event) {
-          console.log(event);
+    socket.onmessage = (event) => {
+      try {
+        if (event.data === '') {
+          socket.close()
+          if (type.value === FunctionList.Intelligent_Form_filling) {
+       const formResult = obj.rawContent
+    let form = null
+    if (formResult.includes('json')) form = JSON.parse(formResult.split('json')[1].split('```')[0])
+          else form = JSON.parse(formResult)
+        sendLoading.value = false
+  console.log(xlsxData.value, form);
+  
+  handleInput(xlsxData.value, form)
+    }
+        } else {
+          obj.rawContent += event.data;
+          console.log( obj.rawContent );
           
-            if(event.data){
-                chat.innerHTML += event.data + '<br/>';
-                //console.log('后端返回的数据:', data.value);
+          obj.content = obj.type === 'form' ? obj.rawContent :  formatMessage(obj.rawContent);
+          // 滚动到底部
+          nextTick(() => {
+            if (scrollbar.value && scrollbar.value.wrapRef) {
+              scrollbar.value.setScrollTop(scrollbar.value.wrapRef.scrollHeight);
             }
+          });
         }
-        eventSource.onerror = (error) => {
-            console.log('SSE链接失败',error);
-        };
-    //  obj.content = formatMessage(res.data[res.data.length - 1].content)
-    // obj.rawContent = res.data[res.data.length - 1].content;
-    // const wsUrl = `${import.meta.env.VITE_API_WS_URL}/webSocket/${msgUuid.value}`;
-    // console.log(wsUrl,12312);
-    
-    // const socket = new WebSocket(wsUrl);
-    // // 连接建立时发送消息
-    // socket.onopen = () => {
-    //   console.log('WebSocket 连接已建立');
-    //   // 发送请求数据
-    //   socket.send(JSON.stringify({
-    //  session:msgUuid.value
-    //   }));
-    // };
-    
-    // 接收消息
-    // socket.onmessage = (event) => {
-    //   try {
-    //     console.log('收到数据:', event);
-
-    //     // const data = JSON.parse(event.data);
-    //     // console.log('收到数据:', data);
-    //     return
-    //     // 追加内容
-    //     if (data.content) {
-    //       obj.content += data.content;
-    //       obj.rawContent += data.content;
-          
-    //       // 滚动到底部
-    //       nextTick(() => {
-    //         if (scrollbar.value && scrollbar.value.wrapRef) {
-    //           scrollbar.value.setScrollTop(scrollbar.value.wrapRef.scrollHeight);
-    //         }
-    //       });
-    //     }
-        
-    //     // 如果是最后一条消息,关闭连接
-    //     if (data.done) {
-    //       socket.close();
-    //       sendLoading.value = false;
-          
-    //       // 保存到数据库
-    //       putChat({
-    //         ...obj,
-    //         content: obj.content
-    //       });
-          
-    //       isShowPage.value = false;
-    //       pageInfoList.value = [];
-    //     }
-    //   } catch (error) {
-    //     console.error('解析消息出错:', error);
-    //   }
-    // };
-    
-    // 处理错误
-    // socket.onerror = (error) => {
-    //   console.error('WebSocket 错误:', error);
-    //   socket.close();
-    //   sendLoading.value = false;
-      
-    //   // 如果没有收到任何内容,显示错误消息
-    //   if (!obj.content) {
-    //     obj.content = '连接出错,请重试';
-    //     // 保存到数据库
-    //     putChat({
-    //       ...obj,
-    //       content: obj.content
-    //     });
-    //   }
-    // };
-    
-    // // 连接关闭
-    // socket.onclose = () => {
-    //   console.log('WebSocket 连接已关闭');
-    //   sendLoading.value = false;
-    // };
-    
-    // // 添加到控制器列表,以便可以在需要时中断连接
-    // controllerList.value.push({
-    //   abort: () => {
-    //     socket.close();
-    //   }
-    // });
+      } catch (error) {
+        console.error('解析消息出错:', error);
+      }
+    };
+    socket.onerror = (error) => {
+      console.error('WebSocket 错误:', error);
+      socket.close();
+    };
+    socket.onclose = () => {
+      console.log('WebSocket 连接已关闭');
+      sendLoading.value = false;
+      putChat({
+      ...obj,
+      content:''
+     });
+      sendLoading.value = false
+      controllerList.value = []
+     type.value = FunctionList.File_Operation
+    };
+    // 添加到控制器列表,以便可以在需要时中断连接
+    controllerList.value.push({
+      abort: () => {
+        socket.close();
+      }
+    });
   } catch (error) {
-    // console.error('创建 WebSocket 失败:', error);
+    console.error( error);
     sendLoading.value = false;
-    console.log(error);
-    
     // 显示错误消息
     obj.content = '连接失败,请重试';
-    
-    // 保存到数据库
-   
   } finally {
-     putChat({
-      ...obj,
-      content:''
-     });
-    sendLoading.value = false
+     
   }
-  
-  // 移除原有的 EventSource 代码
-  // const params = new URLSearchParams({...});
-  // const eventSource = new EventSource(...);
-  // ...
 }
 function handleCapture() {
   ElMessage({
@@ -654,20 +563,25 @@ const handleUpload = async (file) => {
     obj.redisKey = res.data.redisKey
     obj.id = res.data.file.id
     obj.url = res.data.file.url
-    const fileExtension = file.name.split('.').pop().toLowerCase()
-    if (fileExtension === 'xlsx') {
-          const readData = await getXlsxValue(file)
-      readData[0].forEach((header, i) => {
-        // if (!xlsxData.value[header]) xlsxData.value[header] = []
-        xlsxData.value[header] = readData[1][i]
-      })
-    } else {
-         const result = await getFormKey({
+    // const fileExtension = file.name.split('.').pop().toLowerCase()
+     const result = await getFormKey({
       body: formInfo.value,
       input_data:res.data.data
     })
     xlsxData.value = JSON.parse(result.data)
-      }
+    // if (fileExtension === 'xlsx') {
+    //       const readData = await getXlsxValue(file)
+    //   readData[0].forEach((header, i) => {
+    //     // if (!xlsxData.value[header]) xlsxData.value[header] = []
+    //     xlsxData.value[header] = readData[1][i]
+    //   })
+    // } else {
+    //      const result = await getFormKey({
+    //   body: formInfo.value,
+    //   input_data:res.data.data
+    // })
+    // xlsxData.value = JSON.parse(result.data)
+    //   }
     }
  
    nextTick(() => {
@@ -682,13 +596,24 @@ const handleUpload = async (file) => {
     obj.fileId = res.data.file.id
     obj.url = res.data.file.url
     }
-  obj.loading = false
+    obj.loading = false
+  console.log(SystemMsg);
+  
   } catch (error) {
+    if (SystemMsg) {
+      SystemMsg.content = '数据上传出错,请重试'
+      SystemMsg.rawContent = '数据上传出错,请重试'
+    }
     console.log(error);
-    
     ElMessage.error('上传出错')
     pageInfoList.value = []
     isShowPage.value = false
+  } finally {
+      SystemMsg && putChat({
+        ...SystemMsg,
+        content: '',
+      })
+    SystemMsg = null
   }
 }
 async function getFileValue(file) {

+ 9 - 7
src/entrypoints/sidepanel/component/formTable.vue

@@ -10,12 +10,14 @@ const props = defineProps({
 })
 const show = ref(false)
 const tableData = computed(() => {
-  let arr = []
-  if (props.content.includes('json')) {
-    arr = JSON.parse(props.content.split('json')[1].split('```')[0])
-  }
-  else arr = JSON.parse(props.content)
-  if (arr[0].data) show.value = true
+  const startIndex = props.content.indexOf('{');
+const endIndex = props.content.lastIndexOf('}');
+
+// 2. 截取有效内容
+const jsonSlice = props.content.slice(startIndex, endIndex + 1);
+  let str = '[' + jsonSlice + ']'
+  const arr = JSON.parse(str)
+  if (arr[0]?.data) show.value = true
   return arr.map((_:any) => ({
     label: !!_.label ?_.label : _.findByValue,
     source: _.excelColumn,
@@ -27,7 +29,7 @@ const tableData = computed(() => {
 <template>
   <div>
     <div class="mb-2" >抽取对应关系</div>
-  <el-table :data="tableData" style="width: 100%">
+  <el-table v-if="tableData.length" :data="tableData" style="width: 100%">
     <el-table-column show-overflow-tooltip prop="label" label="表单项" width="100" />
     <el-table-column show-overflow-tooltip prop="source" label="数据源" width="100" />
     <el-table-column v-if="show" show-overflow-tooltip prop="value" label="数据值" width="100" />

+ 16 - 3
src/entrypoints/sidepanel/component/tools.vue

@@ -4,6 +4,7 @@ import { storeToRefs } from 'pinia'
 import { options } from '@/entrypoints/sidepanel/mock'
 import { Reading, Upload, Paperclip, Scissor, AlarmClock, CirclePlus, Edit } from '@element-plus/icons-vue'
 import { useMsgStore } from '@/store/modules/msg'
+import { ElMessage } from 'element-plus'
 
 const { AIModel } = storeToRefs(useMsgStore())
 const selectInput = ref(null)
@@ -12,7 +13,19 @@ const emit = defineEmits(['readClick', 'uploadFile', 'handleCapture', 'addNewDia
 watchEffect(() => {
   selectInput.value = AIModel.value?.value
 })
+const handleUpload = (e) => {
+  if (!props.upload) {
+   e.stopPropagation()
+    ElMessage.warning('智能填表需要先发送指令,再上传文件')
+  }
+  
+}
+const props = defineProps({
+  upload: {
+    type: Boolean,
+  },
 
+})
 </script>
 
 <template>
@@ -30,15 +43,15 @@ watchEffect(() => {
       <el-upload style="display:inline-block" :before-upload="(file: any) => emit('uploadFile', file)" :multiple="false"
         name="file" :show-file-list="false" :accept="'.xlsx,.pdf,.doc,.docx'">
         <el-tooltip effect="dark" content="文件上传" placement="top">
-          <el-button class="tools_btn" link :icon="Paperclip" />
+          <el-button class="tools_btn" link :icon="Paperclip" @click="handleUpload"/>
         </el-tooltip>
       </el-upload>
       <!-- <el-tooltip effect="dark" content="截屏" placement="top">
         <el-button class="tools_btn" link :icon="Scissor" @click="emit('handleCapture')" />
       </el-tooltip> -->
-      <!-- <el-tooltip effect="dark" content="智能填表:选择后,在输入框描述填表流程" placement="top">
+      <el-tooltip effect="dark" content="智能填表:选择后,在输入框描述填表流程" placement="top">
         <el-button class="tools_btn" link :icon="Edit" @click="emit('handelIntelligentFillingClick')" />
-      </el-tooltip> -->
+      </el-tooltip>
 
     </div>
     <div class="flex items-center">

+ 12 - 2
src/entrypoints/sidepanel/css/chat.scss

@@ -215,7 +215,7 @@
   border: 1px solid rgba(102, 102, 102, 0.3);
   border-radius: 16px;
   margin: 0 12px 12px;
-
+position: relative;
   .card_list {
     display: flex;
     flex-wrap: nowrap;
@@ -269,6 +269,7 @@
 
     .closeIcon {
       display: none;
+      cursor: pointer;
       position: absolute;
       right: -5px;
       top: -5px;
@@ -277,7 +278,16 @@
       z-index: 1;
     }
   }
-
+    .closeShow {
+      display: none;
+      position: absolute;
+      right: -5px;
+      top: -5px;
+      background-color: #ffffff;
+      border-radius: 50%;
+      z-index: 1;
+      cursor: pointer;
+    }
   .card-content:hover {
     .closeIcon {
       display: block;

+ 11 - 6
src/entrypoints/sidepanel/hook/useMsg.ts

@@ -80,10 +80,12 @@ export function useMsg(scrollbar?: any) {
         ({ status, data }) => {
           if (status === 'error') {
             obj.content = '当前页面未找到表单'
+            obj.rawContent = '当前页面未找到表单'
             res({ status })
           }
           if (status === 'ok') {
             obj.content = '请上传数据'
+            obj.rawContent = '请上传数据'
             res({ status, data })
           }
           if (status === 'select') {
@@ -93,7 +95,7 @@ export function useMsg(scrollbar?: any) {
                 console.log('收到一次性消息:', message.data)
                 res({ status: 'ok', data: message.data })
                 obj.content = '请上传数据'
-                console.log(565656)
+                obj.rawContent = '请上传数据'
                 // 销毁监听器(确保只触发一次)
                 chrome.runtime.onMessage.removeListener(handle)
               }
@@ -130,7 +132,7 @@ export function useMsg(scrollbar?: any) {
     if (!msg) {
       sendLoading.value = false
       const res = await awaitFindForm(obj)
-      return res
+      return [res,obj]
     }
     try {
       const res = await fetchDataAndProcess(msg, obj)
@@ -142,12 +144,15 @@ export function useMsg(scrollbar?: any) {
           }, 2000)
         )
         const res = await awaitFindForm(obj)
-        console.log(res, 34444)
-        return res
+        return [res, obj]
       }
     } catch (error) {
-      obj.content = '流程链执行出错'
-      return { status: 'error' }
+      obj.content = '流程链执行出错,请重试'
+      putChat({
+        ...msg,
+        content: '',
+      })
+      return [{ status: 'error' }]
     } finally {
       sendLoading.value = false
       console.log(messages.value);