mirror of
https://github.com/open-webui/open-webui
synced 2025-06-04 03:37:35 +00:00
fix: funcs, models, prompts, & tools conditional export button
This commit is contained in:
parent
1366822f99
commit
41b9ff9e00
@ -430,6 +430,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
{#if $functions.length}
|
||||||
<button
|
<button
|
||||||
class="flex text-xs items-center space-x-1 px-3 py-1.5 rounded-xl bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-200 transition"
|
class="flex text-xs items-center space-x-1 px-3 py-1.5 rounded-xl bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-200 transition"
|
||||||
on:click={async () => {
|
on:click={async () => {
|
||||||
@ -463,6 +464,7 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -93,13 +93,10 @@
|
|||||||
|
|
||||||
const tab = await window.open(`${url}/models/create`, '_blank');
|
const tab = await window.open(`${url}/models/create`, '_blank');
|
||||||
|
|
||||||
// Define the event handler function
|
|
||||||
const messageHandler = (event) => {
|
const messageHandler = (event) => {
|
||||||
if (event.origin !== url) return;
|
if (event.origin !== url) return;
|
||||||
if (event.data === 'loaded') {
|
if (event.data === 'loaded') {
|
||||||
tab.postMessage(JSON.stringify(model), '*');
|
tab.postMessage(JSON.stringify(model), '*');
|
||||||
|
|
||||||
// Remove the event listener after handling the message
|
|
||||||
window.removeEventListener('message', messageHandler);
|
window.removeEventListener('message', messageHandler);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -477,13 +474,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
{#if models.length}
|
||||||
<button
|
<button
|
||||||
class="flex text-xs items-center space-x-1 px-3 py-1.5 rounded-xl bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-200 transition"
|
class="flex text-xs items-center space-x-1 px-3 py-1.5 rounded-xl bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-200 transition"
|
||||||
on:click={async () => {
|
on:click={async () => {
|
||||||
downloadModels(models);
|
downloadModels(models);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div class=" self-center mr-2 font-medium line-clamp-1">{$i18n.t('Export Models')}</div>
|
<div class=" self-center mr-2 font-medium line-clamp-1">
|
||||||
|
{$i18n.t('Export Models')}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class=" self-center">
|
<div class=" self-center">
|
||||||
<svg
|
<svg
|
||||||
@ -500,6 +500,7 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -285,17 +285,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
{#if prompts.length}
|
||||||
<button
|
<button
|
||||||
class="flex text-xs items-center space-x-1 px-3 py-1.5 rounded-xl bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-200 transition"
|
class="flex text-xs items-center space-x-1 px-3 py-1.5 rounded-xl bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-200 transition"
|
||||||
on:click={async () => {
|
on:click={async () => {
|
||||||
// promptsImportInputElement.click();
|
|
||||||
let blob = new Blob([JSON.stringify(prompts)], {
|
let blob = new Blob([JSON.stringify(prompts)], {
|
||||||
type: 'application/json'
|
type: 'application/json'
|
||||||
});
|
});
|
||||||
saveAs(blob, `prompts-export-${Date.now()}.json`);
|
saveAs(blob, `prompts-export-${Date.now()}.json`);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div class=" self-center mr-2 font-medium line-clamp-1">{$i18n.t('Export Prompts')}</div>
|
<div class=" self-center mr-2 font-medium line-clamp-1">
|
||||||
|
{$i18n.t('Export Prompts')}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class=" self-center">
|
<div class=" self-center">
|
||||||
<svg
|
<svg
|
||||||
@ -312,6 +314,7 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -71,13 +71,10 @@
|
|||||||
|
|
||||||
const tab = await window.open(`${url}/tools/create`, '_blank');
|
const tab = await window.open(`${url}/tools/create`, '_blank');
|
||||||
|
|
||||||
// Define the event handler function
|
|
||||||
const messageHandler = (event) => {
|
const messageHandler = (event) => {
|
||||||
if (event.origin !== url) return;
|
if (event.origin !== url) return;
|
||||||
if (event.data === 'loaded') {
|
if (event.data === 'loaded') {
|
||||||
tab.postMessage(JSON.stringify(item), '*');
|
tab.postMessage(JSON.stringify(item), '*');
|
||||||
|
|
||||||
// Remove the event listener after handling the message
|
|
||||||
window.removeEventListener('message', messageHandler);
|
window.removeEventListener('message', messageHandler);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -124,8 +121,7 @@
|
|||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
toast.success($i18n.t('Tool deleted successfully'));
|
toast.success($i18n.t('Tool deleted successfully'));
|
||||||
|
await init();
|
||||||
init();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -398,6 +394,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
{#if tools.length}
|
||||||
<button
|
<button
|
||||||
class="flex text-xs items-center space-x-1 px-3 py-1.5 rounded-xl bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-200 transition"
|
class="flex text-xs items-center space-x-1 px-3 py-1.5 rounded-xl bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-200 transition"
|
||||||
on:click={async () => {
|
on:click={async () => {
|
||||||
@ -431,6 +428,7 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
Loading…
Reference in New Issue
Block a user