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
cbcce68c
Commit
cbcce68c
authored
Dec 03, 2023
by
Timothy J. Baek
Browse files
feat: ollamahub modelfile import
parent
6df1b197
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
21 deletions
+59
-21
src/routes/(app)/modelfiles/+page.svelte
src/routes/(app)/modelfiles/+page.svelte
+1
-1
src/routes/(app)/modelfiles/create/+page.svelte
src/routes/(app)/modelfiles/create/+page.svelte
+34
-0
src/routes/(app)/modelfiles/edit/+page.svelte
src/routes/(app)/modelfiles/edit/+page.svelte
+24
-20
No files found.
src/routes/(app)/modelfiles/+page.svelte
View file @
cbcce68c
...
@@ -103,7 +103,7 @@
...
@@ -103,7 +103,7 @@
<a
<a
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"
href={`/modelfiles/edit
/
${modelfile.tagName}`}
href={`/modelfiles/edit
?tag=
${modelfile.tagName}`}
>
>
Edit</a
Edit</a
>
>
...
...
src/routes/(app)/modelfiles/create/+page.svelte
View file @
cbcce68c
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
import Advanced from '$lib/components/chat/Settings/Advanced.svelte';
import Advanced from '$lib/components/chat/Settings/Advanced.svelte';
import { splitStream } from '$lib/utils';
import { splitStream } from '$lib/utils';
import { onMount, tick } from 'svelte';
let loading = false;
let loading = false;
...
@@ -209,6 +210,39 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
...
@@ -209,6 +210,39 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
loading = false;
loading = false;
success = false;
success = false;
};
};
onMount(() => {
window.addEventListener('message', async (event) => {
if (
!['https://ollamahub.com', 'https://www.ollamahub.com', 'http://localhost:5173'].includes(
event.origin
)
)
return;
const modelfile = JSON.parse(event.data);
console.log(modelfile);
imageUrl = modelfile.imageUrl;
title = modelfile.title;
await tick();
tagName = `${modelfile.user.username}/${modelfile.tagName}`;
desc = modelfile.desc;
content = modelfile.content;
suggestions =
modelfile.suggestionPrompts.length != 0
? modelfile.suggestionPrompts
: [
{
content: ''
}
];
for (const category of modelfile.categories) {
categories[category.toLowerCase()] = true;
}
});
window.opener.postMessage('loaded', '*');
});
</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">
...
...
src/routes/(app)/modelfiles/edit/
[tag]/
+page.svelte
→
src/routes/(app)/modelfiles/edit/+page.svelte
View file @
cbcce68c
...
@@ -50,8 +50,9 @@
...
@@ -50,8 +50,9 @@
};
};
onMount(() => {
onMount(() => {
tagName = $page.
p
arams.tag;
tagName = $page.
url.searchP
arams.
get('
tag
')
;
if (tagName) {
modelfile = $modelfiles.filter((modelfile) => modelfile.tagName === tagName)[0];
modelfile = $modelfiles.filter((modelfile) => modelfile.tagName === tagName)[0];
console.log(modelfile);
console.log(modelfile);
...
@@ -72,6 +73,9 @@
...
@@ -72,6 +73,9 @@
for (const category of modelfile.categories) {
for (const category of modelfile.categories) {
categories[category.toLowerCase()] = true;
categories[category.toLowerCase()] = true;
}
}
} else {
goto('/modelfiles');
}
});
});
const saveModelfile = async (modelfile) => {
const saveModelfile = async (modelfile) => {
...
...
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