zhangxiao
2024-08-29 234c222e4fd9d24242440e0207bd5ccfa1bac471
fix: 审计
7个文件已修改
566 ■■■■ 已修改文件
npminstall-debug.log 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/agentSession.ts 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sessionManager/components/chatMenu.vue 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sessionManager/components/seniorAgentSession.vue 393 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sessionManager/components/uploadFile.vue 73 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sessionManager/index.vue 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
npminstall-debug.log
@@ -1,27 +1,27 @@
{
  root: 'F:\\code\\flow_web',
  root: 'F:\\code\\dataCode\\flow_web',
  registry: 'https://registry.npmmirror.com',
  pkgs: [
    {
      name: '',
      version: 'vue-office/excel',
      type: 'git',
      name: 'prismis',
      version: 'latest',
      type: 'tag',
      alias: undefined,
      arg: [Result]
    }
  ],
  production: false,
  cacheStrict: false,
  cacheDir: 'C:\\Users\\admin\\.npminstall_tarball',
  cacheDir: 'C:\\Users\\root\\.npminstall_tarball',
  env: {
    npm_config_registry: 'https://registry.npmmirror.com',
    npm_config_argv: '{"remain":[],"cooked":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\admin\\\\.cnpmrc","--disturl=https://cdn.npmmirror.com/binaries/node","--registry=https://registry.npmmirror.com","vue-office/excel"],"original":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\admin\\\\.cnpmrc","--disturl=https://cdn.npmmirror.com/binaries/node","--registry=https://registry.npmmirror.com","vue-office/excel"]}',
    npm_config_user_agent: 'npminstall/7.12.0 npm/? node/v20.15.1 win32 x64',
    npm_config_cache: 'C:\\Users\\admin\\.npminstall_tarball',
    npm_config_argv: '{"remain":[],"cooked":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\root\\\\.cnpmrc","--disturl=https://cdn.npmmirror.com/binaries/node","--registry=https://registry.npmmirror.com","prismis"],"original":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\root\\\\.cnpmrc","--disturl=https://cdn.npmmirror.com/binaries/node","--registry=https://registry.npmmirror.com","prismis"]}',
    npm_config_user_agent: 'npminstall/7.12.0 npm/? node/v20.16.0 win32 x64',
    npm_config_cache: 'C:\\Users\\root\\.npminstall_tarball',
    NODE: 'C:\\Program Files\\nodejs\\node.exe',
    npm_node_execpath: 'C:\\Program Files\\nodejs\\node.exe',
    npm_execpath: 'C:\\Users\\admin\\AppData\\Roaming\\npm\\node_modules\\cnpm\\node_modules\\npminstall\\bin\\install.js',
    npm_config_userconfig: 'C:\\Users\\admin\\.cnpmrc',
    npm_execpath: 'D:\\nvm\\npm\\node_modules\\cnpm\\node_modules\\npminstall\\bin\\install.js',
    npm_config_userconfig: 'C:\\Users\\root\\.cnpmrc',
    npm_config_disturl: 'https://cdn.npmmirror.com/binaries/node',
    npm_config_r: 'https://registry.npmmirror.com',
    COREPACK_NPM_REGISTRY: 'https://registry.npmmirror.com',
@@ -50,8 +50,8 @@
    npm_config_sharp_binary_host: 'https://cdn.npmmirror.com/binaries/sharp',
    npm_config_sharp_libvips_binary_host: 'https://cdn.npmmirror.com/binaries/sharp-libvips',
    npm_config_robotjs_binary_host: 'https://cdn.npmmirror.com/binaries/robotjs',
    npm_rootpath: 'F:\\code\\flow_web',
    INIT_CWD: 'F:\\code\\flow_web'
    npm_rootpath: 'F:\\code\\dataCode\\flow_web',
    INIT_CWD: 'F:\\code\\dataCode\\flow_web'
  },
  binaryMirrors: {
    ENVS: {
@@ -187,7 +187,7 @@
  disableFallbackStore: false,
  workspacesMap: Map(0) {},
  enableWorkspace: false,
  workspaceRoot: 'F:\\code\\flow_web',
  workspaceRoot: 'F:\\code\\dataCode\\flow_web',
  isWorkspaceRoot: true,
  isWorkspacePackage: false,
  offline: false,
package.json
@@ -26,12 +26,17 @@
  },
  "dependencies": {
    "@arco-design/web-vue": "^2.44.7",
    "@codemirror/lang-javascript": "^6.2.2",
    "@codemirror/theme-one-dark": "^6.1.2",
    "@codemirror/view": "^6.33.0",
    "@microsoft/fetch-event-source": "^2.0.1",
    "@vue-office/docx": "^1.6.2",
    "@vue-office/excel": "^1.7.11",
    "@vueuse/core": "^9.3.0",
    "arco-design-pro-vue": "^2.7.3",
    "axios": "^0.24.0",
    "codemirror": "^5.65.17",
    "codemirror-editor-vue3": "^2.7.0",
    "d3": "^4.12.0",
    "dayjs": "^1.11.5",
    "dimple": "github:PMSI-AlignAlytics/dimple#2.3.0",
@@ -51,6 +56,7 @@
    "pdfjs-dist": "^2.12.313",
    "pinia": "^2.0.23",
    "pinia-plugin-persistedstate": "^3.2.1",
    "prismjs": "^1.29.0",
    "qs": "^6.13.0",
    "query-string": "^8.0.3",
    "sass": "^1.77.8",
@@ -58,6 +64,7 @@
    "v-viewer": "^3.0.11",
    "vue": "^3.2.40",
    "vue-clipboard3": "^2.0.0",
    "vue-codemirror": "^6.1.1",
    "vue-echarts": "^6.2.3",
    "vue-i18n": "^9.2.2",
    "vue-router": "^4.0.14"
src/api/agentSession.ts
@@ -98,4 +98,16 @@
  document.body.appendChild(downloadElement);
  downloadElement.click();
  document.body.removeChild(downloadElement);
};
};
//多文件上传/api/v1/advanced-agent/upload
export function agentUploadApi(params) {
  const config = {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      // token: token,
    },
  };
  return axios.post('/api/v1/advanced-agent/upload', params, config);
}
src/views/sessionManager/components/chatMenu.vue
@@ -209,23 +209,30 @@
  const createNewSession = async (session) => {
    console.log(session, 'session');
    // 查询历史记录
    if (session.app_type == '1') {
      // 生成智能体新的对话
      emit('createSession', session.app_id, `和${session.name}的会话`);
      emit('changeAgentType', '1');
    if (session.app_type == '3') {
      //高级agent
      EventBus.emit('createSeniorAgent', session);
      emit('changeAgentType', '5');
    } else {
      // 生成agent新的对话
      // agent对象数据封装
      const { code, data } = await getAgentSessionDetailsApi(session.app_id);
      if (code == 0) {
        console.log(data, '会话详情');
        let sessionObj = {
          id: session.app_id,
          dsl: data.dsl,
          title: session.name,
        };
        EventBus.emit('createAgent', sessionObj);
        emit('changeAgentType', '2');
      if (session.app_type == '1') {
        // 生成智能体新的对话
        emit('createSession', session.app_id, `和${session.name}的会话`);
        emit('changeAgentType', '1');
      } else {
        // 生成agent新的对话
        // agent对象数据封装
        const { code, data } = await getAgentSessionDetailsApi(session.app_id);
        if (code == 0) {
          console.log(data, '会话详情');
          let sessionObj = {
            id: session.app_id,
            dsl: data.dsl,
            title: session.name,
          };
          EventBus.emit('createAgent', sessionObj);
          emit('changeAgentType', '2');
        }
      }
    }
  };
src/views/sessionManager/components/seniorAgentSession.vue
@@ -42,12 +42,12 @@
    style="
      width: 80%;
      overflow: auto;
      height: calc(100vh - 380px);
      height: calc(100vh - 400px);
      margin: 0px auto 20px;
    "
  >
    <div class="chat-item" v-for="(sessionDetail, index) in sessionDetailList">
      <a-comment v-if="sessionDetail.role === 'user'">
      <a-comment v-if="sessionDetail?.role === 'user'">
        <template #avatar>
          <img
            class="icon-user-jpg"
@@ -59,9 +59,25 @@
          <div :class="{ chartUserText: theme === 'light' }"
            >{{ sessionDetail.content }}
          </div>
          <!-- <div class="uploadFileList fileList">
              <a-comment
                content="232323"
                style="
                  background: var(--color-bg-2);
                  padding: 10px;
                  border-radius: 10px;
                  font-size: 12px;
                "
              >
                <template #avatar>
                  <img :src="getIconByExtension('wps')" alt="" />
                </template>
              </a-comment>
            </div> -->
        </template>
      </a-comment>
      <a-comment v-else-if="sessionDetail.role === 'assistant'">
      <a-comment v-else-if="sessionDetail?.role === 'assistant'">
        <template #avatar>
          <img
            class="icon-user-jpg"
@@ -76,6 +92,7 @@
          <!--            </div>-->
          <!--          </a-card>-->
          <a-textarea
            v-if="sessionDetail?.content"
            readonly
            auto-size
            v-model="sessionDetail.content"
@@ -86,6 +103,53 @@
            style="border: none"
          >
          </a-textarea>
          <div v-else>
            <!-- <a-textarea
              readonly
              auto-size
              :default-value="chartText(sessionDetail.code, sessionDetail.sql)"
              :class="{ chatItemAnswer: theme === 'light' }"
              :style="{
                backgroundColor: theme === 'light' ? '#ffffff' : '#000000',
              }"
              style="border: none"
            >
            </a-textarea> -->
            <!-- <codemirror
              v-model="sessionDetail.code"
              placeholder="Code gose here..."
              :style="{ height: '100%' }"
              :autofocus="true"
              :tabSize="2"
            /> -->
            <div class="codeStle">
              <div class="language">python</div>
              <pre
                style="background: #2c2c36; padding: 10px; margin-top: 0"
              ><code class="language-js line-numbers">{{ sessionDetail.code+ sessionDetail.sql}}</code></pre>
            </div>
            <a-image
              v-if="sessionDetail?.image_name"
              :src="getImg(sessionDetail)"
              alt=""
            />
            <div class="uploadFileList fileList">
              <a-comment
                :content="sessionDetail.excel_name"
                style="
                  background: var(--color-bg-2);
                  padding: 10px;
                  border-radius: 10px;
                  font-size: 12px;
                "
              >
                <template #avatar>
                  <img :src="getIconByExtension('xlsx')" alt="" />
                </template>
              </a-comment>
            </div>
          </div>
          <div class="prompt" v-if="!activeSessionId">
            <ul>
              <li
@@ -103,12 +167,25 @@
              </li>
            </ul>
          </div>
          <div>
            <!-- <a-image
              width="200"
              src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/a8c8cdb109cb051163646151a4a5083b.png~tplv-uwbnlip3yd-webp.webp"
            /> -->
          </div>
        </template>
        <template #actions>
          <span
            class="action"
            v-if="index != 0"
            v-if="index != 0 && sessionDetail?.content"
            @click="copy(sessionDetail.content)"
          >
            <icon-copy /> 复制
          </span>
          <span
            class="action"
            v-if="index != 0 && sessionDetail?.code"
            @click="copy(sessionDetail.code + sessionDetail.sql)"
          >
            <icon-copy /> 复制
          </span>
@@ -125,9 +202,15 @@
            @click="iconDownload(sessionDetail)"
            ><icon-to-bottom />下载
          </span>
          <span
            class="action"
            v-if="sessionDetail?.excel_name"
            @click="iconDownloadXsl(sessionDetail)"
            ><icon-to-bottom />下载
          </span>
        </template>
      </a-comment>
      <a-comment v-else-if="sessionDetail.role === 'last'">
      <a-comment v-else-if="sessionDetail?.role === 'last'">
        <template #avatar>
          <img
            class="icon-user-jpg"
@@ -187,8 +270,22 @@
          maxRows: 5,
        }"
      />
      <div style="width: 100%; display: flex; justify-content: space-between">
        <span></span>
      <div
        style="width: 100%; display: flex; justify-content: space-between"
        class="uploadFileDis"
      >
        <!-- <updataFile
          ref="fileInput"
          :sessionId="activeSessionId"
          @selectFileCallback="selectFileCallback"
        ></updataFile> -->
        <span v-if="getAent"></span>
        <uploadFile
          v-if="agentObj.id == 'excel_talk' || dialog_id == 'excel_talk'"
          ref="fileInput"
          :sessionId="activeSessionId"
          @selectFileCallback="selectFileCallback"
        ></uploadFile>
        <a-button
          :disabled="chatDis"
          @click="sentClick"
@@ -199,6 +296,7 @@
          <icon-send size="32" style="color: #0960bd" />
        </a-button>
      </div>
      <!--      <div class="btn-send">-->
      <!--        &lt;!&ndash; <icon-send size="32" /> &ndash;&gt;-->
      <!--        <a-button-->
@@ -212,6 +310,60 @@
      <!--        </a-button-->
      <!--        >-->
      <!--      </div>-->
    </div>
    <div class="uploadFileList" v-if="uploaditemList.length > 0">
      <div
        class="files"
        v-for="(item, index) in uploaditemList"
        :key="index"
        style="
          position: relative;
          width: 220px;
          margin-top: 10px;
          margin-right: 20px;
        "
      >
        <a-comment
          :author="item.name"
          :content="item.size"
          style="
            background: var(--color-bg-2);
            padding: 10px;
            border-radius: 10px;
            font-size: 12px;
          "
        >
          <template #avatar>
            <a-spin
              :loading="onFileSelectedLoading"
              v-if="onFileSelectedLoading"
            >
              <template #icon>
                <icon-sync />
              </template>
              <template #tip>
                <div style="font-size: 12px">{{ textName }}</div>
              </template>
            </a-spin>
            <!--                    <a-button type="text" :loading="onFileSelectedLoading" v-if="onFileSelectedLoading"></a-button>-->
            <!--                    <a-avatar v-if="!onFileSelectedLoading">-->
            <!--                      <icon-file style="color: #0960bd" />-->
            <!--                    </a-avatar>-->
            <img :src="getIconByExtension(item.name)" alt="" />
          </template>
        </a-comment>
        <icon-close-circle-fill
          size="18px"
          @click="deleteFile(item, index)"
          style="
            position: absolute;
            right: -4px;
            top: -4px;
            color: red;
            cursor: pointer;
          "
        />
      </div>
    </div>
    <a-modal
      v-model:visible="visible"
@@ -256,6 +408,8 @@
  import { Message } from '@arco-design/web-vue';
  import { useAppStore } from '@/store';
  import { getAuthorization } from '@/utils/auth';
  import updataFile from './updataFile.vue';
  import uploadFile from './uploadFile.vue';
  import { EventSourceParserStream } from 'eventsource-parser/stream';
  import {
    agentResetApi,
@@ -264,13 +418,30 @@
    agentConversationSetApi,
    agentConverDownloadApi,
    downloadFile,
    agentUploadApi,
  } from '@/api/agentSession';
  import EventBus from '@/utils/EventBus';
  import useClipboard from 'vue-clipboard3';
  import { addSessionApi, getSessionDetailsApi } from '@/api/session';
  import pdfImg1 from '@/assets/session/PDF.png';
  import pdfImg2 from '@/assets/session/wps-write.png';
  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 { userModelState } from '@/store';
  // import { Codemirror } from 'vue-codemirror';
  // import { javascript } from '@codemirror/lang-javascript';
  // import { oneDark } from '@codemirror/theme-one-dark';
  import Prism from 'prismjs'; //导入代码高亮插件的core(里面提供了其他官方插件及代码高亮样式主题,你只需要引入即可)
  import 'prismjs/themes/prism-tomorrow.min.css'; //引入代码高亮主题(这个去node_modules的安装prismjs中找到想使用的主题即可)
  const props = defineProps({
    modalObj: Object,
  });
  const modelStore = userModelState();
  // const emit = defineEmits(['addSession']);
@@ -280,6 +451,7 @@
      role: 'assistant',
    },
  ]); //根据会话id出来的会话详情
  const httpUrl = modelStore.hrefUrl;
  const sessionList = ref([]); //会话列表
  const modalObj = reactive({});
  const dialogId = ref('');
@@ -296,6 +468,8 @@
  const conversation_id = ref('');
  const fieldNames = { value: 'id', label: 'name' };
  const agentObj = reactive({});
  const dialog_id = ref('');
  const getAent = ref(false);
  const agentList = ref([]);
  const selectValue = ref('');
  const sectionList = ref({});
@@ -303,7 +477,9 @@
  const isStopChat = ref(false);
  const appStore = useAppStore();
  const sessionObj = reactive({});
  const uploaditemList = ref([]);
  const prompts = ref([]);
  const theme = computed(() => {
    return appStore.theme;
  });
@@ -369,11 +545,14 @@
    prompts.value = session.prompts;
    activeSessionId.value = '';
    uploaditemList.value = [];
    console.log(12123);
    getAentId(session.id);
    Object.assign(agentObj, session);
    from.name = session.name;
    const dataSession = session.prompt_config;
    if (dataSession.prologue) {
    if (dataSession?.prologue) {
      sessionDetailList.value[0].content = dataSession.prologue;
    }
@@ -449,6 +628,27 @@
    loading.value = false;
    inputMsg.value = '';
  };
  //渲染文字
  const chartText = (val, sql) => {
    console.log(val + sql, 77);
    return val + '\n' + sql;
  };
  //获取图片地址
  const getImg = (val) => {
    const id = val?.image_name;
    if (id) {
      return (
        httpUrl +
        '/api/v1/advanced-agent/download?file_id=' +
        id +
        '&app_id=excel_talk&file_type=image'
      );
    }
  };
  // 调用get方法
  const queryAgentSessionDetails = async (id) => {
    const { code, data } = await getSessionDetailsApi(id);
@@ -459,6 +659,7 @@
      //   nextTick(() => {
      //     sessionDetailList.value = data.dsl.messages;
      //   });
      sessionDetailList.value = data.message;
      agentTitle.value = `${data.name}` || '未命名会话';
@@ -471,10 +672,24 @@
    inputMsg.value = text;
  };
  const getAentId = (id) => {
    if (id == 'excel_talk') {
      console.log(1);
      getAent.value = false;
    }
    if (id == 'questions_talk') {
      console.log(2);
      getAent.value = true;
    }
  };
  // 历史记录跳转获取agent会话详情
  const querySessionDetail = async (session) => {
    conversation_id.value = session.id;
    activeSessionId.value = session.id;
    dialog_id.value = session.dialog_id;
    console.log(4554);
    getAentId(session.dialog_id);
    from.name = session.name;
    const { code, data } = await getSessionDetailsApi(session.id);
@@ -498,6 +713,7 @@
  const sentClick = () => {
    sendMessage('click');
    uploaditemList.value = [];
  };
  // 重新生成
@@ -552,7 +768,7 @@
          //   startChat(inputMsg.value);
          //   inputMsg.value = '';
          createSession();
          createSession('');
        } else {
          Message.warning('消息不能为空');
          chatDis.value = false;
@@ -562,7 +778,7 @@
    }
  };
  //创建会话
  const createSession = async () => {
  const createSession = async (val) => {
    try {
      loading.value = true;
      chatDis.value = true;
@@ -589,8 +805,13 @@
          // console.log(res.data.conversation_id);
          activeSessionId.value = res.data?.id;
          startChat(inputMsg.value);
          inputMsg.value = '';
          if (!val) {
            startChat(inputMsg.value);
            inputMsg.value = '';
          } else {
            loading.value = false;
            chatDis.value = false;
          }
        }
      } else {
        startChat(inputMsg.value);
@@ -611,6 +832,91 @@
    });
  };
  //下载xsl
  const iconDownloadXsl = async (val) => {
    await downloadFile({
      url:
        `/api/v1/advanced-agent/download?file_id=` +
        val.excel_name +
        '&app_id=excel_talk&file_type=excel',
    });
  };
  //上传
  const selectFileCallback = async (resData, file) => {
    console.log(111);
    try {
      const formData = new FormData();
      uploaditemList.value = resData;
      if (!activeSessionId.value) {
        await createSession(1);
      }
      onFileSelectedLoading.value = true;
      textName.value = '上传中';
      //   for (let i = 0; i < file.length; i++) {
      //     formData.append('files', file[i].file);
      //     formData.append('conversation_id', activeSessionId.value);
      //     formData.append('app_id', agentObj.id);
      //   }
      formData.append('files', file[0].file);
      formData.append('conversation_id', activeSessionId.value);
      formData.append('app_id', agentObj.id);
      console.log(formData, 'formData');
      const { data, code } = await agentUploadApi(formData);
      if (code === 200) {
        onFileSelectedLoading.value = false;
        textName.value = '上传成功';
      }
    } catch (err) {
      onFileSelectedLoading.value = false;
      textName.value = '上传失败';
      Message.error('上传失败');
    }
  };
  const getIconByExten = (extension) => {
    const fileExtension = ref('');
    fileExtension.value = extension.split('.').pop();
    let type = '';
    parser_idsArr.value.forEach((item) => {
      // 包含元素
      if (item.formats.includes(fileExtension.value)) {
        type = item.id;
      }
    });
    return type;
  };
  let onFileSelectedLoading = ref(true);
  const textName = ref('上传成功');
  const deleteFile = (item) => {
    console.log(uploaditemList.value);
    uploaditemList.value.splice(item.index, 1);
  };
  const getIconByExtension = computed(() => (extension) => {
    const fileExtension = ref('');
    fileExtension.value = extension.split('.').pop();
    switch (fileExtension.value) {
      case 'pptx':
      case 'ppt':
      case 'pdf':
        return pdfImg1; // PDF图标的URL
      case 'docx':
      case 'doc':
      case 'wps':
        return pdfImg2; // Word图标的URL
      case 'xlsx':
      case 'xls':
        return pdfImg3; // Excel图标的URL
      case 'txt':
        return pdfImg4; // 文本文档图标的URL
      default:
        return pdfImg5; // 默认图标
    }
  });
  //聊天
  const startChat = async (valMsg) => {
    sessionDetailList.value.push({
@@ -622,6 +928,7 @@
    let chatStr = {
      id: activeSessionId.value,
      message: valMsg,
      app_id: agentObj.id,
    };
    if (isHistory.value) {
      chatStr.dsl = dsl;
@@ -767,6 +1074,10 @@
      isHistory.value = true;
      querySessionDetail(data);
    });
    setTimeout(() => {
      Prism.highlightAll(); // 全局代码高亮
    }, 1000);
    // Prism.highlightAll(); // 全局代码高亮
  });
  onBeforeUnmount(() => {
    EventBus.off('createSeniorAgent');
@@ -790,6 +1101,7 @@
</script>
<style scoped lang="scss">
  // @import 'prismjs/themes/prism.css';
  .dark {
    color: gray !important;
  }
@@ -812,7 +1124,7 @@
    .center {
      box-sizing: border-box;
      height: calc(100vh - 200px);
      height: calc(100vh - 140px);
      position: relative;
      .center-title {
@@ -870,10 +1182,13 @@
        font-weight: 500;
      }
      .chat_bottom {
        display: flex;
        align-items: center;
        // display: flex;
        // align-items: center;
        // width: 78%;
        // margin: 0 auto;
        width: 78%;
        margin: 0 auto;
        position: relative;
        .center-bottom {
          // position: absolute;
          // width: 90%;
@@ -885,7 +1200,7 @@
          display: flex;
          flex: 1 1;
          flex-direction: column;
          overflow: hidden;
          //   overflow: hidden;
          position: relative;
          // padding-top:10px;
          :deep(.arco-textarea-wrapper) {
@@ -895,12 +1210,13 @@
          .btn-send {
            position: absolute !important;
            right: 4px;
            top: 80px;
            top: 90px;
            z-index: 10;
          }
          :deep(.arco-btn-size-large) {
            height: 28px;
            width: 50px;
            width: 60px;
          }
        }
        :deep(.arco-textarea-wrapper) {
@@ -918,6 +1234,16 @@
      }
      .icon-user-jpg {
        border: 1px solid #d9d9d9;
      }
      .codeStle {
        .language {
          color: #fff;
          padding-left: 10px;
          font-size: 14px;
          height: 30px;
          line-height: 30px;
          background-color: #373739;
        }
      }
      .prompt {
        ul {
@@ -972,6 +1298,37 @@
      }
    }
  }
  .fileList {
    padding: 10px 0 !important;
    margin-bottom: 0 !important;
    :deep(.arco-comment-inner) {
      line-height: 29px;
    }
  }
  .uploadFileList {
    width: 100%;
    max-height: 140px;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 100px;
    :deep(.arco-comment-author) {
      width: 110px;
      display: inline-block;
      overflow: hidden; /* 隐藏超出的内容 */
      text-overflow: ellipsis; /* 使用省略号来代替被隐藏的文字 */
      white-space: nowrap; /* 不换行,使内容在一行内显示 */
    }
    :deep(.arco-spin-tip) {
      margin-top: 0px;
    }
  }
  .uploadFileDis {
    :deep(.arco-upload-list-type-text) {
      display: none;
    }
  }
  .action {
    cursor: pointer;
src/views/sessionManager/components/uploadFile.vue
@@ -1,10 +1,14 @@
<template>
  <div>
    <a-upload
      action="/"
      v-model:fileList="fileList"
      :limit="limit"
      :auto-upload="false"
      :accept="xlsx"
      :limit="props.limit"
      @change="handleChange"
      @before-remove="beforeRemove"
      @before-upload="beforeUpload"
      image-preview
    >
      <template #upload-button>
@@ -24,12 +28,13 @@
  import { computed, ref, onMounted, watch, watchEffect } from 'vue';
  import { uploadAndParse } from '@/api/session';
  import { useUserStore } from '@/store';
  import { Message } from '@arco-design/web-vue';
  const userStore = useUserStore();
  const props = defineProps({
    limit: {
      type: Number,
      default: 3,
      default: 6,
    },
    sessionId: String,
    action: String, // 上传的服务器地址
@@ -44,6 +49,8 @@
  ]);
  const urls = computed(() => props.url);
  const fileList = ref([]);
  const filesData = ref([]);
  const uploaditemList = ref([]);
  watch(
    () => [props.url, props.sessionId],
@@ -80,43 +87,41 @@
  };
  const handleChange = (fileList) => {
    // emit('update:fileList', fileList);
    // const successFiles = fileList.filter((item) => item.status === 'done');
    // if (successFiles.length > 0) {
    //   emit(
    //     'success',
    //     successFiles.map((item) => item.response.data)
    //   );
    //   emit(
    //     'selectFileCallback',
    //     successFiles.map((item) => item.response.data)
    //   );
    const formData = new FormData();
    for (let i = 0; i < fileList.length; i++) {
      formData.append('file', fileList[i].file);
      formData.append('conversation_id', props.sessionId);
      // formData.append('parser_config', '');
      // if (!parser_id.value) {
      //   formData.append(
      //     'parser_id',
      //     getIconByExtension(successFiles[i].name)
      //   );
      // } else {
      //   formData.append('parser_id', parser_id.value);
      // }
    }
    uploadAndParse(formData).then((res) => {
      onFileSelectedLoading.value = false;
      if (res.code == 200) {
        cancel();
        // uploaditemList.value = [];
        emit('selectFileCallback', uploaditemList.value);
        Message.success('上传成功');
      } else {
        Message.error('上传失败');
      }
    uploaditemList.value = fileList.map((item, index) => {
      return {
        index: index,
        name: item.name,
        size: (item.file.size / 1024).toFixed(2) + 'K',
      };
    });
    // }
    filesData.value = fileList;
    emit('selectFileCallback', uploaditemList.value, fileList);
  };
  function beforeUpload(resolve) {
    let name = ['xlsx', 'xls'];
    let fileName = resolve.name.split('.');
    let fileExt = fileName[fileName.length - 1];
    let isTypeOk = name.indexOf(fileExt) >= 0;
    if (!isTypeOk) {
      Message.warning('只支持上传:xlsx,xls');
    } else {
      return new Promise((resolve) => {
        resolve(true);
      });
    }
    // if (form.value.maininformation.length > 4) {
    //   Message.error('文件不能超过5个');
    // } else {
    //   return new Promise((resolve) => {
    //     resolve(true);
    //   });
    // }
  }
</script>
src/views/sessionManager/index.vue
@@ -766,8 +766,8 @@
  };
  const selectFileCallback = (data) => {
    debugger;
    console.log(data, 'selectFileCallback');
    // debugger;
    // console.log(data, 'selectFileCallback');
    uploaditemList.value = [...uploaditemList.value, ...data];
  };
@@ -1227,11 +1227,11 @@
        }
      }
    }
    .uploadFileDis {
      :deep(.arco-upload-list-type-text) {
        display: none;
      }
    }
    // .uploadFileDis {
    //   :deep(.arco-upload-list-type-text) {
    //     display: none;
    //   }
    // }
    .prompt {
      ul {
        margin: 0;