znw@123! 1 月之前
父節點
當前提交
68d2dfcc22
共有 3 個文件被更改,包括 15183 次插入37 次删除
  1. 15140 1
      package-lock.json
  2. 36 33
      src/views/home/dataChartEditChat.vue
  3. 7 3
      src/views/home/homeSide.vue

文件差異過大導致無法顯示
+ 15140 - 1
package-lock.json


+ 36 - 33
src/views/home/dataChartEditChat.vue

@@ -210,7 +210,7 @@
             <v-icon>mdi-send</v-icon>
           </v-btn>
         </div>
-        <div v-if="!react">
+        <!-- <div v-if="!react">
           <v-chip-group
             active-class="primary--text"
             column
@@ -225,7 +225,7 @@
               {{ chip.text }}
             </v-chip>
           </v-chip-group>
-        </div>
+        </div> -->
       </div>
     </div>
   </div>
@@ -247,11 +247,11 @@ export default {
   },
   data () {
     return {
-      routingMode: undefined,
-      chips: [
-        { text: '聊天模式', value: 'chat_direct' },
-        { text: '数据库模式', value: 'database_direct' }
-      ],
+      // routingMode: undefined,
+      // chips: [
+      //   { text: '聊天模式', value: 'chat_direct' },
+      //   { text: '数据库模式', value: 'database_direct' }
+      // ],
       loading: false,
       disabled: false,
       question: '',
@@ -303,18 +303,17 @@ export default {
       return new Promise((resolve, reject) => {
         // 先关闭现有连接
         this.stopSSE()
-        const query = this.react
-          ? {
-              question: encodeURIComponent(ask.question),
-              user_id: this.userInfo.id,
-              conversation_id: this.conversationId
-            }
-          : {
-              question: encodeURIComponent(ask.question),
-              user_id: this.userInfo.id,
-              routing_mode: this.routingMode,
-              conversation_id: this.conversationId
-            }
+        const query = {
+          question: encodeURIComponent(ask.question),
+          user_id: this.userInfo.id,
+          conversation_id: this.conversationId
+        }
+        // : {
+        //     question: encodeURIComponent(ask.question),
+        //     user_id: this.userInfo.id,
+        //     // routing_mode: this.routingMode,
+        //     conversation_id: this.conversationId
+        //   }
         const queryStr = Object.keys(query).reduce((acc, key) => {
           if (query[key] === undefined) {
             return acc
@@ -464,24 +463,28 @@ export default {
         this.abortController = null
       }
       this.items.splice(1, this.items.length - 1, ...data.messages.map(e => {
-        if (e.role === 'user') {
+        if (e.role === 'assistant' || e.role === 'ai') {
+          if (!this.react) {
+            e.metadata.response = e.content
+          }
+
           return {
-            type: 2,
-            user: '游客',
-            content: e.content
+            type: 1,
+            content: this.react ? e.content : e.metadata,
+            showSnackbar: false,
+            dataValidation: false,
+            question: e.content, // 记录当前问题
+            showMenu: false,
+            model: {
+              dataAxis: null,
+              typeAxis: null
+            }
           }
         }
         return {
-          type: 1,
-          content: e.metadata,
-          showSnackbar: false,
-          dataValidation: false,
-          question: e.content, // 记录当前问题
-          showMenu: false,
-          model: {
-            dataAxis: null,
-            typeAxis: null
-          }
+          type: 2,
+          user: '游客',
+          content: e.content
         }
       }))
     }

+ 7 - 3
src/views/home/homeSide.vue

@@ -45,15 +45,16 @@
             v-for="(item, index) in fabItems"
             :key="index"
           >
-            <v-btn fab :color="item.color" x-small depressed @click="$router.push(item.to)">
+            <v-btn  disabled light fab :color="item.color" x-small depressed @click="$router.push(item.to)">
               <v-icon>{{ item.icon }}</v-icon>
             </v-btn>
-            <div class="text-caption" :class="item.textColor">
+            <div class="text-caption" >
+            <!-- <div class="text-caption" :class="item.textColor"> -->
               {{ item.text }}
             </div>
           </div>
         </div>
-        <v-btn class="mb-3" color="indigo" block @click="$router.push('/my-chart')">
+        <v-btn class="mb-3" light color="indigo" block @click="$router.push('/my-chart')" disabled>
           我的图表
         </v-btn>
         <v-btn class="mb-3" block color="indigo" @click="handleReact">
@@ -123,12 +124,15 @@ export default {
         return
       }
       this.lastSelected = index
+      this.loading = true
       try {
         const getApi = this.react ? getConversationsByIdThroughReact : getConversationsById
         const { data } = await getApi(this.conversationList[index].conversation_id)
         this.$emit('update', data)
       } catch (error) {
         this.$snackbar.error(error)
+      } finally {
+        this.loading = false
       }
     },
 

部分文件因文件數量過多而無法顯示