瀏覽代碼

refac: openwebui.com integration

Timothy J. Baek 11 月之前
父節點
當前提交
1c7dd7b859

+ 3 - 7
src/routes/(app)/workspace/models/create/+page.svelte

@@ -138,13 +138,9 @@
 	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)
+				!['https://openwebui.com', 'https://www.openwebui.com', 'http://localhost:5173'].includes(
+					event.origin
+				)
 			)
 				return;
 

+ 3 - 7
src/routes/(app)/workspace/prompts/create/+page.svelte

@@ -57,13 +57,9 @@
 	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)
+				!['https://openwebui.com', 'https://www.openwebui.com', 'http://localhost:5173'].includes(
+					event.origin
+				)
 			)
 				return;
 			const prompt = JSON.parse(event.data);

+ 0 - 27
src/routes/prompts/create/+page.svelte

@@ -1,27 +0,0 @@
-<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>