fix: duplicate dependence & pick gpt-vis upgrade

This commit is contained in:
hustcc
2024-09-03 15:04:07 +08:00
parent 0d0fbeb457
commit f070db8db8
4 changed files with 608 additions and 485 deletions

View File

@@ -77,7 +77,7 @@ For full documentation, visit [document](https://docs.dbgpt.site/).
## Usage ## Usage
[react-markdown](https://github.com/remarkjs/react-markdown#readme) for markdown support. [gpt-vis](https://github.com/eosphoros-ai/DB-GPT/gpt-vis) for markdown support.
[ant-design](https://github.com/ant-design/ant-design) for ui components. [ant-design](https://github.com/ant-design/ant-design) for ui components.
[next.js](https://github.com/vercel/next.js) for server side rendering. [next.js](https://github.com/vercel/next.js) for server side rendering.
[@antv/g2](https://github.com/antvis/g2#readme) for charts. [@antv/g2](https://github.com/antvis/g2#readme) for charts.

View File

@@ -13,8 +13,8 @@ import { GPTVis } from '@antv/gpt-vis';
import { Tag } from 'antd'; import { Tag } from 'antd';
import classNames from 'classnames'; import classNames from 'classnames';
import { PropsWithChildren, ReactNode, memo, useContext, useMemo } from 'react'; import { PropsWithChildren, ReactNode, memo, useContext, useMemo } from 'react';
import ReactMarkdown from 'react-markdown';
import rehypeRaw from 'rehype-raw'; import rehypeRaw from 'rehype-raw';
import remarkGfm from 'remark-gfm';
import { renderModelIcon } from '../header/model-selector'; import { renderModelIcon } from '../header/model-selector';
import markdownComponents from './config'; import markdownComponents from './config';
@@ -131,9 +131,9 @@ function ChatContent({ children, content, isChartChat, onLinkClick }: PropsWithC
</div> </div>
{result ? ( {result ? (
<div className='px-4 md:px-6 py-4 text-sm'> <div className='px-4 md:px-6 py-4 text-sm'>
<ReactMarkdown components={markdownComponents} rehypePlugins={[rehypeRaw]}> <GPTVis components={markdownComponents} rehypePlugins={[rehypeRaw]} remarkPlugins={[remarkGfm]}>
{result ?? ''} {result ?? ''}
</ReactMarkdown> </GPTVis>
</div> </div>
) : ( ) : (
<div className='px-4 md:px-6 py-4 text-sm'>{err_msg}</div> <div className='px-4 md:px-6 py-4 text-sm'>{err_msg}</div>
@@ -172,7 +172,11 @@ function ChatContent({ children, content, isChartChat, onLinkClick }: PropsWithC
)} )}
{/* Markdown */} {/* Markdown */}
{isRobot && typeof context === 'string' && ( {isRobot && typeof context === 'string' && (
<GPTVis components={{ ...markdownComponents, ...extraMarkdownComponents }} rehypePlugins={[rehypeRaw]}> <GPTVis
components={{ ...markdownComponents, ...extraMarkdownComponents }}
rehypePlugins={[rehypeRaw]}
remarkPlugins={[remarkGfm]}
>
{formatMarkdownVal(value)} {formatMarkdownVal(value)}
</GPTVis> </GPTVis>
)} )}

View File

@@ -53,33 +53,23 @@
"cytoscape": "^3.29.2", "cytoscape": "^3.29.2",
"cytoscape-euler": "^1.2.2", "cytoscape-euler": "^1.2.2",
"eslint-plugin-prettier": "^5.2.1", "eslint-plugin-prettier": "^5.2.1",
"framer-motion": "^10.16.4",
"google-auth-library": "^9.2.0",
"google-one-tap": "^1.0.6",
"dayjs": "^1.11.12", "dayjs": "^1.11.12",
"i18next": "^23.4.5", "i18next": "^23.4.5",
"iron-session": "^6.3.1", "iron-session": "^6.3.1",
"iron-session": "^6.3.1",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"markdown-it": "^14.1.0", "markdown-it": "^14.1.0",
"markdown-it": "^14.1.0",
"moment": "^2.29.4", "moment": "^2.29.4",
"monaco-editor": ">=0.31.0", "monaco-editor": ">=0.31.0",
"multer": "^1.4.5-lts.1", "multer": "^1.4.5-lts.1",
"mysql2": "^3.6.2", "mysql2": "^3.6.2",
"multer": "^1.4.5-lts.1",
"mysql2": "^3.6.2",
"next": "13.4.7", "next": "13.4.7",
"next-auth": "^4.20.1", "next-auth": "^4.20.1",
"next-connect": "^1.0.0-next.4", "next-connect": "^1.0.0-next.4",
"next-transpile-modules": "^10.0.1", "next-transpile-modules": "^10.0.1",
"next-connect": "^1.0.0-next.4",
"next-transpile-modules": "^10.0.1",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-i18next": "^13.2.0", "react-i18next": "^13.2.0",
"react-markdown": "^8.0.7",
"react-markdown-editor-lite": "^1.3.4", "react-markdown-editor-lite": "^1.3.4",
"react-syntax-highlighter": "^15.5.0", "react-syntax-highlighter": "^15.5.0",
"react-virtualized": "^9.22.5", "react-virtualized": "^9.22.5",
@@ -127,5 +117,20 @@
"*.{json,md}": [ "*.{json,md}": [
"prettier --write" "prettier --write"
] ]
},
"resolutions": {
"d3-color": "2",
"d3-array": "2",
"d3-shape": "2",
"d3-path": "2",
"d3-dsv": "2",
"d3-hierarchy": "2",
"d3-scale-chromatic": "2",
"d3-format": "2",
"d3-timer": "2",
"d3-dispatch": "2",
"d3-quadtree": "2",
"d3-force": "2",
"d3-geo": "2"
} }
} }

File diff suppressed because it is too large Load Diff