mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
feat: import/export community
This commit is contained in:
@@ -43,8 +43,26 @@
|
||||
|
||||
let showDeleteConfirm = false;
|
||||
|
||||
const shareHandler = async (tool) => {
|
||||
console.log(tool);
|
||||
const shareHandler = async (item) => {
|
||||
toast.success($i18n.t('Redirecting you to OpenWebUI Community'));
|
||||
|
||||
const url = 'https://openwebui.com';
|
||||
|
||||
const tab = await window.open(`${url}/tools/create`, '_blank');
|
||||
|
||||
// Define the event handler function
|
||||
const messageHandler = (event) => {
|
||||
if (event.origin !== url) return;
|
||||
if (event.data === 'loaded') {
|
||||
tab.postMessage(JSON.stringify(item), '*');
|
||||
|
||||
// Remove the event listener after handling the message
|
||||
window.removeEventListener('message', messageHandler);
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('message', messageHandler, false);
|
||||
console.log(item);
|
||||
};
|
||||
|
||||
const cloneHandler = async (func) => {
|
||||
|
||||
@@ -39,8 +39,26 @@
|
||||
|
||||
let showDeleteConfirm = false;
|
||||
|
||||
const shareHandler = async (tool) => {
|
||||
console.log(tool);
|
||||
const shareHandler = async (item) => {
|
||||
toast.success($i18n.t('Redirecting you to OpenWebUI Community'));
|
||||
|
||||
const url = 'https://openwebui.com';
|
||||
|
||||
const tab = await window.open(`${url}/tools/create`, '_blank');
|
||||
|
||||
// Define the event handler function
|
||||
const messageHandler = (event) => {
|
||||
if (event.origin !== url) return;
|
||||
if (event.data === 'loaded') {
|
||||
tab.postMessage(JSON.stringify(item), '*');
|
||||
|
||||
// Remove the event listener after handling the message
|
||||
window.removeEventListener('message', messageHandler);
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('message', messageHandler, false);
|
||||
console.log(item);
|
||||
};
|
||||
|
||||
const cloneHandler = async (tool) => {
|
||||
|
||||
Reference in New Issue
Block a user