songxy 2 miesięcy temu
rodzic
commit
e8873602a7

+ 23 - 5
ais_search_zj/web/src/views/ai-search/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="home_box">
     <div class="left_box">
-      <button>
+      <button @click="startNewSessionHandle">
         <span class="icon"></span>
         <span>开启新对话</span>
       </button>
@@ -68,7 +68,10 @@
     </div>
     <div class="right_box">
       <div class="chat-container">
-        <div class="messages-container" ref="msgContainer">
+        <div v-if="historys.length === 0" class="messages-container">
+          <p class="n_tips">Hi~,我是自然资源大模型,您身边的智能助手!</p>
+        </div>
+        <div v-else class="messages-container" ref="msgContainer">
           <template v-for="(history,index) in historys" :key="index">
             <div class="message user">
               {{ history.question }}
@@ -469,6 +472,13 @@ function scrollToBottom() {
 const historys = ref([])
 let historyIndex = -1;
 const cQuestion = ref('')
+
+const startNewSessionHandle = () => {
+  cQuestion.value = ''
+  historys.value = []
+  historyIndex = -1
+}
+
 const onKeydownHandle = (e) => {
     if (e.key === 'Enter' && !e.shiftKey) {
       e.preventDefault();
@@ -534,7 +544,7 @@ watch(props.searchType, (val) => {
 const question = ref('国有土地的使用方式有哪些?');
 const statusText = ref('检索中');
 const activeIndex = ref(0);
-const activeTab = ref(props.searchType);
+const activeTab = ref('knowledge');
 let ctr = null;
 
 const evaluate = ref(null);
@@ -797,7 +807,8 @@ const quest = async (isFllow) => {
         activeIndex.value = 5;
       }
     },
-    onerror(err) {
+    onerror (err) {
+      historys.value[historyIndex].currentResponse.loading = false
       throw err;
     }
   });
@@ -1314,6 +1325,12 @@ defineExpose({ changeActiveTab, stopAI });
 .home_box {
   height: 100%;
   display: flex;
+  .n_tips {
+    font-size: 20px;
+    text-align: center;
+    padding-top: 50px;
+    color: rgba(0,0,0,0.8);
+  }
   >div {
     height: 100%;
     &.left_box {
@@ -1329,6 +1346,7 @@ defineExpose({ changeActiveTab, stopAI });
         color: #3A81EF;
         padding: 10px;
         margin-bottom: 10px;
+        cursor: pointer;
       }
       >div {
         >.menu_down {
@@ -1423,7 +1441,7 @@ defineExpose({ changeActiveTab, stopAI });
             flex-direction: column;
             gap: 12px;
             flex: 1;
-            padding: 15px 0px;
+            padding: 30px 0px;
         }
 
         .message {

+ 6 - 6
ais_search_zj/web/src/views/home/index.vue

@@ -39,18 +39,18 @@ const menuRoutes = [
     name: 'Znxz',
     iframe: true
   },
-  {
-    title: '智能找图',
-    icon: 'icon-map',
-    name: 'Znzt',
-    window: true
-  },
   {
     title: '找图找数',
     icon: 'icon-zhengcefagui',
     name: 'Ztzs',
     iframe: true
   },
+  {
+    title: '智能找图',
+    icon: 'icon-map',
+    name: 'Znzt',
+    window: true
+  },
   {
     title: '知识库',
     icon: 'icon-66zhishikuguanli',