improve path processing

This commit is contained in:
josc146
2024-02-02 22:00:01 +08:00
parent 95502b900d
commit 947e127e34
14 changed files with 237 additions and 82 deletions

View File

@@ -295,7 +295,7 @@ const SidePanel: FC = observer(() => {
OpenSaveFileDialog('*.txt', 'conversation.txt', savedContent).then((path) => {
if (path)
toastWithButton(t('Conversation Saved'), t('Open'), () => {
OpenFileFolder(path, false);
OpenFileFolder(path);
});
}).catch(e => {
toast(t('Error') + ' - ' + (e.message || e), { type: 'error', autoClose: 2500 });

View File

@@ -426,7 +426,7 @@ const CompositionPanel: FC = observer(() => {
OpenSaveFileDialog('*.txt', 'abc-music.txt', commonStore.compositionParams.prompt).then((path) => {
if (path)
toastWithButton(t('File Saved'), t('Open'), () => {
OpenFileFolder(path, false);
OpenFileFolder(path);
});
}).catch((e) => {
toast(t('Error') + ' - ' + (e.message || e), { type: 'error', autoClose: 2500 });
@@ -437,7 +437,7 @@ const CompositionPanel: FC = observer(() => {
OpenSaveFileDialogBytes('*.mid', 'music.mid', Array.from(new Uint8Array(params.midi))).then((path) => {
if (path)
toastWithButton(t('File Saved'), t('Open'), () => {
OpenFileFolder(path, false);
OpenFileFolder(path);
});
}).catch((e) => {
toast(t('Error') + ' - ' + (e.message || e), { type: 'error', autoClose: 2500 });

View File

@@ -67,7 +67,7 @@ const Downloads: FC = observer(() => {
AddToDownloadList(status.path, status.url);
}} />}
<ToolTipButton desc={t('Open Folder')} icon={<Folder20Regular />} onClick={() => {
OpenFileFolder(status.path, false);
OpenFileFolder(status.path);
}} />
</div>
</Field>

View File

@@ -132,7 +132,7 @@ const columns: TableColumnDefinition<ModelSourceItem>[] = [
{
item.isComplete &&
<ToolTipButton desc={t('Open Folder')} icon={<Folder20Regular />} onClick={() => {
OpenFileFolder(`${commonStore.settings.customModelsPath}/${item.name}`, true);
OpenFileFolder(`${commonStore.settings.customModelsPath}/${item.name}`);
}} />
}
{item.downloadUrl && !item.isComplete &&

View File

@@ -398,7 +398,7 @@ const LoraFinetune: FC = observer(() => {
'Even for multi-turn conversations, they must be written in a single line using `\\n` to indicate line breaks. ' +
'If they are different dialogues or topics, they should be written in separate lines.')} />
<ToolTipButton desc={t('Open Folder')} icon={<Folder20Regular />} onClick={() => {
OpenFileFolder(dataParams.dataPath, false);
OpenFileFolder(dataParams.dataPath);
}} />
</div>
<div className="flex gap-2 items-center">