File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed
Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 3434
3535# Add the parent directory to sys.path to import from chat package
3636sys .path .append (os .path .dirname (os .path .dirname (os .path .abspath (__file__ ))))
37- from chat .chat import create_chat_completion
37+ from prototype . chat .chat import create_chat_completion
3838
3939app = Flask (__name__ )
4040app .config ['SECRET_KEY' ] = 'hackathon-demo-secret-key'
Original file line number Diff line number Diff line change @@ -178,6 +178,8 @@ document.addEventListener('DOMContentLoaded', function() {
178178
179179 document . getElementById ( "addInsightForm" ) . addEventListener ( "submit" , async function ( event ) {
180180 event . preventDefault ( ) ;
181+ saveInsightLoadingSpinner . classList . remove ( "d-none" ) ; // Show loading spinner while saving
182+ savingInsightMessage . classList . remove ( "d-none" ) ; // Hide previous message
181183
182184 // Get form values
183185 const category = document . getElementById ( "category" ) . value ;
@@ -200,16 +202,23 @@ document.addEventListener('DOMContentLoaded', function() {
200202
201203 if ( ! response . ok ) {
202204 document . getElementById ( "addInsightErrorMessage" ) . classList . remove ( "d-none" ) ;
205+ saveInsightLoadingSpinner . classList . add ( "d-none" ) ;
206+ savingInsightMessage . classList . add ( "d-none" ) ;
203207 } else {
204208 // Show success message
205209 document . getElementById ( "addInsightSuccessMessage" ) . classList . remove ( "d-none" ) ;
206210
211+ saveInsightLoadingSpinner . classList . add ( "d-none" ) ;
212+ savingInsightMessage . classList . add ( "d-none" ) ;
213+
207214 // Clear input fields but keep form open
208215 document . getElementById ( "category" ) . value = "" ;
209216 document . getElementById ( "details" ) . value = "" ;
210217 }
211218 } catch ( error ) {
212219 document . getElementById ( "addInsightErrorMessage" ) . classList . remove ( "d-none" ) ;
220+ saveInsightLoadingSpinner . classList . add ( "d-none" ) ;
221+ savingInsightMessage . classList . add ( "d-none" ) ;
213222 }
214223
215224 } ) ;
Original file line number Diff line number Diff line change @@ -422,7 +422,12 @@ <h6 class="mb-0"><i class="fas fa-lightbulb me-2"></i> Add Insight</h6>
422422 < textarea class ="form-control " id ="details " rows ="3 " required > </ textarea >
423423 </ div >
424424 < div class ="d-flex justify-content-between ">
425- < button type ="submit " class ="btn btn-primary "> Save Insight</ button >
425+ < button type ="submit " class ="btn btn-primary saveInsightButton "> Save Insight</ button >
426+ <!-- Save Insight Generation Spinner -->
427+ < div id ="saveInsightLoadingSpinner " class ="spinner-border text-primary ms-3 d-none " role ="status ">
428+ < span class ="visually-hidden "> Saving Insight...</ span > <!-- Hidden for screen readers -->
429+ </ div >
430+ < span id ="savingInsightMessage " class ="ms-2 d-none "> Saving Insight...</ span >
426431 < button type ="button " class ="btn btn-outline-secondary " id ="cancelAddInsight "> Cancel</ button >
427432 </ div >
428433 </ form >
You can’t perform that action at this time.
0 commit comments