فهرست منبع

Merge remote-tracking branch 'origin/main'

xuyonghao 1 سال پیش
والد
کامیت
6322c674b5

+ 18 - 8
README.md

@@ -1,13 +1,18 @@
-# business
+# 小数
 
-This template should help get you started developing with Vue 3 in Vite.
+大模型 AI 能力平台,为你的下一个创意助力
 
-## Recommended IDE Setup
+## 环境参考
 
-[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
+- Node.js 20.13.1
+- npm 10.5.2
+
+机器上的相关软件版本不必和此处描述完全一致。由于项目使用`vite`启动,`vite`对于`Node.js`版本有[特定要求](https://vite.dev/guide/#scaffolding-your-first-vite-project),需使用`18+` or `20 +`。
 
 ## 项目设置
 
+git 仓库地址:http://gitlab.smartai.com/qi/xiaoshu
+
 ```sh
 # 安装项目依赖
 $ npm install
@@ -23,14 +28,16 @@ $ npm run build
 ## 项目须知
 
 1. `dist`目录需要在`git`进行追踪,不必添加到`.gitignore`文件中。
-2. 安装项目依赖使用`npm install --legacy-peer-deps`,仅使用`npm install`命令可能无法启动项目。
-3. 安装新依赖包需要使用`--legacy-peer-deps`参数,例如:`npm install --save --legacy-peer-deps md5`
+2. 安装`项目依赖`使用`npm install --legacy-peer-deps`,仅使用`npm install`命令可能无法启动项目。
+3. 安装`新依赖包`需要使用`--legacy-peer-deps`参数,例如:`npm install --save --legacy-peer-deps md5`
 4. 配置文件`src/ajax/url-external-config.js`中的`REFFERENCE_ASSETS_FILE_URL`需要配置,当前值为`http://192.168.20.119:11080`。如果不配置,则会引起`文档引用`效果出错,图片和 PDF 文档将无法显示。
-5. 项目启动之前,可能需要做一些配置,详情请见下方`关于配置文件`章节
+5. 项目启动之前,可能需要做一些配置,详情请见下方`关于配置文件`章节。另外,项目里的几个关键`配置文件`以及`配置项`目前都已经提交到`git`仓库,项目初次启动时,无需特意更改配置文件。仅在开发过程中有需要时,再调整配置文件,新增或移除配置字段。
+6. 此项目中的组件库,主要使用 字节跳动出品的企业级设计系统 [arco.design](https://arco.design/vue/docs/start)
+7. 代码编辑器推荐使用`vscode`
 
 ## 关于配置文件
 
-项目里一有三个配置文件,如下:
+项目里一有三个配置文件,如下:
 
 - src/ajax/url-external-config.js
 - src/utils/config.js
@@ -54,6 +61,9 @@ $ npm run build
 
 ## 相关资源
 
+- [vuejs](https://cn.vuejs.org/)
+- [vue-router](https://router.vuejs.org/zh/)
+- [pinia](https://pinia.vuejs.org/zh/)
 - [Vite 配置参考](https://vitejs.dev/config/).
 - [字节跳动前端框架 arco design](https://arco.design/vue/docs/start)
 - [RAGFlow 开源大模型](https://infiniflow.cn/)

+ 32 - 11
src/components/DialogWrap.vue

@@ -217,7 +217,7 @@
               <span>{{ item.other.token }}</span>
             </p>
             <p v-else></p>
-            <div v-if="show_info_btns">
+            <div v-if="chat_type !== 'huitu'">
               <a-tooltip content="重新生成">
                 <p @click="reQuestion(item.question)" :class="[readonly ? 'disabled' : '']">
                   <img src="@/assets/icons/refresh.png" width="15" />
@@ -282,7 +282,7 @@ import formatDialogItem from './dialog-wrap/format-dialog-item';
 
 import DocRefItem from './dialog-wrap/DocRefItem.vue';
 
-import {useImageUploadStatus} from '../store/modules/xs-huitu-image-upload/index';
+import {useImageUploadStatus} from '../store/index';
 
 export default defineComponent({
   components: {
@@ -332,6 +332,9 @@ export default defineComponent({
      */
     const show_info_btns = ref(false);
 
+    const chat_type = props.type; // 对话的类型
+
+
     /**
      * 初始化临时历史记录
      * 在对话过程中,消息记录是一条一条的呈现
@@ -669,7 +672,19 @@ export default defineComponent({
           }
 
           if (files && files.length > 0) {
-            loadingData.value.file = files[0];
+            const file_info = {
+              file_name: files[0].file_name,
+              file_url: files[0].file_url,
+            };
+
+            if(chat_type === 'excel'){
+              file_info.file_type = 'excel'
+            }
+
+            loadingData.value.file = file_info;
+            
+            answerFile.value = file_info;
+            
             addData(loadingData.value);
           } else {
             answerData.value += step_message ? getHTML(step_message) + "</br>" : message
@@ -786,10 +801,21 @@ export default defineComponent({
             stopWriting();
             answerData.value = "";
             isLoaded.value = false;
-          }else{
+          } else if(chat_type === 'excel'){
+            // 报表合并
+            answerLoaded();
+            answerData.value = getHTML(message);
+
+            addAnswer(loadingData.value);
+
+            answerData.value = getHTML(message);
+
+            stopWriting();
+          } else{
             if (!answerData.value) {
               answerLoaded();
               answerData.value = getHTML(message);
+
               addAnswer(loadingData.value);
             }
             stopWriting();
@@ -797,12 +823,6 @@ export default defineComponent({
             isLoaded.value = false;
           }
         }
-
-        // // 获取所有的临时历史记录
-        // const full_history = tempHistory.getHistory();
-        // applyRefferencePopover(full_history);
-        // const current_index = tempHistory.getChatIndex(cur_chat_id);
-        // applyImageDisplay(full_history, current_index);
       }
 
       helper.webSocket.onmessage = (event) => {
@@ -924,7 +944,8 @@ export default defineComponent({
       openDocument,
       // openDocuementPage,
 
-      show_info_btns
+      show_info_btns,
+      chat_type
     };
   }
 });

+ 5 - 1
src/components/DocumentCards.vue

@@ -9,7 +9,7 @@
         </div>
       </div>
     </section>
-    <footer v-if="hasUpload">
+    <footer v-if="hasUpload" class="excel-upload-container">
       <a-popover :popup-visible="showUpload" position="tl" @popup-visible-change="() => {
         showDeleteTooltip = false;
       }
@@ -320,6 +320,10 @@ export default defineComponent({
 });
 </script>
 <style lang="scss" scoped>
+.excel-upload-container{
+  margin-bottom: 20px;
+}
+
 .bottom-buttons {
   display: flex;
   justify-content: right;

+ 1 - 1
src/components/PictureUpload.vue

@@ -112,7 +112,7 @@ import FileListTable from './picture-upload/FileListTable.vue';
 
 import {huituSetTempImageFile} from './dialog-wrap/temp-image'
 
-import {useImageUploadStatus} from '../store/modules/xs-huitu-image-upload/index';
+import {useImageUploadStatus} from '../store/index';
 
 export default defineComponent({
   props: ["data", "uploadFile", "isQuestion", "agentId", "agengtName"],

+ 10 - 9
src/store/index.ts

@@ -1,15 +1,16 @@
-import { createPinia } from 'pinia';
-import useAppStore from './modules/app';
-import useUserStore from './modules/user';
-import usePinia from './modules/storeMsg';
-import useTabBarStore from './modules/tab-bar';
-import userModelState from './modules/shareModel';
+import { createPinia } from "pinia";
+import useAppStore from "./modules/app";
+import useUserStore from "./modules/user";
+import usePinia from "./modules/storeMsg";
+import useTabBarStore from "./modules/tab-bar";
+import userModelState from "./modules/shareModel";
+import useImageUploadStatus from "../store/modules/xs-huitu-image-upload/index";
 
-import piniaPluginPersistedstate from 'pinia-plugin-persistedstate' //引入持久化插件
+import piniaPluginPersistedstate from "pinia-plugin-persistedstate"; //引入持久化插件
 
 const pinia = createPinia();
 
-pinia.use(piniaPluginPersistedstate) //将插件添加到 pinia 实例上
+pinia.use(piniaPluginPersistedstate); //将插件添加到 pinia 实例上
 
-export { useAppStore, useUserStore,usePinia, useTabBarStore,userModelState };
+export { useAppStore, useUserStore, usePinia, useTabBarStore, userModelState, useImageUploadStatus };
 export default pinia;

+ 3 - 1
src/store/modules/xs-huitu-image-upload/index.ts

@@ -15,7 +15,7 @@ import { defineStore } from "pinia";
  *
  * 在上传图片的位置,应检查 img_upload_status 和 msg_send_status 的值,如果 img_upload_status === 1 但是 msg_send_status === 0,则图片上传功能不可用
  */
-export const useImageUploadStatus = defineStore("imageUploadStatus", {
+const useImageUploadStatus = defineStore("imageUploadStatus", {
   state: () => ({
     img_upload_status: 0,
     msg_send_status: 0
@@ -56,3 +56,5 @@ export const useImageUploadStatus = defineStore("imageUploadStatus", {
     }
   }
 });
+
+export default useImageUploadStatus;

+ 4 - 3
src/views/Home.vue

@@ -58,7 +58,7 @@
               />
             </section>
 
-            <footer v-if="navId !== -2 && navId !== 0 && navId !== 3 && navId !== 6 && !historyMode">
+            <footer v-if="navId !== -2 && navId !== 0 && navId !== 3 && navId !== 6 && navId !== 1 && !historyMode">
               <BtnIframeChujuan v-if="navId==7"/>
               <message-input :readonly="readonly" eventName="open-dialog" />
             </footer>
@@ -235,7 +235,7 @@ export default defineComponent({
     const historyMode = ref(false);
     const dialogList = ref([]);
 
-    const selectId = ref("");
+    const selectId = ref(""); // 当前选择的 agent_id 或者 历史记录的 ID
     const real_agent_id = ref(""); // 实际的agent_id,此值仅在 点击侧边栏具体功能时更改,例如点击 知识问答、文档智能按钮时更改
     const agentIds = ref([]); // agent ID的列表
 
@@ -244,7 +244,8 @@ export default defineComponent({
     const variables = ref([]);
     const textValue = ref("");
     const parseStatus = ref(false);
-    const maxLength = ref(6000);
+    const maxLength = ref(6000); // 允许输入的最大长度
+
     let reportData = {};
     let agents = {}
 

+ 0 - 6
vite.config.js

@@ -26,12 +26,6 @@ export default defineConfig({
                 secure: false,
                 ws: true,
                 rewrite: (path) => path.replace(/^\/proxy_url/, "")
-            },
-            '/filesx': {
-                target: "https://res.stepfun.com",
-                changeOrigin: true,
-                secure: false,
-                ws: true,
             }
         }
     }