mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-05 11:01:09 +00:00
fix(web): Fix sql format error (#1319)
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { Datum } from '@antv/ava';
|
||||
import { Table, Tabs, TabsProps } from 'antd';
|
||||
import React from 'react';
|
||||
import { format } from 'sql-formatter';
|
||||
import { AutoChart, BackEndChartType, getChartType } from '@/components/chart/autoChart';
|
||||
import { CodePreview } from './code-preview';
|
||||
import { formatSql } from '@/utils';
|
||||
|
||||
function ChartView({ data, type, sql }: { data: Datum[]; type: BackEndChartType; sql: string }) {
|
||||
const columns = data?.[0]
|
||||
@@ -20,10 +20,11 @@ function ChartView({ data, type, sql }: { data: Datum[]; type: BackEndChartType;
|
||||
label: 'Chart',
|
||||
children: <AutoChart data={data} chartType={getChartType(type)} />,
|
||||
};
|
||||
|
||||
const SqlItem = {
|
||||
key: 'sql',
|
||||
label: 'SQL',
|
||||
children: <CodePreview language="sql" code={format(sql ?? '', { language: 'mysql' }) as string} />,
|
||||
children: <CodePreview language="sql" code={formatSql(sql)} />,
|
||||
};
|
||||
const DataItem = {
|
||||
key: 'data',
|
||||
|
Reference in New Issue
Block a user