Commit 576ea648 by shun peng

fix: add build dir

parent a6a377f0
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<profile name="Annotation profile for yudao" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="false">
<entry name="$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-configuration-processor/3.3.1/spring-boot-configuration-processor-3.3.1.jar" />
<entry name="$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.34/lombok-1.18.34.jar" />
<entry name="$MAVEN_REPOSITORY$/org/mapstruct/mapstruct-processor/1.5.5.Final/mapstruct-processor-1.5.5.Final.jar" />
<entry name="$MAVEN_REPOSITORY$/org/mapstruct/mapstruct/1.5.5.Final/mapstruct-1.5.5.Final.jar" />
</processorPath>
<module name="yudao-spring-boot-starter-job" />
<module name="yudao-server" />
<module name="yudao-module-ai-api" />
<module name="yudao-module-system-biz" />
<module name="yudao-spring-boot-starter-test" />
<module name="yudao-module-ai-biz" />
<module name="yudao-spring-boot-starter-biz-data-permission" />
<module name="yudao-spring-boot-starter-security" />
<module name="yudao-spring-boot-starter-redis" />
<module name="yudao-spring-boot-starter-mybatis" />
<module name="yudao-spring-boot-starter-protection" />
<module name="yudao-spring-boot-starter-web" />
<module name="yudao-spring-boot-starter-biz-ip" />
<module name="yudao-spring-boot-starter-biz-tenant" />
<module name="yudao-module-infra-api" />
<module name="yudao-spring-boot-starter-monitor" />
<module name="yudao-spring-boot-starter-websocket" />
<module name="yudao-module-infra-biz" />
<module name="yudao-spring-boot-starter-mq" />
<module name="yudao-common" />
<module name="yudao-spring-boot-starter-excel" />
<module name="yudao-module-system-api" />
<module name="yudao-spring-boot-starter-ai" />
</profile>
</annotationProcessing>
</component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="yudao-common" options="-parameters" />
<module name="yudao-module-ai-api" options="-parameters" />
<module name="yudao-module-ai-biz" options="-parameters" />
<module name="yudao-module-infra-api" options="-parameters" />
<module name="yudao-module-infra-biz" options="-parameters" />
<module name="yudao-module-system-api" options="-parameters" />
<module name="yudao-module-system-biz" options="-parameters" />
<module name="yudao-server" options="-parameters" />
<module name="yudao-spring-boot-starter-ai" options="-parameters" />
<module name="yudao-spring-boot-starter-biz-data-permission" options="-parameters" />
<module name="yudao-spring-boot-starter-biz-ip" options="-parameters" />
<module name="yudao-spring-boot-starter-biz-tenant" options="-parameters" />
<module name="yudao-spring-boot-starter-excel" options="-parameters" />
<module name="yudao-spring-boot-starter-job" options="-parameters" />
<module name="yudao-spring-boot-starter-monitor" options="-parameters" />
<module name="yudao-spring-boot-starter-mq" options="-parameters" />
<module name="yudao-spring-boot-starter-mybatis" options="-parameters" />
<module name="yudao-spring-boot-starter-protection" options="-parameters" />
<module name="yudao-spring-boot-starter-redis" options="-parameters" />
<module name="yudao-spring-boot-starter-security" options="-parameters" />
<module name="yudao-spring-boot-starter-test" options="-parameters" />
<module name="yudao-spring-boot-starter-web" options="-parameters" />
<module name="yudao-spring-boot-starter-websocket" options="-parameters" />
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-common/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-common/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-biz-ip/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-biz-ip/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-excel/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-excel/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-job/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-job/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-monitor/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-monitor/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-mq/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-mq/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-protection/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-protection/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-redis/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-redis/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-security/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-security/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-test/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-test/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-web/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-web/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-framework/yudao-spring-boot-starter-websocket/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-ai/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-ai/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-ai/yudao-module-ai-api/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-ai/yudao-module-ai-api/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-ai/yudao-module-ai-biz/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-ai/yudao-module-ai-biz/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-infra/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-infra/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-infra/yudao-module-infra-api/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-infra/yudao-module-infra-api/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-infra/yudao-module-infra-biz/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-infra/yudao-module-infra-biz/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-system/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-system/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-system/yudao-module-system-api/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-system/yudao-module-system-api/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-system/yudao-module-system-biz/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-module-system/yudao-module-system-biz/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-server/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/yudao-server/src/main/resources" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="aliyunmaven" />
<option name="name" value="aliyun" />
<option name="url" value="https://maven.aliyun.com/repository/public" />
</remote-repository>
<remote-repository>
<option name="id" value="spring-milestones" />
<option name="name" value="Spring Milestones" />
<option name="url" value="https://repo.spring.io/milestone" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="spring-snapshots" />
<option name="name" value="Spring Snapshots" />
<option name="url" value="https://repo.spring.io/snapshot" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="huaweicloud" />
<option name="name" value="huawei" />
<option name="url" value="https://mirrors.huaweicloud.com/repository/maven/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="corretto-21" project-jdk-type="JavaSDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
\ No newline at end of file
...@@ -28,6 +28,7 @@ import org.springframework.security.access.prepost.PreAuthorize; ...@@ -28,6 +28,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux; import reactor.core.publisher.Flux;
import java.net.MalformedURLException;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -51,14 +52,14 @@ public class AiChatMessageController { ...@@ -51,14 +52,14 @@ public class AiChatMessageController {
@Operation(summary = "发送消息(段式)", description = "一次性返回,响应较慢") @Operation(summary = "发送消息(段式)", description = "一次性返回,响应较慢")
@PostMapping("/send") @PostMapping("/send")
public CommonResult<AiChatMessageSendRespVO> sendMessage(@Valid @RequestBody AiChatMessageSendReqVO sendReqVO) { public CommonResult<AiChatMessageSendRespVO> sendMessage(@Valid @RequestBody AiChatMessageSendReqVO sendReqVO) throws MalformedURLException {
return success(chatMessageService.sendMessage(sendReqVO, getLoginUserId())); return success(chatMessageService.sendMessage(sendReqVO, getLoginUserId()));
} }
@Operation(summary = "发送消息(流式)", description = "流式返回,响应较快") @Operation(summary = "发送消息(流式)", description = "流式返回,响应较快")
@PostMapping(value = "/send-stream", produces = MediaType.TEXT_EVENT_STREAM_VALUE) @PostMapping(value = "/send-stream", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
@PermitAll // 解决 SSE 最终响应的时候,会被 Access Denied 拦截的问题 @PermitAll // 解决 SSE 最终响应的时候,会被 Access Denied 拦截的问题
public Flux<CommonResult<AiChatMessageSendRespVO>> sendChatMessageStream(@Valid @RequestBody AiChatMessageSendReqVO sendReqVO) { public Flux<CommonResult<AiChatMessageSendRespVO>> sendChatMessageStream(@Valid @RequestBody AiChatMessageSendReqVO sendReqVO) throws MalformedURLException {
return chatMessageService.sendChatMessageStream(sendReqVO, getLoginUserId()); return chatMessageService.sendChatMessageStream(sendReqVO, getLoginUserId());
} }
......
...@@ -22,4 +22,7 @@ public class AiChatMessageSendReqVO { ...@@ -22,4 +22,7 @@ public class AiChatMessageSendReqVO {
@Schema(description = "是否携带上下文", example = "true") @Schema(description = "是否携带上下文", example = "true")
private Boolean useContext; private Boolean useContext;
@Schema(description = "文件路径")
private String fileUrl;
} }
...@@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.ai.controller.admin.chat.vo.message.AiChatMessage ...@@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.ai.controller.admin.chat.vo.message.AiChatMessage
import cn.iocoder.yudao.module.ai.dal.dataobject.chat.AiChatMessageDO; import cn.iocoder.yudao.module.ai.dal.dataobject.chat.AiChatMessageDO;
import reactor.core.publisher.Flux; import reactor.core.publisher.Flux;
import java.net.MalformedURLException;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -26,7 +27,7 @@ public interface AiChatMessageService { ...@@ -26,7 +27,7 @@ public interface AiChatMessageService {
* @param userId 用户编号 * @param userId 用户编号
* @return 发送结果 * @return 发送结果
*/ */
AiChatMessageSendRespVO sendMessage(AiChatMessageSendReqVO sendReqVO, Long userId); AiChatMessageSendRespVO sendMessage(AiChatMessageSendReqVO sendReqVO, Long userId) throws MalformedURLException;
/** /**
* 发送消息 * 发送消息
...@@ -35,7 +36,7 @@ public interface AiChatMessageService { ...@@ -35,7 +36,7 @@ public interface AiChatMessageService {
* @param userId 用户编号 * @param userId 用户编号
* @return 发送结果 * @return 发送结果
*/ */
Flux<CommonResult<AiChatMessageSendRespVO>> sendChatMessageStream(AiChatMessageSendReqVO sendReqVO, Long userId); Flux<CommonResult<AiChatMessageSendRespVO>> sendChatMessageStream(AiChatMessageSendReqVO sendReqVO, Long userId) throws MalformedURLException;
/** /**
* 获得指定对话的消息列表 * 获得指定对话的消息列表
......
...@@ -29,8 +29,11 @@ import org.springframework.ai.chat.prompt.ChatOptions; ...@@ -29,8 +29,11 @@ import org.springframework.ai.chat.prompt.ChatOptions;
import org.springframework.ai.chat.prompt.Prompt; import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.MimeTypeUtils;
import reactor.core.publisher.Flux; import reactor.core.publisher.Flux;
import java.net.MalformedURLException;
import java.net.URL;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
...@@ -61,7 +64,7 @@ public class AiChatMessageServiceImpl implements AiChatMessageService { ...@@ -61,7 +64,7 @@ public class AiChatMessageServiceImpl implements AiChatMessageService {
private AiApiKeyService apiKeyService; private AiApiKeyService apiKeyService;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AiChatMessageSendRespVO sendMessage(AiChatMessageSendReqVO sendReqVO, Long userId) { public AiChatMessageSendRespVO sendMessage(AiChatMessageSendReqVO sendReqVO, Long userId) throws MalformedURLException {
// 1.1 校验对话存在 // 1.1 校验对话存在
AiChatConversationDO conversation = chatConversationService.validateChatConversationExists(sendReqVO.getConversationId()); AiChatConversationDO conversation = chatConversationService.validateChatConversationExists(sendReqVO.getConversationId());
if (ObjUtil.notEqual(conversation.getUserId(), userId)) { if (ObjUtil.notEqual(conversation.getUserId(), userId)) {
...@@ -92,7 +95,7 @@ public class AiChatMessageServiceImpl implements AiChatMessageService { ...@@ -92,7 +95,7 @@ public class AiChatMessageServiceImpl implements AiChatMessageService {
} }
@Override @Override
public Flux<CommonResult<AiChatMessageSendRespVO>> sendChatMessageStream(AiChatMessageSendReqVO sendReqVO, Long userId) { public Flux<CommonResult<AiChatMessageSendRespVO>> sendChatMessageStream(AiChatMessageSendReqVO sendReqVO, Long userId) throws MalformedURLException {
// 1.1 校验对话存在 // 1.1 校验对话存在
AiChatConversationDO conversation = chatConversationService.validateChatConversationExists(sendReqVO.getConversationId()); AiChatConversationDO conversation = chatConversationService.validateChatConversationExists(sendReqVO.getConversationId());
if (ObjUtil.notEqual(conversation.getUserId(), userId)) { if (ObjUtil.notEqual(conversation.getUserId(), userId)) {
...@@ -138,7 +141,7 @@ public class AiChatMessageServiceImpl implements AiChatMessageService { ...@@ -138,7 +141,7 @@ public class AiChatMessageServiceImpl implements AiChatMessageService {
} }
private Prompt buildPrompt(AiChatConversationDO conversation, List<AiChatMessageDO> messages, private Prompt buildPrompt(AiChatConversationDO conversation, List<AiChatMessageDO> messages,
AiChatModelDO model, AiChatMessageSendReqVO sendReqVO) { AiChatModelDO model, AiChatMessageSendReqVO sendReqVO) throws MalformedURLException {
// 1. 构建 Prompt Message 列表 // 1. 构建 Prompt Message 列表
List<Message> chatMessages = new ArrayList<>(); List<Message> chatMessages = new ArrayList<>();
// 1.1 system context 角色设定 // 1.1 system context 角色设定
...@@ -149,7 +152,14 @@ public class AiChatMessageServiceImpl implements AiChatMessageService { ...@@ -149,7 +152,14 @@ public class AiChatMessageServiceImpl implements AiChatMessageService {
List<AiChatMessageDO> contextMessages = filterContextMessages(messages, conversation, sendReqVO); List<AiChatMessageDO> contextMessages = filterContextMessages(messages, conversation, sendReqVO);
contextMessages.forEach(message -> chatMessages.add(AiUtils.buildMessage(message.getType(), message.getContent()))); contextMessages.forEach(message -> chatMessages.add(AiUtils.buildMessage(message.getType(), message.getContent())));
// 1.3 user message 新发送消息 // 1.3 user message 新发送消息
chatMessages.add(new UserMessage(sendReqVO.getContent())); UserMessage send_message;
if(sendReqVO.getFileUrl() != null){
send_message = new UserMessage(sendReqVO.getContent(), new Media(MimeTypeUtils.TEXT_PLAIN, new URL(sendReqVO.getFileUrl())));
} else {
send_message = new UserMessage(sendReqVO.getContent());
}
chatMessages.add(send_message);
// 2. 构建 ChatOptions 对象 // 2. 构建 ChatOptions 对象
AiPlatformEnum platform = AiPlatformEnum.validatePlatform(model.getPlatform()); AiPlatformEnum platform = AiPlatformEnum.validatePlatform(model.getPlatform());
......
import { resolve } from 'path'
import Vue from '@vitejs/plugin-vue'
import VueJsx from '@vitejs/plugin-vue-jsx'
import progress from 'vite-plugin-progress'
import EslintPlugin from 'vite-plugin-eslint'
import PurgeIcons from 'vite-plugin-purge-icons'
import { ViteEjsPlugin } from 'vite-plugin-ejs'
// @ts-ignore
import ElementPlus from 'unplugin-element-plus/vite'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import viteCompression from 'vite-plugin-compression'
import topLevelAwait from 'vite-plugin-top-level-await'
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import UnoCSS from 'unocss/vite'
export function createVitePlugins() {
const root = process.cwd()
// 路径查找
function pathResolve(dir: string) {
return resolve(root, '.', dir)
}
return [
Vue(),
VueJsx(),
UnoCSS(),
progress(),
PurgeIcons(),
ElementPlus({}),
AutoImport({
include: [
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
/\.vue$/,
/\.vue\?vue/, // .vue
/\.md$/ // .md
],
imports: [
'vue',
'vue-router',
// 可额外添加需要 autoImport 的组件
{
'@/hooks/web/useI18n': ['useI18n'],
'@/hooks/web/useMessage': ['useMessage'],
'@/hooks/web/useTable': ['useTable'],
'@/hooks/web/useCrudSchemas': ['useCrudSchemas'],
'@/utils/formRules': ['required'],
'@/utils/dict': ['DICT_TYPE']
}
],
dts: 'src/types/auto-imports.d.ts',
resolvers: [ElementPlusResolver()],
eslintrc: {
enabled: false, // Default `false`
filepath: './.eslintrc-auto-import.json', // Default `./.eslintrc-auto-import.json`
globalsPropValue: true // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
}
}),
Components({
// 生成自定义 `auto-components.d.ts` 全局声明
dts: 'src/types/auto-components.d.ts',
// 自定义组件的解析器
resolvers: [ElementPlusResolver()],
globs: ["src/components/**/**.{vue, md}", '!src/components/DiyEditor/components/mobile/**']
}),
EslintPlugin({
cache: false,
include: ['src/**/*.vue', 'src/**/*.ts', 'src/**/*.tsx'] // 检查的文件
}),
VueI18nPlugin({
runtimeOnly: true,
compositionOnly: true,
include: [resolve(__dirname, 'src/locales/**')]
}),
createSvgIconsPlugin({
iconDirs: [pathResolve('src/assets/svgs')],
symbolId: 'icon-[dir]-[name]',
svgoOptions: true
}),
viteCompression({
verbose: true, // 是否在控制台输出压缩结果
disable: false, // 是否禁用
threshold: 10240, // 体积大于 threshold 才会被压缩,单位 b
algorithm: 'gzip', // 压缩算法,可选 [ 'gzip' , 'brotliCompress' ,'deflate' , 'deflateRaw']
ext: '.gz', // 生成的压缩包后缀
deleteOriginFile: false //压缩后是否删除源文件
}),
ViteEjsPlugin(),
topLevelAwait({
// https://juejin.cn/post/7152191742513512485
// The export name of top-level await promise for each chunk module
promiseExportName: '__tla',
// The function to generate import names of top-level await promise in each chunk module
promiseImportName: (i) => `__tla_${i}`
})
]
}
const include = [
'qs',
'url',
'vue',
'sass',
'mitt',
'axios',
'pinia',
'dayjs',
'qrcode',
'unocss',
'vue-router',
'vue-types',
'vue-i18n',
'crypto-js',
'cropperjs',
'lodash-es',
'nprogress',
'web-storage-cache',
'@iconify/iconify',
'@vueuse/core',
'@zxcvbn-ts/core',
'echarts/core',
'echarts/charts',
'echarts/components',
'echarts/renderers',
'echarts-wordcloud',
'@wangeditor/editor',
'@wangeditor/editor-for-vue',
'element-plus',
'element-plus/es',
'element-plus/es/locale/lang/zh-cn',
'element-plus/es/locale/lang/en',
'element-plus/es/components/avatar/style/css',
'element-plus/es/components/space/style/css',
'element-plus/es/components/backtop/style/css',
'element-plus/es/components/form/style/css',
'element-plus/es/components/radio-group/style/css',
'element-plus/es/components/radio/style/css',
'element-plus/es/components/checkbox/style/css',
'element-plus/es/components/checkbox-group/style/css',
'element-plus/es/components/switch/style/css',
'element-plus/es/components/time-picker/style/css',
'element-plus/es/components/date-picker/style/css',
'element-plus/es/components/descriptions/style/css',
'element-plus/es/components/descriptions-item/style/css',
'element-plus/es/components/link/style/css',
'element-plus/es/components/tooltip/style/css',
'element-plus/es/components/drawer/style/css',
'element-plus/es/components/dialog/style/css',
'element-plus/es/components/checkbox-button/style/css',
'element-plus/es/components/option-group/style/css',
'element-plus/es/components/radio-button/style/css',
'element-plus/es/components/cascader/style/css',
'element-plus/es/components/color-picker/style/css',
'element-plus/es/components/input-number/style/css',
'element-plus/es/components/rate/style/css',
'element-plus/es/components/select-v2/style/css',
'element-plus/es/components/tree-select/style/css',
'element-plus/es/components/slider/style/css',
'element-plus/es/components/time-select/style/css',
'element-plus/es/components/autocomplete/style/css',
'element-plus/es/components/image-viewer/style/css',
'element-plus/es/components/upload/style/css',
'element-plus/es/components/col/style/css',
'element-plus/es/components/form-item/style/css',
'element-plus/es/components/alert/style/css',
'element-plus/es/components/breadcrumb/style/css',
'element-plus/es/components/select/style/css',
'element-plus/es/components/input/style/css',
'element-plus/es/components/breadcrumb-item/style/css',
'element-plus/es/components/tag/style/css',
'element-plus/es/components/pagination/style/css',
'element-plus/es/components/table/style/css',
'element-plus/es/components/table-v2/style/css',
'element-plus/es/components/table-column/style/css',
'element-plus/es/components/card/style/css',
'element-plus/es/components/row/style/css',
'element-plus/es/components/button/style/css',
'element-plus/es/components/menu/style/css',
'element-plus/es/components/sub-menu/style/css',
'element-plus/es/components/menu-item/style/css',
'element-plus/es/components/option/style/css',
'element-plus/es/components/dropdown/style/css',
'element-plus/es/components/dropdown-menu/style/css',
'element-plus/es/components/dropdown-item/style/css',
'element-plus/es/components/skeleton/style/css',
'element-plus/es/components/skeleton/style/css',
'element-plus/es/components/backtop/style/css',
'element-plus/es/components/menu/style/css',
'element-plus/es/components/sub-menu/style/css',
'element-plus/es/components/menu-item/style/css',
'element-plus/es/components/dropdown/style/css',
'element-plus/es/components/tree/style/css',
'element-plus/es/components/dropdown-menu/style/css',
'element-plus/es/components/dropdown-item/style/css',
'element-plus/es/components/badge/style/css',
'element-plus/es/components/breadcrumb/style/css',
'element-plus/es/components/breadcrumb-item/style/css',
'element-plus/es/components/image/style/css',
'element-plus/es/components/collapse-transition/style/css',
'element-plus/es/components/timeline/style/css',
'element-plus/es/components/timeline-item/style/css',
'element-plus/es/components/collapse/style/css',
'element-plus/es/components/collapse-item/style/css',
'element-plus/es/components/button-group/style/css',
'element-plus/es/components/text/style/css'
]
const exclude = ['@iconify/json']
export { include, exclude }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment