liyongli 2 years ago
parent
commit
f5a58c7bef
1 changed files with 23 additions and 7 deletions
  1. 23 7
      src/view/qh/index.vue

+ 23 - 7
src/view/qh/index.vue

@@ -1,10 +1,26 @@
 <template>
-  <h2 style="text-align: center; margin: 18px 0;font-size: 25px;font-family: 'Source Sans Pro', 'ui-sans-serif', 'system-ui', sans-serif;">ChatGLM</h2>
+  <h2
+    style="
+      text-align: center;
+      margin: 18px 0;
+      font-size: 25px;
+      font-family: 'Source Sans Pro', 'ui-sans-serif', 'system-ui', sans-serif;
+    "
+  >
+    ChatGLM
+  </h2>
   <div class="chatbg tool">
     <div
-      style="float: left; font-size: 12px;padding: 4px 8px;border-right: 1px solid #e5e7eb;border-bottom: 1px solid #e5e7eb;border-bottom-right-radius: 7px;"
+      style="
+        float: left;
+        font-size: 12px;
+        padding: 4px 8px;
+        border-right: 1px solid #e5e7eb;
+        border-bottom: 1px solid #e5e7eb;
+        border-bottom-right-radius: 7px;
+      "
     >
-        <el-icon><ChatDotRound /></el-icon>
+      <el-icon><ChatDotRound /></el-icon>
       Chatbot
     </div>
     <div style="clear: both"></div>
@@ -155,23 +171,23 @@ function saveText() {
     text: '',
     type: 'robot',
   });
-  const idnex = chatlist.value.length === 0 ? 0 : chatlist.value.length - 1;
+  //   const idnex = chatlist.value.length === 0 ? 0 : chatlist.value.length - 1;
   const t = inputText.value;
   inputText.value = '';
+  let session_hash = Math.random().toString(36).substring(2);
   createSocket(ws => {
     const data = ws.data || {};
-    let session_hash = Math.random().toString(36).substring(2);
     if (data.msg == 'send_hash')
       ws.ws.send(
         JSON.stringify({
-          fn_index: idnex,
+          fn_index: 0,
           session_hash,
         })
       );
     if (data.msg == 'send_data')
       ws.ws.send(
         JSON.stringify({
-          fn_index: idnex,
+          fn_index: 0,
           data: [t, chatlist.value, num.value, num1.value, num2.value, null],
           event_data: null,
           session_hash,