From bedb05012d23d335ef295d8bde28e4344d2a7599 Mon Sep 17 00:00:00 2001 From: balibabu Date: Thu, 17 Oct 2024 11:36:01 +0800 Subject: [PATCH] feat: Configure the root directory alias #1739 (#2875) ### What problem does this PR solve? feat: Configure the root directory alias #1739 ### Type of change - [ ] Bug Fix (non-breaking change which fixes an issue) - [x] New Feature (non-breaking change which adds functionality) - [ ] Documentation Update - [ ] Refactoring - [ ] Performance Improvement - [ ] Other (please describe): --- web/.umirc.ts | 3 ++- .../api-service/chat-overview-modal/api-content.tsx | 3 ++- web/src/components/highlight-markdown/index.less | 6 +++--- web/tsconfig.json | 1 + 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/web/.umirc.ts b/web/.umirc.ts index f9a42973b..5bdb20417 100644 --- a/web/.umirc.ts +++ b/web/.umirc.ts @@ -1,3 +1,4 @@ +import path from 'path'; import { defineConfig } from 'umi'; import { appName } from './src/conf.json'; import routes from './src/routes'; @@ -5,7 +6,7 @@ import routes from './src/routes'; export default defineConfig({ title: appName, outputPath: 'dist', - // alias: { '@': './src' }, + alias: { root: path.resolve('../') }, npmClient: 'npm', base: '/', routes, diff --git a/web/src/components/api-service/chat-overview-modal/api-content.tsx b/web/src/components/api-service/chat-overview-modal/api-content.tsx index 786273f15..b620599ca 100644 --- a/web/src/components/api-service/chat-overview-modal/api-content.tsx +++ b/web/src/components/api-service/chat-overview-modal/api-content.tsx @@ -1,7 +1,8 @@ import HightLightMarkdown from '@/components/highlight-markdown'; import { useSetModalState, useTranslate } from '@/hooks/common-hooks'; import { Button, Card, Flex, Space } from 'antd'; -import apiDoc from '../../../../../docs/references/api.md'; +// import apiDoc from '../../../../../api/http_api.md'; +import apiDoc from 'root/api/http_api.md'; import ChatApiKeyModal from '../chat-api-key-modal'; import EmbedModal from '../embed-modal'; import { usePreviewChat, useShowEmbedModal } from '../hooks'; diff --git a/web/src/components/highlight-markdown/index.less b/web/src/components/highlight-markdown/index.less index 325a0c31b..cfc5f12da 100644 --- a/web/src/components/highlight-markdown/index.less +++ b/web/src/components/highlight-markdown/index.less @@ -4,9 +4,9 @@ li { padding: 4px 0px; } - p { - white-space: pre-wrap; // https://stackoverflow.com/questions/60332183/new-line-with-react-markdown - } + // p { + // white-space: pre-wrap; // https://stackoverflow.com/questions/60332183/new-line-with-react-markdown + // } } .code { diff --git a/web/tsconfig.json b/web/tsconfig.json index 824e6cc8d..588e43b5a 100644 --- a/web/tsconfig.json +++ b/web/tsconfig.json @@ -1,4 +1,5 @@ { "extends": "./src/.umi/tsconfig.json", "@@/*": ["src/.umi/*"], + "root": ["../*"], }