Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
c87a80f9
Commit
c87a80f9
authored
Dec 14, 2023
by
Timothy J. Baek
Browse files
feat: chat share
parent
4622a899
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
src/lib/components/layout/Navbar.svelte
src/lib/components/layout/Navbar.svelte
+23
-2
No files found.
src/lib/components/layout/Navbar.svelte
View file @
c87a80f9
...
...
@@ -2,10 +2,31 @@
import { v4 as uuidv4 } from 'uuid';
import { goto } from '$app/navigation';
import { chatId } from '$lib/stores';
import { chatId, db } from '$lib/stores';
import toast from 'svelte-french-toast';
export let title: string = 'Ollama Web UI';
export let shareEnabled: boolean = false;
const shareChat = async () => {
const chat = await $db.getChatById($chatId);
console.log('share', chat);
toast.success('Redirecting you to OllamaHub');
const url = 'https://ollamahub.com';
const tab = await window.open(`${url}/chats/upload`, '_blank');
window.addEventListener(
'message',
(event) => {
if (event.origin !== url) return;
if (event.data === 'loaded') {
tab.postMessage(JSON.stringify(chat), '*');
}
},
false
);
};
</script>
<nav
...
...
@@ -49,7 +70,7 @@
<button
class=" cursor-pointer p-2 flex dark:hover:bg-gray-700 rounded-lg transition border dark:border-gray-600"
on:click={async () => {
console.log('share'
);
shareChat(
);
}}
>
<div class=" m-auto self-center">
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment