Prechádzať zdrojové kódy

fix:新建知识库和智能体后跳转到详情页

hanyang 1 rok pred
rodič
commit
9d09863502

+ 4 - 1
src/modules/Model/MessageBody.vue

@@ -29,7 +29,7 @@
               <div class="labels">{{ item.keyword }}</div>
             </template>
             <template #description>
-              {{ item.desc }}
+              <div class="desc">{{ item.desc }}</div>
             </template>
             <template #bottom>
               <a-button>
@@ -209,5 +209,8 @@ const showMoreModel = (item) => {
   .labels {
     color: var(--color-neutral-6);
   }
+  .desc {
+    font-size: 14px;
+  }
 }
 </style>

+ 0 - 1
src/modules/intelligent/ModalSelectIcon.vue

@@ -43,7 +43,6 @@ const props = defineProps({
 });
 const emit = defineEmits(['update:show_model_item', 'sendIcon']);
 const icons = ref(icons_intell);
-console.log(icons_intell, icons);
 // const icons = ref([
 //   {
 //     id: 1,

+ 5 - 0
src/modules/intelligent/ModelAddItem.vue

@@ -19,6 +19,7 @@
 
 <script setup>
 import { ref, computed } from 'vue';
+import { useRouter } from 'vue-router';
 import { createDify } from '../../apis/rgflow-dify';
 import { createDialog } from '../../apis/intelligent';
 import { dialogType } from '../../views/manage/common';
@@ -38,6 +39,8 @@ const props = defineProps({
     default: 'intellFrame1'
   }
 });
+const router = useRouter();
+
 const formInit = {
   name: '',
   description: ''
@@ -82,6 +85,8 @@ const createOwnDialog = async (data) => {
       handleCancel();
       emit('updateIntelligentList');
       Message.success('新建成功');
+      // 新建成功进入dify详情页
+      router.push({ path: '/intelligent/detail', query: { id: data.id, name: data.name, mode: data.mode } });
     } else {
       Message.error('新建失败');
     }

+ 2 - 3
src/modules/intelligent/TopSetting.vue

@@ -91,7 +91,7 @@ import {
   bus_intelligentSearch,
   bus_intelligentEdit,
   bus_intelligentIconEdit,
-  bus_intelligentLabelSync
+  bus_intelligentLabelSync,
 } from '../../base/event-bus';
 
 const router = useRouter();
@@ -169,7 +169,7 @@ const sendIcon = (icon) => {
     });
 };
 
-const updateIntelligentList = () => {
+const updateIntelligentList = (id) => {
   bus_intelligentSearch.emit('');
   target_icon.value = '';
 };
@@ -234,7 +234,6 @@ onUnmounted(() => {
   bus_intelligentEdit.off();
   bus_intelligentIconEdit.off();
   bus_intelligentLabelSync.off();
-  console.log(add_type, 99);
 });
 </script>
 <style scoped lang="css">

+ 10 - 3
src/modules/knowledge/MessageBody.vue

@@ -1,7 +1,13 @@
 <template>
   <div class="body-container" ref="body_container">
-    <CardItem v-for="item in moke_data" :key="item.id" :name="item.name" :img_src="item.img_src"
-      @click="handleToDetail(item)" @clickIcon="editIconHandle(item)">
+    <CardItem
+      v-for="item in moke_data"
+      :key="item.id"
+      :name="item.name"
+      :img_src="item.img_src"
+      @click="handleToDetail(item)"
+      @clickIcon="editIconHandle(item)"
+    >
       <template #bottom>
         <div class="bottom">
           <div>{{ item.count }}{{ $t('management.document') }}</div>
@@ -62,6 +68,7 @@ const scroll_bottom = ref(false);
 const search_text = ref('');
 
 const handleToDetail = (item) => {
+  console.log(router.getRoutes());
   router.push({
     path: '/knowledge/detail',
     query: {
@@ -91,7 +98,7 @@ const toRemove = (item) => {
         Message.error('没有权限');
       }
     },
-    onCancel: () => { }
+    onCancel: () => {}
   });
 };
 const deleteOwnKnow = async (id) => {

+ 11 - 0
src/modules/knowledge/ModalCreateKb.vue

@@ -20,6 +20,7 @@
 <script setup>
 import { ref, computed } from 'vue';
 import { Message } from '@arco-design/web-vue';
+import { useRouter } from 'vue-router';
 import { bus_knowledgeSearch } from '../../base/event-bus';
 import { createKb } from '../../apis/rgflow-dify';
 import { createOwnKnowledge } from '../../apis/knowledge';
@@ -39,6 +40,8 @@ const props = defineProps({
 
 const emit = defineEmits(['update:visible', 'select_icon']);
 
+const router = useRouter();
+
 const formInit = {
   name: '',
   description: '',
@@ -81,6 +84,14 @@ const createOwnKnowledgeBase = async (data) => {
       form.value = Object.assign({}, formInit);
       emit('update:visible', false);
       Message.success('创建成功');
+      // TODO 进入知识库详情页面
+      router.push({
+        path: '/knowledge/detail',
+        query: {
+          id: data.id,
+          name: data.name
+        }
+      });
     }
   } catch (error) {
     console.log('创建知识库失败', error);

+ 1 - 0
src/views/manage/CardItem.vue

@@ -94,6 +94,7 @@ const handleClickIcon = () => {
   bottom: 10px;
   left: 20px;
   width: calc(100% - 40px);
+  font-size: 12px;
 }
 .card-settings {
   position: absolute;