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
bcf79c83
Commit
bcf79c83
authored
Apr 04, 2024
by
Self Denial
Browse files
Format fixes
parent
3b66aa55
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
backend/apps/rag/utils.py
backend/apps/rag/utils.py
+8
-2
src/lib/components/documents/Settings/General.svelte
src/lib/components/documents/Settings/General.svelte
+1
-1
No files found.
backend/apps/rag/utils.py
View file @
bcf79c83
...
...
@@ -191,7 +191,9 @@ def rag_messages(docs, messages, template, k, embedding_function):
return
messages
def
embedding_model_get_path
(
embedding_model
:
str
,
update_embedding_model
:
bool
=
False
):
def
embedding_model_get_path
(
embedding_model
:
str
,
update_embedding_model
:
bool
=
False
):
# Construct huggingface_hub kwargs with local_files_only to return the snapshot path
cache_dir
=
os
.
getenv
(
"SENTENCE_TRANSFORMERS_HOME"
)
local_files_only
=
not
update_embedding_model
...
...
@@ -206,7 +208,11 @@ def embedding_model_get_path(embedding_model: str, update_embedding_model: bool
log
.
debug
(
f
"local_files_only:
{
local_files_only
}
"
)
# Inspiration from upstream sentence_transformers
if
(
os
.
path
.
exists
(
embedding_model
)
or
(
"
\\
"
in
embedding_model
or
embedding_model
.
count
(
"/"
)
>
1
)
and
local_files_only
):
if
(
os
.
path
.
exists
(
embedding_model
)
or
(
"
\\
"
in
embedding_model
or
embedding_model
.
count
(
"/"
)
>
1
)
and
local_files_only
):
# If fully qualified path exists, return input, else set repo_id
return
embedding_model
elif
"/"
not
in
embedding_model
:
...
...
src/lib/components/documents/Settings/General.svelte
View file @
bcf79c83
...
...
@@ -34,7 +34,7 @@
};
let embeddingModel = {
embedding_model: ''
,
embedding_model: ''
};
const scanHandler = async () => {
...
...
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