mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-16 09:41:23 +00:00
refac
This commit is contained in:
parent
295b077893
commit
250108302e
3 changed files with 11 additions and 3 deletions
|
|
@ -108,6 +108,7 @@
|
|||
> = {};
|
||||
let dirtyFiles: Record<string, boolean> = {};
|
||||
let fileContexts: Record<string, TerminalContext | null> = {};
|
||||
let gitDirectories: Record<string, string | null> = {};
|
||||
let panelTarget: HTMLElement | null = null;
|
||||
let initialized = false;
|
||||
let tabsChatId = chatId;
|
||||
|
|
@ -304,6 +305,7 @@
|
|||
tabs = removeTab(tabs, id);
|
||||
delete dirtyFiles[id];
|
||||
delete fileContexts[id];
|
||||
delete gitDirectories[id];
|
||||
if (!tabs.tabs.length) showTabs.set(false);
|
||||
await tick();
|
||||
document.getElementById(domId(tabs.activeId))?.focus();
|
||||
|
|
@ -467,6 +469,7 @@
|
|||
tabs = removeTab(tabs, tab.id);
|
||||
delete dirtyFiles[tab.id];
|
||||
delete fileContexts[tab.id];
|
||||
delete gitDirectories[tab.id];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -519,6 +522,7 @@
|
|||
tabs = emptyTabs();
|
||||
dirtyFiles = {};
|
||||
fileContexts = {};
|
||||
gitDirectories = {};
|
||||
initialized = false;
|
||||
commentTarget = {};
|
||||
}
|
||||
|
|
@ -901,6 +905,7 @@
|
|||
overlay={dragged}
|
||||
{chatId}
|
||||
bind:terminalContext={fileContexts[tab.id]}
|
||||
bind:gitDirectory={gitDirectories[tab.id]}
|
||||
/>
|
||||
{:else if tab.kind === 'files' && codeInterpreterEnabled}
|
||||
<PyodideFileNav overlay={dragged} />
|
||||
|
|
@ -920,7 +925,7 @@
|
|||
bind:hideWhitespace={gitHideWhitespace}
|
||||
connection={gitConnection}
|
||||
{chatId}
|
||||
directory={terminalContext?.currentDirectory ?? '.'}
|
||||
directory={gitDirectories[tabs.activeId] ?? terminalContext?.currentDirectory ?? '.'}
|
||||
active={!!$showTabs}
|
||||
onOpenFile={(path) => openFile(path, gitConnection.selector)}
|
||||
onOpenDirectory={(path) => openFiles(gitConnection.selector, path)}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@
|
|||
export let overlay = false;
|
||||
export let active = true;
|
||||
export let gitStatus: GitStatus | null = null;
|
||||
export let gitDirectory: string | null = null;
|
||||
export let gitConnection: TerminalConnection | null = null;
|
||||
export let gitDiffMode: 'unified' | 'split' = 'unified';
|
||||
export let gitHideWhitespace = false;
|
||||
|
|
@ -1023,6 +1024,7 @@
|
|||
selectedFileWritable = true;
|
||||
clearFilePreview();
|
||||
clearSelection();
|
||||
if (!options.preserveTree || directory !== currentPath) gitDirectory = directory;
|
||||
currentPath = directory;
|
||||
terminalContext = { terminalId: effectiveTerminalId, currentDirectory: directory };
|
||||
savedPath = directory;
|
||||
|
|
@ -1087,6 +1089,7 @@
|
|||
}
|
||||
|
||||
expandedDirs = new Set(expandedDirs).add(directory);
|
||||
gitDirectory = directory;
|
||||
saveTreeState();
|
||||
|
||||
const result = await fetchExpandedDir(directory);
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@
|
|||
aria-pressed={gitDiffOpen}
|
||||
on:click={onToggleGitDiff}
|
||||
>
|
||||
<Icon name="git-diff" size={18} strokeWidth={1.6} />
|
||||
<Icon name="git-diff" size={16} strokeWidth={1.4} />
|
||||
</button>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
|
|
@ -187,7 +187,7 @@
|
|||
on:click={onRefresh}
|
||||
aria-label={$i18n.t('Refresh')}
|
||||
>
|
||||
<Icon name="refresh" size={11} strokeWidth={1.4} class={loading ? 'animate-spin' : ''} />
|
||||
<Icon name="refresh" size={10} strokeWidth={1.4} class={loading ? 'animate-spin' : ''} />
|
||||
</button>
|
||||
</Tooltip>
|
||||
{#if !selectedFile}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue