add path contains space prompt and chore
This commit is contained in:
		
							parent
							
								
									2b10ccd507
								
							
						
					
					
						commit
						1036852924
					
				@ -28,11 +28,11 @@ func Cmd(args ...string) (string, error) {
 | 
			
		||||
			return "", err
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		path, err := filepath.Abs(args[0])
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return "", err
 | 
			
		||||
		for _, arg := range args {
 | 
			
		||||
			if strings.Contains(arg, " ") && strings.Contains(cmdHelper, " ") {
 | 
			
		||||
				return "", errors.New("path contains space") // golang bug https://github.com/golang/go/issues/17149#issuecomment-473976818
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		args[0] = path
 | 
			
		||||
 | 
			
		||||
		cmd := exec.Command(cmdHelper, args...)
 | 
			
		||||
		out, err := cmd.CombinedOutput()
 | 
			
		||||
 | 
			
		||||
@ -133,5 +133,7 @@
 | 
			
		||||
  "Advanced": "高级",
 | 
			
		||||
  "Custom Python Path": "自定义Python路径",
 | 
			
		||||
  "Custom Models Path": "自定义模型路径",
 | 
			
		||||
  "MacOS is not supported yet, please convert manually.": "暂不支持MacOS, 请手动转换"
 | 
			
		||||
  "MacOS is not supported yet, please convert manually.": "暂不支持MacOS, 请手动转换",
 | 
			
		||||
  "Microsoft Visual C++ Redistributable is not installed, would you like to download it?": "微软VC++组件未安装, 是否下载?",
 | 
			
		||||
  "Path Cannot Contain Space": "路径不能包含空格"
 | 
			
		||||
}
 | 
			
		||||
@ -835,9 +835,9 @@ export const Configs: FC = observer(() => {
 | 
			
		||||
                  </div>
 | 
			
		||||
                } />
 | 
			
		||||
                <ToolTipButton text={t('Convert')} desc={t('Convert model with these configs')} onClick={async () => {
 | 
			
		||||
                  if(commonStore.platform=="darwin"){
 | 
			
		||||
                    toast(t("MacOS is not supported yet, please convert manually."), { type: 'info' })
 | 
			
		||||
                    return
 | 
			
		||||
                  if (commonStore.platform == 'darwin') {
 | 
			
		||||
                    toast(t('MacOS is not supported yet, please convert manually.'), { type: 'info' });
 | 
			
		||||
                    return;
 | 
			
		||||
                  }
 | 
			
		||||
 | 
			
		||||
                  const modelPath = `${commonStore.settings.customModelsPath}/${selectedConfig.modelParameters.modelName}`;
 | 
			
		||||
@ -849,7 +849,11 @@ export const Configs: FC = observer(() => {
 | 
			
		||||
                      toast(`${t('Convert Success')} - ${newModelPath}`, { type: 'success' });
 | 
			
		||||
                      refreshLocalModels({ models: commonStore.modelSourceList }, false);
 | 
			
		||||
                    }).catch(e => {
 | 
			
		||||
                      toast(`${t('Convert Failed')} - ${e.message || e}`, { type: 'error' });
 | 
			
		||||
                      const errMsg = e.message || e;
 | 
			
		||||
                      if (errMsg.includes('path contains space'))
 | 
			
		||||
                        toast(`${t('Convert Failed')} - ${t('Path Cannot Contain Space')}`, { type: 'error' });
 | 
			
		||||
                      else
 | 
			
		||||
                        toast(`${t('Convert Failed')} - ${e.message || e}`, { type: 'error' });
 | 
			
		||||
                    });
 | 
			
		||||
                    setTimeout(WindowShow, 1000);
 | 
			
		||||
                  } else {
 | 
			
		||||
 | 
			
		||||
@ -129,7 +129,7 @@ export const Settings: FC = observer(() => {
 | 
			
		||||
                        }} />
 | 
			
		||||
                    } />
 | 
			
		||||
                }
 | 
			
		||||
                <Labeled label={t('Custom Python Path')}
 | 
			
		||||
                <Labeled label={t('Custom Python Path')} // if set, will not use precompiled cuda kernel
 | 
			
		||||
                  content={
 | 
			
		||||
                    <Input className="grow" placeholder="./py310/python" value={commonStore.settings.customPythonPath}
 | 
			
		||||
                      onChange={(e, data) => {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user