mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-09 12:59:43 +00:00
fix(web): Fix sql format error (#1319)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { format } from 'sql-formatter';
|
||||
|
||||
/** Theme */
|
||||
export const STORAGE_THEME_KEY = '__db_gpt_theme_key';
|
||||
/** Language */
|
||||
@@ -7,5 +9,14 @@ export const STORAGE_INIT_MESSAGE_KET = '__db_gpt_im_key';
|
||||
/** Flow nodes */
|
||||
export const FLOW_NODES_KEY = '__db_gpt_static_flow_nodes_key';
|
||||
|
||||
export function formatSql(sql: string, lang?: string) {
|
||||
if (!sql) return '';
|
||||
try {
|
||||
return format(sql, { language: lang });
|
||||
} catch (e) {
|
||||
return sql;
|
||||
}
|
||||
}
|
||||
|
||||
export * from './storage';
|
||||
export * from './constants';
|
||||
|
Reference in New Issue
Block a user