From 65d5f5ae867557cba5e51884f8a214b58ea1b1d2 Mon Sep 17 00:00:00 2001 From: Gsh <15170702455@163.com> Date: Mon, 4 Aug 2025 23:11:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8A=A0=E8=BD=BD=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=81vip=E7=8A=B6=E6=80=81=E4=BC=98=E5=8C=96=E3=80=81apikey?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Yi.Ai.Vue3/.build/plugins/index.ts | 24 ++++++ Yi.Ai.Vue3/index.html | 36 +------- Yi.Ai.Vue3/package.json | 2 + Yi.Ai.Vue3/pnpm-lock.yaml | 85 ++++++++++++++++++- .../src/components/ModelSelect/index.vue | 18 ++-- .../components/APIKeyManagement.vue | 10 +-- .../components/Header/components/Avatar.vue | 25 +++--- Yi.Ai.Vue3/src/layouts/index.vue | 24 +++++- .../pages/chat/layouts/chatWithId/index.vue | 4 +- Yi.Ai.Vue3/src/stores/modules/chat.ts | 10 +-- Yi.Ai.Vue3/src/utils/user.ts | 27 +++--- 11 files changed, 172 insertions(+), 93 deletions(-) diff --git a/Yi.Ai.Vue3/.build/plugins/index.ts b/Yi.Ai.Vue3/.build/plugins/index.ts index c3b16160..8138f0ca 100644 --- a/Yi.Ai.Vue3/.build/plugins/index.ts +++ b/Yi.Ai.Vue3/.build/plugins/index.ts @@ -1,10 +1,14 @@ import type { ConfigEnv, PluginOption } from 'vite'; import path from 'node:path'; import vue from '@vitejs/plugin-vue'; +import { visualizer } from 'rollup-plugin-visualizer'; import UnoCSS from 'unocss/vite'; import AutoImport from 'unplugin-auto-import/vite'; import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'; + import Components from 'unplugin-vue-components/vite'; +import viteCompression from 'vite-plugin-compression'; + import envTyped from 'vite-plugin-env-typed'; import createSvgIcon from './svg-icon'; @@ -33,6 +37,26 @@ function plugins({ mode, command }: ConfigEnv): PluginOption[] { dts: path.join(root, 'types', 'components.d.ts'), }), createSvgIcon(command === 'build'), + + // ✅ Gzip 构建产物压缩(仅生产构建) + command === 'build' + && viteCompression({ + verbose: true, + disable: false, + threshold: 10240, + algorithm: 'gzip', + ext: '.gz', + }), + + // ✅ 构建分析图(仅生产构建) + command === 'build' + && visualizer({ + filename: './dist/stats.html', + open: false, // 打包后自动打开分析图(true 可开启) + gzipSize: true, + brotliSize: true, + }), + ]; } diff --git a/Yi.Ai.Vue3/index.html b/Yi.Ai.Vue3/index.html index ad58c31d..eb48f78d 100644 --- a/Yi.Ai.Vue3/index.html +++ b/Yi.Ai.Vue3/index.html @@ -111,49 +111,19 @@
-