yinbangzhong
2024-08-24 2627bea177b22bc803926bba5a29518bfb6ee0eb
bug fix
2个文件已修改
1个文件已删除
215 ■■■■■ 已修改文件
src/store/modules/user/index.ts 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/authority/role/index.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sessionManager/index.vue 85 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/user/index.ts
File was deleted
src/views/authority/role/index.vue
@@ -285,7 +285,7 @@
  import Authheader from '@/views/authority/components/authheader.vue';
  import router from "@/router";
  import { queryCanvasList } from "@/api/Agent";
  import { getUserResources } from "@/utils/auth";
  import { getUserInfo, getUserResources } from "@/utils/auth";
  import { forEach } from "lodash";
  let treeDataMenu = ref([]);
@@ -597,6 +597,7 @@
      checkStrictlyKnowledge.value = [];
      checkedKeysKnowledge.value = [];
      checkStrictlyDialog.value = [];
      checkStrictlyAgent.value = [];
      checkedKeysDialog.value = [];
      selectRole.value = record;
      if (record.resources) {
@@ -694,8 +695,11 @@
  const MenuData = async (key) => {
    await ResourceList(key).then((res) => {
      let newTree=[]
      removeChild(res.rows,newTree)
      let newTree = [];
      let u =JSON.parse(getUserInfo());
      if (u.role != "admin") {
        removeChild(res.rows, newTree);
      }
      treeDataMenu.value = [...res.rows];
    });
  };
src/views/sessionManager/index.vue
@@ -92,25 +92,40 @@
                  />
                </template>
                <template #content>
                  <!--                  <a-card :class="{ chatItemAnswer: theme === 'light' }">-->
                  <!--                    <div-->
                  <!--                      :class="{ light: theme === 'light' }"-->
                  <!--                      v-html="sessionDetail.content.replace(/\n/g, '<br/>')"-->
                  <!--                    >-->
                  <!--                    </div>-->
                  <!--                  </a-card>-->
                  <a-textarea
                    readonly
                    auto-size
                    v-model="sessionDetail.content"
                    :class="{ chatItemAnswer: theme === 'light' }"
                  <a-card v-if="isExistTip(sessionDetail.content)">
                    <div  :class="{ chatItemAnswer: theme === 'light' }"
                      :style="{backgroundColor: theme === 'light' ? '#ffffff' : '#000000'}" style="border: none;display: inline;"  v-for="(item,tipIndex) in tipMatch(sessionDetail)"
                    >
                      <span v-if="tipIndex == 0">
                        {{ sessionDetail.content.substring(0, item.index) }}
                        <a-tooltip background-color="#3491FA" :content="getTipContent(
                          messagenList.reference,
                          index
                        )">
                          <img style="width: 20px;height: 20px" :src="tipImage" />
                        </a-tooltip>
                      </span>
                      <span v-else>
                        {{ sessionDetail.content.substring(item.preIndex+item.item.length, item.index) }}
                        <a-tooltip background-color="#3491FA" :content="getTipContent(
                          messagenList.reference,
                          index
                        )">
                          <img style="width: 20px;height: 20px" :src="tipImage" />
                        </a-tooltip>
                      </span>
                    </div>
                  </a-card>
                  <a-card  v-else>
                    <div :class="{ chatItemAnswer: theme === 'light' }"
                    :style="{
                      backgroundColor:
                        theme === 'light' ? '#ffffff' : '#000000',
                    }"
                    style="border: none"
                  >
                  </a-textarea>
                    }" style="border: none">
                      {{ sessionDetail.content }}
                    </div>
                  </a-card>
                </template>
                <!-- <div>{{ sessionDetail.role === 'assistant' }}</div> -->
                <template #actions>
@@ -407,6 +422,8 @@
  import pdfImg3 from '@/assets/session/execl.png';
  import pdfImg4 from '@/assets/session/icon-txt.png';
  import pdfImg5 from '@/assets/session/txt.png';
  import tipImage from '@/assets/session/tip.png';
  import { number } from "@intlify/core-base";
  // const url = ref('../../assets/session/PDF.png');
@@ -476,8 +493,28 @@
    }
  };
  let dataItem = [];
  const getTxt = (data, role, message, index) => {
  const isExistTip=(message:string):boolean=>{
    if (/##[0-9]\$\$/.test(message)) {
      return true;
    } else {
      return false;
    }
  }
  const tipMatch = (session: any): any[] => {
    //match session.content中的##[0-9]$$的索引
    let indexs: any[] = [];
    let preTip=0;
    session.content.match(/##([0-9]+)\$\$/g)?.map((item) => {
      let i = session.content.indexOf(item);
      indexs.push({ index: i, item: item, preIndex: preTip });
      preTip = i;
    });
    return indexs;
  }
  const getTxt = (data, role, message, index) => {
    if (isExistTip(message)) {
      if (role == 'assistant' && index) {
        let i = index / 2 - 1 > 0 ? index / 2 - 1 : 0;
        dataItem = data[i].doc_aggs;
@@ -489,6 +526,20 @@
    return dataItem;
  };
  const getTipContent = (data, index): string => {
    let maxSimilarityContent = "";
    let i = index / 2 - 1 > 0 ? index / 2 - 1 : 0;
    let maxSimilarity = 0;
    data[i].chunks.forEach((chunk) => {
        if (chunk.similarity > maxSimilarity) {
          maxSimilarity = chunk.similarity;
          maxSimilarityContent = chunk.content_with_weight;
        }
      }
    );
    return maxSimilarityContent;
  };
  const clickHref = (item) => {
    // return Message.warning('暂无法查看');
    // window.open(`/api/v1/document/get/${item.doc_id}`, '_blank');