瀏覽代碼

refac: rm assert

Timothy J. Baek 7 月之前
父節點
當前提交
a9c497612b
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      backend/open_webui/main.py

+ 5 - 4
backend/open_webui/main.py

@@ -589,10 +589,11 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
             if prompt is None:
                 raise Exception("No user message found")
             if rag_app.state.config.RELEVANCE_THRESHOLD == 0:
-                assert context_string.strip(), (
-                    "With a 0 relevancy threshold for RAG, the context cannot "
-                    "be empty"
-                )
+                if context_string.strip() == "":
+                    log.debug(
+                        f"With a 0 relevancy threshold for RAG, the context cannot be empty"
+                    )
+
             # Workaround for Ollama 2.0+ system prompt issue
             # TODO: replace with add_or_update_system_message
             if model["owned_by"] == "ollama":