mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-05 10:28:06 -05:00
Fixed errors and added more support
This commit is contained in:
@@ -70,7 +70,6 @@ from open_webui.utils.misc import (
|
||||
)
|
||||
from open_webui.utils.auth import get_admin_user, get_verified_user
|
||||
|
||||
|
||||
from open_webui.config import (
|
||||
ENV,
|
||||
RAG_EMBEDDING_MODEL_AUTO_UPDATE,
|
||||
@@ -79,7 +78,8 @@ from open_webui.config import (
|
||||
RAG_RERANKING_MODEL_TRUST_REMOTE_CODE,
|
||||
UPLOAD_DIR,
|
||||
DEFAULT_LOCALE,
|
||||
RAG_EMBEDDING_PASSAGE_PREFIX
|
||||
RAG_EMBEDDING_PASSAGE_PREFIX,
|
||||
RAG_EMBEDDING_QUERY_PREFIX
|
||||
)
|
||||
from open_webui.env import (
|
||||
SRC_LOG_LEVELS,
|
||||
@@ -1319,7 +1319,7 @@ def query_doc_handler(
|
||||
else:
|
||||
return query_doc(
|
||||
collection_name=form_data.collection_name,
|
||||
query_embedding=request.app.state.EMBEDDING_FUNCTION(form_data.query),
|
||||
query_embedding=request.app.state.EMBEDDING_FUNCTION(form_data.query, RAG_EMBEDDING_QUERY_PREFIX),
|
||||
k=form_data.k if form_data.k else request.app.state.config.TOP_K,
|
||||
)
|
||||
except Exception as e:
|
||||
@@ -1438,7 +1438,7 @@ if ENV == "dev":
|
||||
|
||||
@router.get("/ef/{text}")
|
||||
async def get_embeddings(request: Request, text: Optional[str] = "Hello World!"):
|
||||
return {"result": request.app.state.EMBEDDING_FUNCTION(text)}
|
||||
return {"result": request.app.state.EMBEDDING_FUNCTION(text, RAG_EMBEDDING_QUERY_PREFIX)}
|
||||
|
||||
|
||||
class BatchProcessFilesForm(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user