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
784ee6f5
Commit
784ee6f5
authored
Mar 08, 2024
by
Timothy J. Baek
Browse files
fix: error handling
parent
d936353d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
14 deletions
+20
-14
backend/main.py
backend/main.py
+20
-14
No files found.
backend/main.py
View file @
784ee6f5
...
@@ -108,6 +108,8 @@ class RAGMiddleware(BaseHTTPMiddleware):
...
@@ -108,6 +108,8 @@ class RAGMiddleware(BaseHTTPMiddleware):
for
doc
in
docs
:
for
doc
in
docs
:
context
=
None
context
=
None
try
:
if
doc
[
"type"
]
==
"collection"
:
if
doc
[
"type"
]
==
"collection"
:
context
=
query_collection
(
context
=
query_collection
(
collection_names
=
doc
[
"collection_names"
],
collection_names
=
doc
[
"collection_names"
],
...
@@ -122,6 +124,10 @@ class RAGMiddleware(BaseHTTPMiddleware):
...
@@ -122,6 +124,10 @@ class RAGMiddleware(BaseHTTPMiddleware):
k
=
rag_app
.
state
.
TOP_K
,
k
=
rag_app
.
state
.
TOP_K
,
embedding_function
=
rag_app
.
state
.
sentence_transformer_ef
,
embedding_function
=
rag_app
.
state
.
sentence_transformer_ef
,
)
)
except
Exception
as
e
:
print
(
e
)
context
=
None
relevant_contexts
.
append
(
context
)
relevant_contexts
.
append
(
context
)
context_string
=
""
context_string
=
""
...
...
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