liyongli 2 years ago
parent
commit
735a8a0326
1 changed files with 6 additions and 6 deletions
  1. 6 6
      src/view/qh/index.vue

+ 6 - 6
src/view/qh/index.vue

@@ -155,7 +155,7 @@ const num1 = ref(0.7);
 const num2 = ref(0.95);
 let chatlist = ref([]);
 let session_hash = Math.random().toString(36).substring(2);
-
+let index = -1;
 function saveText() {
   load.value = true;
   nextTick(() => {
@@ -172,26 +172,26 @@ function saveText() {
     text: '',
     type: 'robot',
   });
-  //   const idnex = chatlist.value.length === 0 ? 0 : chatlist.value.length - 1;
   const t = inputText.value;
   inputText.value = '';
-  
-  if(chatlist.value.length > 5){
+
+  if (chatlist.value.length > 5) {
     chatlist.value.shift();
   }
+  index++;
   createSocket(ws => {
     const data = ws.data || {};
     if (data.msg == 'send_hash')
       ws.ws.send(
         JSON.stringify({
-          fn_index: 0,
+          fn_index: index,
           session_hash,
         })
       );
     if (data.msg == 'send_data')
       ws.ws.send(
         JSON.stringify({
-          fn_index: 0,
+          fn_index: index,
           data: [t, chatlist.value, num.value, num1.value, num2.value, null],
           event_data: null,
           session_hash,