mirror of
https://github.com/open-webui/open-webui
synced 2024-11-26 14:02:29 +00:00
feat: openwebui community backward compatibility
This commit is contained in:
parent
967277f1d5
commit
39f91e39a7
27
src/routes/modelfiles/create/+page.svelte
Normal file
27
src/routes/modelfiles/create/+page.svelte
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
window.addEventListener('message', async (event) => {
|
||||||
|
if (
|
||||||
|
![
|
||||||
|
'https://ollamahub.com',
|
||||||
|
'https://www.ollamahub.com',
|
||||||
|
'https://openwebui.com',
|
||||||
|
'https://www.openwebui.com',
|
||||||
|
'http://localhost:5173'
|
||||||
|
].includes(event.origin)
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
const modelfile = JSON.parse(event.data);
|
||||||
|
sessionStorage.modelfile = JSON.stringify(modelfile);
|
||||||
|
|
||||||
|
goto('/workspace/modelfiles/create');
|
||||||
|
});
|
||||||
|
|
||||||
|
if (window.opener ?? false) {
|
||||||
|
window.opener.postMessage('loaded', '*');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
27
src/routes/prompts/create/+page.svelte
Normal file
27
src/routes/prompts/create/+page.svelte
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
window.addEventListener('message', async (event) => {
|
||||||
|
if (
|
||||||
|
![
|
||||||
|
'https://ollamahub.com',
|
||||||
|
'https://www.ollamahub.com',
|
||||||
|
'https://openwebui.com',
|
||||||
|
'https://www.openwebui.com',
|
||||||
|
'http://localhost:5173'
|
||||||
|
].includes(event.origin)
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
const prompts = JSON.parse(event.data);
|
||||||
|
sessionStorage.modelfile = JSON.stringify(prompts);
|
||||||
|
|
||||||
|
goto('/workspace/prompts/create');
|
||||||
|
});
|
||||||
|
|
||||||
|
if (window.opener ?? false) {
|
||||||
|
window.opener.postMessage('loaded', '*');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Reference in New Issue
Block a user