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
920fc29b
Unverified
Commit
920fc29b
authored
Jun 24, 2024
by
Simon
Committed by
GitHub
Jun 24, 2024
Browse files
Merge branch 'dev' into dev
parents
d9c2b6e8
74a4f642
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
7 deletions
+28
-7
backend/apps/webui/main.py
backend/apps/webui/main.py
+7
-0
backend/apps/webui/utils.py
backend/apps/webui/utils.py
+9
-4
src/lib/components/workspace/Functions.svelte
src/lib/components/workspace/Functions.svelte
+10
-2
src/lib/components/workspace/common/ValvesModal.svelte
src/lib/components/workspace/common/ValvesModal.svelte
+2
-1
No files found.
backend/apps/webui/main.py
View file @
920fc29b
...
...
@@ -116,6 +116,13 @@ async def get_pipe_models():
else
:
function_module
=
app
.
state
.
FUNCTIONS
[
pipe
.
id
]
if
hasattr
(
function_module
,
"valves"
)
and
hasattr
(
function_module
,
"Valves"
):
print
(
f
"Getting valves for
{
pipe
.
id
}
"
)
valves
=
Functions
.
get_function_valves_by_id
(
pipe
.
id
)
function_module
.
valves
=
function_module
.
Valves
(
**
(
valves
if
valves
else
{})
)
# Check if function is a manifold
if
hasattr
(
function_module
,
"type"
):
if
function_module
.
type
==
"manifold"
:
...
...
backend/apps/webui/utils.py
View file @
920fc29b
...
...
@@ -16,12 +16,16 @@ def extract_frontmatter(file_path):
try
:
with
open
(
file_path
,
"r"
,
encoding
=
"utf-8"
)
as
file
:
first_line
=
file
.
readline
()
if
first_line
.
strip
()
!=
'"""'
:
# The file doesn't start with triple quotes
return
{}
frontmatter_started
=
True
for
line
in
file
:
if
'"""'
in
line
:
if
not
frontmatter_started
:
frontmatter_started
=
True
continue
# skip the line with the opening triple quotes
else
:
if
frontmatter_started
:
frontmatter_ended
=
True
break
...
...
@@ -30,6 +34,7 @@ def extract_frontmatter(file_path):
if
match
:
key
,
value
=
match
.
groups
()
frontmatter
[
key
.
strip
()]
=
value
.
strip
()
except
FileNotFoundError
:
print
(
f
"Error: The file
{
file_path
}
does not exist."
)
return
{}
...
...
src/lib/components/workspace/Functions.svelte
View file @
920fc29b
...
...
@@ -4,7 +4,7 @@
const { saveAs } = fileSaver;
import { WEBUI_NAME, functions, models } from '$lib/stores';
import { onMount, getContext } from 'svelte';
import { onMount, getContext
, tick
} from 'svelte';
import { createNewPrompt, deletePromptByCommand, getPrompts } from '$lib/apis/prompts';
import { goto } from '$app/navigation';
...
...
@@ -387,7 +387,15 @@
</div>
<ManifestModal bind:show={showManifestModal} manifest={selectedFunction?.meta?.manifest ?? {}} />
<ValvesModal bind:show={showValvesModal} type="function" id={selectedFunction?.id ?? null} />
<ValvesModal
bind:show={showValvesModal}
type="function"
id={selectedFunction?.id ?? null}
on:save={async () => {
await tick();
models.set(await getModels(localStorage.token));
}}
/>
<ConfirmDialog
bind:show={showConfirm}
...
...
src/lib/components/workspace/common/ValvesModal.svelte
View file @
920fc29b
...
...
@@ -51,7 +51,8 @@
}
if (res) {
toast.success($i18n.t('Valves updated successfully'));
toast.success('Valves updated successfully');
dispatch('save');
}
}
...
...
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