fix CopyFile api
This commit is contained in:
		
							parent
							
								
									89c8545528
								
							
						
					
					
						commit
						5e4f6159be
					
				@ -106,7 +106,7 @@ func (a *App) CopyFile(src string, dst string) error {
 | 
			
		||||
	}
 | 
			
		||||
	defer destFile.Close()
 | 
			
		||||
 | 
			
		||||
	_, err = io.Copy(sourceFile, destFile)
 | 
			
		||||
	_, err = io.Copy(destFile, sourceFile)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -138,12 +138,16 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean
 | 
			
		||||
            let customCudaFile = '';
 | 
			
		||||
            if (modelConfig.modelParameters.useCustomCuda) {
 | 
			
		||||
              customCudaFile = getSupportedCustomCudaFile();
 | 
			
		||||
              if (customCudaFile)
 | 
			
		||||
              if (customCudaFile) {
 | 
			
		||||
                FileExists('./py310/Lib/site-packages/rwkv/model.py').then((exist) => {
 | 
			
		||||
                  // defensive measure. As Python has already been launched, will only take effect the next time it runs.
 | 
			
		||||
                  if (!exist) CopyFile('./backend-python/wkv_cuda_utils/wkv_cuda_model.py', './py310/Lib/site-packages/rwkv/model.py');
 | 
			
		||||
                });
 | 
			
		||||
                await CopyFile(customCudaFile, './py310/Lib/site-packages/rwkv/wkv_cuda.pyd').catch(() => {
 | 
			
		||||
                  customCudaFile = '';
 | 
			
		||||
                  toast(t('Failed to copy custom cuda file'), { type: 'error' });
 | 
			
		||||
                });
 | 
			
		||||
              else
 | 
			
		||||
              } else
 | 
			
		||||
                toast(t('Supported custom cuda file not found'), { type: 'warning' });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user