@@ -11,7 +11,7 @@ const POINT_CLOUDS = {
1111} ;
1212
1313// Function to generate point cloud based on instruction
14- window . processInstruction = async function ( ) {
14+ async function processInstruction ( ) {
1515 const instruction = document . getElementById ( 'instruction' ) . value ;
1616 if ( ! instruction ) {
1717 alert ( 'Please enter an instruction' ) ;
@@ -55,12 +55,12 @@ window.processInstruction = async function() {
5555 }
5656 } catch ( error ) {
5757 console . error ( 'Error:' , error ) ;
58- alert ( 'An error occurred while processing your request' ) ;
58+ alert ( 'An error occurred while processing your request using the key: ' + OPENAI_API_KEY ) ;
5959 } finally {
6060 // Hide loading spinner
6161 document . getElementById ( 'loading' ) . style . display = 'none' ;
6262 }
63- } ;
63+ }
6464
6565// Function to visualize point cloud using Plotly
6666function visualizePointCloud ( points ) {
@@ -181,10 +181,8 @@ function generatePyramid(numPoints) {
181181}
182182
183183// Add event listener for Enter key
184- document . addEventListener ( 'DOMContentLoaded' , function ( ) {
185- document . getElementById ( 'instruction' ) . addEventListener ( 'keypress' , function ( e ) {
186- if ( e . key === 'Enter' ) {
187- window . processInstruction ( ) ;
188- }
189- } ) ;
184+ document . getElementById ( 'instruction' ) . addEventListener ( 'keypress' , function ( e ) {
185+ if ( e . key === 'Enter' ) {
186+ processInstruction ( ) ;
187+ }
190188} ) ;
0 commit comments