forked from open-webui/open-webui
fix: error handling
This commit is contained in:
parent
d936353da0
commit
784ee6f521
1 changed files with 20 additions and 14 deletions
|
@ -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):
|
||||||
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 = ""
|
||||||
|
|
Loading…
Reference in a new issue