@@ -73,10 +73,12 @@ var app = new Vue({
7373 modelSpec : LLM_SPECS [ 0 ] ,
7474 budget : 50 ,
7575 showParams : false ,
76+ showResetConfirmation : false ,
7677 enableChartDiagram : true ,
7778 enableLogging : false ,
7879 enableConcurrency : false ,
7980 optimize : false ,
81+ enableMultiStepAttack : false ,
8082 showDatasets : false ,
8183 scanResults : [ ] ,
8284 mainTable : [ ] ,
@@ -117,6 +119,7 @@ var app = new Vue({
117119 this . adjustHeight ( { target : document . getElementById ( 'llm-spec' ) } ) ;
118120 // this.startScan();
119121 this . loadConfigs ( ) ;
122+
120123 } ,
121124 computed : {
122125 selectedDS : function ( ) {
@@ -131,6 +134,45 @@ var app = new Vue({
131134 this . showConsentModal = false ; // Close the modal
132135 localStorage . setItem ( 'consentGiven' , 'true' ) ; // Save consent to local storage
133136 } ,
137+
138+ saveStateToLocalStorage ( ) {
139+ const state = {
140+ modelSpec : this . modelSpec ,
141+ budget : this . budget ,
142+ dataConfig : this . dataConfig ,
143+ optimize : this . optimize ,
144+ enableChartDiagram : this . enableChartDiagram ,
145+ } ;
146+ localStorage . setItem ( 'appState' , JSON . stringify ( state ) ) ;
147+ } ,
148+ loadStateFromLocalStorage ( ) {
149+ const savedState = localStorage . getItem ( 'appState' ) ;
150+ console . log ( 'Loading state from local storage:' , savedState ) ;
151+ if ( savedState ) {
152+ const state = JSON . parse ( savedState ) ;
153+ this . modelSpec = state . modelSpec ;
154+ this . budget = state . budget ;
155+ this . dataConfig = state . dataConfig ;
156+ this . optimize = state . optimize ;
157+ this . enableChartDiagram = state . enableChartDiagram ;
158+ }
159+ } ,
160+ resetState ( ) {
161+ localStorage . removeItem ( 'appState' ) ;
162+ this . modelSpec = LLM_SPECS [ 0 ] ;
163+ this . budget = 50 ;
164+ this . dataConfig . forEach ( config => config . selected = false ) ;
165+ this . optimize = false ;
166+ this . enableChartDiagram = true ;
167+ this . okMsg = '' ;
168+ this . errorMsg = '' ;
169+ this . integrationVerified = false ;
170+ this . showResetConfirmation = false ;
171+ } ,
172+ confirmResetState ( ) {
173+ this . showResetConfirmation = true ;
174+ } ,
175+
134176 declineConsent ( ) {
135177 this . showConsentModal = false ; // Close the modal
136178 localStorage . setItem ( 'consentGiven' , 'false' ) ; // Save decline to local storage
@@ -186,6 +228,7 @@ var app = new Vue({
186228 // this.$forceUpdate();
187229
188230 }
231+ this . saveStateToLocalStorage ( ) ;
189232 } ,
190233 loadConfigs : async function ( ) {
191234 const response = await fetch ( `${ URL } /v1/data-config` , {
@@ -196,6 +239,7 @@ var app = new Vue({
196239 } ) ;
197240 console . log ( response ) ;
198241 this . dataConfig = await response . json ( ) ;
242+ this . loadStateFromLocalStorage ( ) ;
199243 } ,
200244 selectConfig ( index ) {
201245 this . selectedConfig = index ;
@@ -413,6 +457,8 @@ var app = new Vue({
413457 }
414458 } ) ;
415459 }
460+ this . saveStateToLocalStorage ( ) ;
461+
416462 }
417463 }
418464} ) ;
0 commit comments