mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-03 01:54:44 +00:00
Feat: optimize dashboard UI and fix sql highlight (#1329)
Co-authored-by: hzh97 <2976151305@qq.com> Co-authored-by: aries_ckt <916701291@qq.com>
This commit is contained in:
@@ -9,9 +9,9 @@ import Header from './header';
|
||||
import Chart from '../chart';
|
||||
import classNames from 'classnames';
|
||||
import MuiLoading from '../common/loading';
|
||||
import { Empty } from 'antd';
|
||||
import { useSearchParams } from 'next/navigation';
|
||||
import { getInitMessage } from '@/utils';
|
||||
import MyEmpty from '../common/MyEmpty';
|
||||
|
||||
const ChatContainer = () => {
|
||||
const searchParams = useSearchParams();
|
||||
@@ -33,7 +33,7 @@ const ChatContainer = () => {
|
||||
const contextTemp = list[list.length - 1]?.context;
|
||||
if (contextTemp) {
|
||||
try {
|
||||
const contextObj = JSON.parse(contextTemp);
|
||||
const contextObj = typeof contextTemp === 'string' ? JSON.parse(contextTemp) : contextTemp;
|
||||
setChartsData(contextObj?.template_name === 'report' ? contextObj?.charts : undefined);
|
||||
} catch (e) {
|
||||
setChartsData(undefined);
|
||||
@@ -113,21 +113,15 @@ const ChatContainer = () => {
|
||||
/>
|
||||
<div className="px-4 flex flex-1 flex-wrap overflow-hidden relative">
|
||||
{!!chartsData?.length && (
|
||||
<div className="w-full pb-4 xl:w-3/4 h-3/5 xl:pr-4 xl:h-full overflow-y-auto">
|
||||
<div className="w-full pb-4 xl:w-3/4 h-1/2 xl:pr-4 xl:h-full overflow-y-auto">
|
||||
<Chart chartsData={chartsData} />
|
||||
</div>
|
||||
)}
|
||||
{!chartsData?.length && scene === 'chat_dashboard' && (
|
||||
<Empty
|
||||
image="/empty.png"
|
||||
imageStyle={{ width: 320, height: 320, margin: '0 auto', maxWidth: '100%', maxHeight: '100%' }}
|
||||
className="w-full xl:w-3/4 h-3/5 xl:h-full pt-0 md:pt-10"
|
||||
/>
|
||||
)}
|
||||
{!chartsData?.length && scene === 'chat_dashboard' && <MyEmpty className="w-full xl:w-3/4 h-1/2 xl:h-full" />}
|
||||
{/** chat panel */}
|
||||
<div
|
||||
className={classNames('flex flex-1 flex-col overflow-hidden', {
|
||||
'px-0 xl:pl-4 h-2/5 w-full xl:w-auto xl:h-full border-t xl:border-t-0 xl:border-l dark:border-gray-800': scene === 'chat_dashboard',
|
||||
'px-0 xl:pl-4 h-1/2 w-full xl:w-auto xl:h-full border-t xl:border-t-0 xl:border-l dark:border-gray-800': scene === 'chat_dashboard',
|
||||
'h-full lg:px-8': scene !== 'chat_dashboard',
|
||||
})}
|
||||
>
|
||||
|
Reference in New Issue
Block a user