mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 12:25:20 +00:00
refac
This commit is contained in:
parent
8a4b3e6bc9
commit
a1f3ece528
1 changed files with 8 additions and 5 deletions
|
|
@ -586,10 +586,13 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
|
||||||
if len(contexts) > 0:
|
if len(contexts) > 0:
|
||||||
context_string = "/n".join(contexts).strip()
|
context_string = "/n".join(contexts).strip()
|
||||||
prompt = get_last_user_message(body["messages"])
|
prompt = get_last_user_message(body["messages"])
|
||||||
|
|
||||||
if prompt is None:
|
if prompt is None:
|
||||||
raise Exception("No user message found")
|
raise Exception("No user message found")
|
||||||
if rag_app.state.config.RELEVANCE_THRESHOLD == 0:
|
if (
|
||||||
if context_string.strip() == "":
|
rag_app.state.config.RELEVANCE_THRESHOLD == 0
|
||||||
|
and context_string.strip() == ""
|
||||||
|
):
|
||||||
log.debug(
|
log.debug(
|
||||||
f"With a 0 relevancy threshold for RAG, the context cannot be empty"
|
f"With a 0 relevancy threshold for RAG, the context cannot be empty"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue