forked from open-webui/open-webui
feat: share to ollamahub
This commit is contained in:
parent
92ced39a81
commit
59f392de39
1 changed files with 28 additions and 0 deletions
|
@ -42,6 +42,24 @@
|
||||||
await modelfiles.set($modelfiles.filter((modelfile) => modelfile.tagName != tagName));
|
await modelfiles.set($modelfiles.filter((modelfile) => modelfile.tagName != tagName));
|
||||||
localStorage.setItem('modelfiles', JSON.stringify($modelfiles));
|
localStorage.setItem('modelfiles', JSON.stringify($modelfiles));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const shareModelfile = async (modelfile) => {
|
||||||
|
toast.success('Redirecting you to OllamaHub');
|
||||||
|
|
||||||
|
const url = 'https://ollamahub.com';
|
||||||
|
|
||||||
|
const tab = await window.open(`${url}/create`, '_blank');
|
||||||
|
window.addEventListener(
|
||||||
|
'message',
|
||||||
|
(event) => {
|
||||||
|
if (event.origin !== url) return;
|
||||||
|
if (event.data === 'loaded') {
|
||||||
|
tab.postMessage(JSON.stringify(modelfile), '*');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="min-h-screen w-full flex justify-center dark:text-white">
|
<div class="min-h-screen w-full flex justify-center dark:text-white">
|
||||||
|
@ -108,6 +126,16 @@
|
||||||
Edit</a
|
Edit</a
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class=" w-fit text-sm px-3 py-2 border dark:border-gray-600 rounded-xl"
|
||||||
|
type="button"
|
||||||
|
on:click={() => {
|
||||||
|
shareModelfile(modelfile);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Share</button
|
||||||
|
>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
class=" w-fit text-sm px-3 py-2 border dark:border-gray-600 rounded-xl"
|
class=" w-fit text-sm px-3 py-2 border dark:border-gray-600 rounded-xl"
|
||||||
type="button"
|
type="button"
|
||||||
|
|
Loading…
Reference in a new issue