mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 05:24:02 +00:00
refac
This commit is contained in:
parent
82bd1eb155
commit
5376525777
@ -69,6 +69,7 @@ from utils.misc import (
|
|||||||
from utils.utils import get_current_user, get_admin_user
|
from utils.utils import get_current_user, get_admin_user
|
||||||
|
|
||||||
from config import (
|
from config import (
|
||||||
|
ENV,
|
||||||
SRC_LOG_LEVELS,
|
SRC_LOG_LEVELS,
|
||||||
UPLOAD_DIR,
|
UPLOAD_DIR,
|
||||||
DOCS_DIR,
|
DOCS_DIR,
|
||||||
@ -260,7 +261,7 @@ async def update_embedding_config(
|
|||||||
app.state.config.OPENAI_API_BASE_URL = form_data.openai_config.url
|
app.state.config.OPENAI_API_BASE_URL = form_data.openai_config.url
|
||||||
app.state.config.OPENAI_API_KEY = form_data.openai_config.key
|
app.state.config.OPENAI_API_KEY = form_data.openai_config.key
|
||||||
|
|
||||||
update_embedding_model(app.state.config.RAG_EMBEDDING_MODEL), True
|
update_embedding_model(app.state.config.RAG_EMBEDDING_MODEL)
|
||||||
|
|
||||||
app.state.EMBEDDING_FUNCTION = get_embedding_function(
|
app.state.EMBEDDING_FUNCTION = get_embedding_function(
|
||||||
app.state.config.RAG_EMBEDDING_ENGINE,
|
app.state.config.RAG_EMBEDDING_ENGINE,
|
||||||
@ -951,3 +952,14 @@ def reset(user=Depends(get_admin_user)) -> bool:
|
|||||||
log.exception(e)
|
log.exception(e)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
if ENV == "dev":
|
||||||
|
|
||||||
|
@app.get("/ef")
|
||||||
|
async def get_embeddings():
|
||||||
|
return {"result": app.state.EMBEDDING_FUNCTION("hello world")}
|
||||||
|
|
||||||
|
@app.get("/ef/{text}")
|
||||||
|
async def get_embeddings_text(text: str):
|
||||||
|
return {"result": app.state.EMBEDDING_FUNCTION(text)}
|
||||||
|
Loading…
Reference in New Issue
Block a user