@@ -21,7 +21,7 @@ import configService from '@/service/config';
2121// import NewEditor from './NewMonacoEditor';
2222import styles from './index.less' ;
2323import indexedDB from '@/indexedDB' ;
24- import { isEmpty } from 'lodash' ;
24+ import { isEmpty , set } from 'lodash' ;
2525
2626enum IPromptType {
2727 NL_2_SQL = 'NL_2_SQL' ,
@@ -114,6 +114,10 @@ function Console(props: IProps) {
114114 [ aiModel . aiConfig ?. aiSqlSource ] ,
115115 ) ;
116116
117+ useEffect ( ( ) => {
118+ handleSelectTableSyncModel ( ) ;
119+ } , [ aiModel . hasWhite , localStorage . getItem ( 'syncTableModel' ) ] ) ;
120+
117121 useEffect ( ( ) => {
118122 if ( appendValue ) {
119123 editorRef ?. current ?. setValue ( appendValue . text , appendValue . range ) ;
@@ -430,14 +434,11 @@ function Console(props: IProps) {
430434 const syncModel : SyncModelType | null = Number ( localStorage . getItem ( 'syncTableModel' ) ) ?? null ;
431435 const hasAiAccess = aiModel . hasWhite ;
432436
433- if ( ! hasAiAccess ) {
434- return SyncModelType . MANUAL ;
437+ if ( ! hasAiAccess || isEmpty ( syncModel ) ) {
438+ setSyncTableModel ( SyncModelType . MANUAL ) ;
435439 }
436440
437- if ( isEmpty ( syncModel ) ) {
438- return SyncModelType . MANUAL ;
439- }
440- return syncModel ;
441+ setSyncTableModel ( syncModel ) ;
441442 } ;
442443
443444 return (
@@ -465,7 +466,6 @@ function Console(props: IProps) {
465466 } }
466467 onClickRemainBtn = { handleClickRemainBtn }
467468 syncTableModel = { syncTableModel }
468- defaultSelectedSyncModel = { handleSelectTableSyncModel ( ) }
469469 onSelectTableSyncModel = { ( model : number ) => {
470470 setSyncTableModel ( model ) ;
471471 localStorage . setItem ( 'syncTableModel' , String ( model ) ) ;
0 commit comments