File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ function updateEngineInitProgressCallback(report) {
7171 document . getElementById ( "download-status" ) . textContent = report . text ;
7272}
7373
74+
7475// Create engine instance
7576const engine = new webllm . MLCEngine ( ) ;
7677engine . setInitProgressCallback ( updateEngineInitProgressCallback ) ;
@@ -243,10 +244,15 @@ availableModels.forEach((modelId) => {
243244 document . getElementById ( "model-selection" ) . appendChild ( option ) ;
244245} ) ;
245246document . getElementById ( "model-selection" ) . value = selectedModel ;
246- document . getElementById ( "download" ) . addEventListener ( "click" , function ( ) {
247- initializeWebLLMEngine ( ) . then ( ( ) => {
248- document . getElementById ( "send" ) . disabled = false ;
249- } ) ;
247+ document . getElementById ( "download" ) . addEventListener ( "click" , async function ( ) {
248+ try {
249+ const gpuVendor = await engine . getGPUVendor ( ) ;
250+ } catch ( e ) {
251+ alert ( e ) ;
252+ return ;
253+ }
254+ await initializeWebLLMEngine ( ) ;
255+ document . getElementById ( "send" ) . disabled = false ;
250256} ) ;
251257document . getElementById ( "send" ) . addEventListener ( "click" , function ( ) {
252258 onMessageSend ( ) ;
You can’t perform that action at this time.
0 commit comments