balibabu commited on
Commit
1006946
·
1 Parent(s): c2bd02f

feat: Configure the root directory alias #1739 (#2875)

Browse files

### 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 CHANGED
@@ -1,3 +1,4 @@
 
1
  import { defineConfig } from 'umi';
2
  import { appName } from './src/conf.json';
3
  import routes from './src/routes';
@@ -5,7 +6,7 @@ import routes from './src/routes';
5
  export default defineConfig({
6
  title: appName,
7
  outputPath: 'dist',
8
- // alias: { '@': './src' },
9
  npmClient: 'npm',
10
  base: '/',
11
  routes,
 
1
+ import path from 'path';
2
  import { defineConfig } from 'umi';
3
  import { appName } from './src/conf.json';
4
  import routes from './src/routes';
 
6
  export default defineConfig({
7
  title: appName,
8
  outputPath: 'dist',
9
+ alias: { root: path.resolve('../') },
10
  npmClient: 'npm',
11
  base: '/',
12
  routes,
web/src/components/api-service/chat-overview-modal/api-content.tsx CHANGED
@@ -1,7 +1,8 @@
1
  import HightLightMarkdown from '@/components/highlight-markdown';
2
  import { useSetModalState, useTranslate } from '@/hooks/common-hooks';
3
  import { Button, Card, Flex, Space } from 'antd';
4
- import apiDoc from '../../../../../docs/references/api.md';
 
5
  import ChatApiKeyModal from '../chat-api-key-modal';
6
  import EmbedModal from '../embed-modal';
7
  import { usePreviewChat, useShowEmbedModal } from '../hooks';
 
1
  import HightLightMarkdown from '@/components/highlight-markdown';
2
  import { useSetModalState, useTranslate } from '@/hooks/common-hooks';
3
  import { Button, Card, Flex, Space } from 'antd';
4
+ // import apiDoc from '../../../../../api/http_api.md';
5
+ import apiDoc from 'root/api/http_api.md';
6
  import ChatApiKeyModal from '../chat-api-key-modal';
7
  import EmbedModal from '../embed-modal';
8
  import { usePreviewChat, useShowEmbedModal } from '../hooks';
web/src/components/highlight-markdown/index.less CHANGED
@@ -4,9 +4,9 @@
4
  li {
5
  padding: 4px 0px;
6
  }
7
- p {
8
- white-space: pre-wrap; // https://stackoverflow.com/questions/60332183/new-line-with-react-markdown
9
- }
10
  }
11
 
12
  .code {
 
4
  li {
5
  padding: 4px 0px;
6
  }
7
+ // p {
8
+ // white-space: pre-wrap; // https://stackoverflow.com/questions/60332183/new-line-with-react-markdown
9
+ // }
10
  }
11
 
12
  .code {
web/tsconfig.json CHANGED
@@ -1,4 +1,5 @@
1
  {
2
  "extends": "./src/.umi/tsconfig.json",
3
  "@@/*": ["src/.umi/*"],
 
4
  }
 
1
  {
2
  "extends": "./src/.umi/tsconfig.json",
3
  "@@/*": ["src/.umi/*"],
4
+ "root": ["../*"],
5
  }