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
741ed5dc
Commit
741ed5dc
authored
Apr 14, 2024
by
Timothy J. Baek
Browse files
fix
parent
b1b72441
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
backend/apps/rag/main.py
backend/apps/rag/main.py
+1
-0
backend/apps/rag/utils.py
backend/apps/rag/utils.py
+5
-1
No files found.
backend/apps/rag/main.py
View file @
741ed5dc
...
...
@@ -495,6 +495,7 @@ def store_docs_in_vector_db(docs, collection_name, overwrite: bool = False) -> b
ids
=
[
str
(
uuid
.
uuid1
())
for
_
in
texts
],
metadatas
=
metadatas
,
embeddings
=
embeddings
,
documents
=
texts
,
):
collection
.
add
(
*
batch
)
...
...
backend/apps/rag/utils.py
View file @
741ed5dc
...
...
@@ -43,6 +43,8 @@ def query_embeddings_doc(collection_name: str, query_embeddings, k: int):
query_embeddings
=
[
query_embeddings
],
n_results
=
k
,
)
log
.
info
(
f
"query_embeddings_doc:result
{
result
}
"
)
return
result
except
Exception
as
e
:
raise
e
...
...
@@ -155,7 +157,9 @@ def rag_messages(
openai_key
,
openai_url
,
):
log
.
debug
(
f
"docs:
{
docs
}
"
)
log
.
debug
(
f
"docs:
{
docs
}
{
messages
}
{
embedding_engine
}
{
embedding_model
}
{
embedding_function
}
{
openai_key
}
{
openai_url
}
"
)
last_user_message_idx
=
None
for
i
in
range
(
len
(
messages
)
-
1
,
-
1
,
-
1
):
...
...
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