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
b16f0ea2
Unverified
Commit
b16f0ea2
authored
Jan 01, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Jan 01, 2024
Browse files
Merge branch 'main' into rag
parents
d5aa9e87
fed6a5b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
5 deletions
+46
-5
src/lib/components/layout/Navbar.svelte
src/lib/components/layout/Navbar.svelte
+46
-5
No files found.
src/lib/components/layout/Navbar.svelte
View file @
b16f0ea2
<script lang="ts">
<script lang="ts">
import toast from 'svelte-french-toast';
import fileSaver from 'file-saver';
const { saveAs } = fileSaver;
import { getChatById } from '$lib/apis/chats';
import { getChatById } from '$lib/apis/chats';
import { chatId, db, modelfiles } from '$lib/stores';
import { chatId, db, modelfiles } from '$lib/stores';
import toast from 'svelte-french-toast';
export let initNewChat: Function;
export let initNewChat: Function;
export let title: string = 'Ollama Web UI';
export let title: string = 'Ollama Web UI';
...
@@ -33,6 +36,21 @@
...
@@ -33,6 +36,21 @@
false
false
);
);
};
};
const downloadChat = async () => {
const chat = (await getChatById(localStorage.token, $chatId)).chat;
console.log('download', chat);
const chatText = chat.messages.reduce((a, message, i, arr) => {
return `${a}### ${message.role.toUpperCase()}\n${message.content}\n\n`;
}, '');
let blob = new Blob([chatText], {
type: 'text/plain'
});
saveAs(blob, `chat-${chat.title}.txt`);
};
</script>
</script>
<nav
<nav
...
@@ -69,7 +87,30 @@
...
@@ -69,7 +87,30 @@
</div>
</div>
{#if shareEnabled}
{#if shareEnabled}
<div class="pl-2">
<div class="pl-2 flex space-x-1.5">
<button
class=" cursor-pointer p-2 flex dark:hover:bg-gray-700 rounded-lg transition border dark:border-gray-600"
on:click={async () => {
downloadChat();
}}
>
<div class=" m-auto self-center">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16"
fill="currentColor"
class="w-4 h-4"
>
<path
d="M8.75 2.75a.75.75 0 0 0-1.5 0v5.69L5.03 6.22a.75.75 0 0 0-1.06 1.06l3.5 3.5a.75.75 0 0 0 1.06 0l3.5-3.5a.75.75 0 0 0-1.06-1.06L8.75 8.44V2.75Z"
/>
<path
d="M3.5 9.75a.75.75 0 0 0-1.5 0v1.5A2.75 2.75 0 0 0 4.75 14h6.5A2.75 2.75 0 0 0 14 11.25v-1.5a.75.75 0 0 0-1.5 0v1.5c0 .69-.56 1.25-1.25 1.25h-6.5c-.69 0-1.25-.56-1.25-1.25v-1.5Z"
/>
</svg>
</div>
</button>
<button
<button
class=" cursor-pointer p-2 flex dark:hover:bg-gray-700 rounded-lg transition border dark:border-gray-600"
class=" cursor-pointer p-2 flex dark:hover:bg-gray-700 rounded-lg transition border dark:border-gray-600"
on:click={async () => {
on:click={async () => {
...
@@ -79,15 +120,15 @@
...
@@ -79,15 +120,15 @@
<div class=" m-auto self-center">
<div class=" m-auto self-center">
<svg
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0
20 20
"
viewBox="0 0
16 16
"
fill="currentColor"
fill="currentColor"
class="w-4 h-4"
class="w-4 h-4"
>
>
<path
<path
d="M
9
.25 1
3
.25a.75.75 0 0
0
1.5 0V4.
63
6l2.
955 3.129
a.75.75 0
00
1.0
9
-1.0
3
l-
4.2
5-
4
.5a.75.75 0 00-1.0
9
0l-
4.2
5
4
.5a.75.75 0
1
01.0
9
1.0
3L9.25 4.636v8.614z
"
d="M
7
.25 1
0
.25a.75.75 0 0
0
1.5 0V4.
5
6l2.
22 2.22
a.75.75 0
1 0
1.0
6
-1.0
6
l-
3.
5-
3
.5a.75.75 0 0
0-1.0
6
0l-
3.
5
3
.5a.75.75 0 0
0
1.0
6
1.0
6l2.22-2.22v5.69Z
"
/>
/>
<path
<path
d="M3.5
12
.75a.75.75 0 00-1.5 0v
2
.5A2.75 2.75 0 0
0
4.75 1
8h10
.5A2.75 2.75 0 0
018
1
5
.25v-
2
.5a.75.75 0 00-1.5 0v
2
.5c0 .69-.56 1.25-1.25 1.25
H4.7
5c-.69 0-1.25-.56-1.25-1.25v-
2
.5
z
"
d="M3.5
9
.75a.75.75 0 0
0-1.5 0v
1
.5A2.75 2.75 0 0
0
4.75 1
4h6
.5A2.75 2.75 0 0
0 14
1
1
.25v-
1
.5a.75.75 0 0
0-1.5 0v
1
.5c0 .69-.56 1.25-1.25 1.25
h-6.
5c-.69 0-1.25-.56-1.25-1.25v-
1
.5
Z
"
/>
/>
</svg>
</svg>
</div>
</div>
...
...
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