mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
refac/breaking: docling params
Some checks are pending
Deploy to HuggingFace Spaces / check-secret (push) Waiting to run
Deploy to HuggingFace Spaces / deploy (push) Blocked by required conditions
Create and publish Docker images with specific build args / build-main-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-main-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda126-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda126-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-slim-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-slim-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / merge-main-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda126-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-ollama-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-slim-images (push) Blocked by required conditions
Python CI / Format Backend (push) Waiting to run
Frontend Build / Format & Build Frontend (push) Waiting to run
Frontend Build / Frontend Unit Tests (push) Waiting to run
Some checks are pending
Deploy to HuggingFace Spaces / check-secret (push) Waiting to run
Deploy to HuggingFace Spaces / deploy (push) Blocked by required conditions
Create and publish Docker images with specific build args / build-main-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-main-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda126-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda126-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-slim-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-slim-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / merge-main-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda126-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-ollama-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-slim-images (push) Blocked by required conditions
Python CI / Format Backend (push) Waiting to run
Frontend Build / Format & Build Frontend (push) Waiting to run
Frontend Build / Frontend Unit Tests (push) Waiting to run
This commit is contained in:
parent
b875a438f0
commit
9c19d0abd4
5 changed files with 40 additions and 461 deletions
|
|
@ -2538,6 +2538,12 @@ DOCLING_SERVER_URL = PersistentConfig(
|
||||||
os.getenv("DOCLING_SERVER_URL", "http://docling:5001"),
|
os.getenv("DOCLING_SERVER_URL", "http://docling:5001"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
DOCLING_API_KEY = PersistentConfig(
|
||||||
|
"DOCLING_API_KEY",
|
||||||
|
"rag.docling_api_key",
|
||||||
|
os.getenv("DOCLING_API_KEY", ""),
|
||||||
|
)
|
||||||
|
|
||||||
docling_params = os.getenv("DOCLING_PARAMS", "")
|
docling_params = os.getenv("DOCLING_PARAMS", "")
|
||||||
try:
|
try:
|
||||||
docling_params = json.loads(docling_params)
|
docling_params = json.loads(docling_params)
|
||||||
|
|
@ -2550,88 +2556,6 @@ DOCLING_PARAMS = PersistentConfig(
|
||||||
docling_params,
|
docling_params,
|
||||||
)
|
)
|
||||||
|
|
||||||
DOCLING_DO_OCR = PersistentConfig(
|
|
||||||
"DOCLING_DO_OCR",
|
|
||||||
"rag.docling_do_ocr",
|
|
||||||
os.getenv("DOCLING_DO_OCR", "True").lower() == "true",
|
|
||||||
)
|
|
||||||
|
|
||||||
DOCLING_FORCE_OCR = PersistentConfig(
|
|
||||||
"DOCLING_FORCE_OCR",
|
|
||||||
"rag.docling_force_ocr",
|
|
||||||
os.getenv("DOCLING_FORCE_OCR", "False").lower() == "true",
|
|
||||||
)
|
|
||||||
|
|
||||||
DOCLING_OCR_ENGINE = PersistentConfig(
|
|
||||||
"DOCLING_OCR_ENGINE",
|
|
||||||
"rag.docling_ocr_engine",
|
|
||||||
os.getenv("DOCLING_OCR_ENGINE", "tesseract"),
|
|
||||||
)
|
|
||||||
|
|
||||||
DOCLING_OCR_LANG = PersistentConfig(
|
|
||||||
"DOCLING_OCR_LANG",
|
|
||||||
"rag.docling_ocr_lang",
|
|
||||||
os.getenv("DOCLING_OCR_LANG", "eng,fra,deu,spa"),
|
|
||||||
)
|
|
||||||
|
|
||||||
DOCLING_PDF_BACKEND = PersistentConfig(
|
|
||||||
"DOCLING_PDF_BACKEND",
|
|
||||||
"rag.docling_pdf_backend",
|
|
||||||
os.getenv("DOCLING_PDF_BACKEND", "dlparse_v4"),
|
|
||||||
)
|
|
||||||
|
|
||||||
DOCLING_TABLE_MODE = PersistentConfig(
|
|
||||||
"DOCLING_TABLE_MODE",
|
|
||||||
"rag.docling_table_mode",
|
|
||||||
os.getenv("DOCLING_TABLE_MODE", "accurate"),
|
|
||||||
)
|
|
||||||
|
|
||||||
DOCLING_PIPELINE = PersistentConfig(
|
|
||||||
"DOCLING_PIPELINE",
|
|
||||||
"rag.docling_pipeline",
|
|
||||||
os.getenv("DOCLING_PIPELINE", "standard"),
|
|
||||||
)
|
|
||||||
|
|
||||||
DOCLING_DO_PICTURE_DESCRIPTION = PersistentConfig(
|
|
||||||
"DOCLING_DO_PICTURE_DESCRIPTION",
|
|
||||||
"rag.docling_do_picture_description",
|
|
||||||
os.getenv("DOCLING_DO_PICTURE_DESCRIPTION", "False").lower() == "true",
|
|
||||||
)
|
|
||||||
|
|
||||||
DOCLING_PICTURE_DESCRIPTION_MODE = PersistentConfig(
|
|
||||||
"DOCLING_PICTURE_DESCRIPTION_MODE",
|
|
||||||
"rag.docling_picture_description_mode",
|
|
||||||
os.getenv("DOCLING_PICTURE_DESCRIPTION_MODE", ""),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
docling_picture_description_local = os.getenv("DOCLING_PICTURE_DESCRIPTION_LOCAL", "")
|
|
||||||
try:
|
|
||||||
docling_picture_description_local = json.loads(docling_picture_description_local)
|
|
||||||
except json.JSONDecodeError:
|
|
||||||
docling_picture_description_local = {}
|
|
||||||
|
|
||||||
|
|
||||||
DOCLING_PICTURE_DESCRIPTION_LOCAL = PersistentConfig(
|
|
||||||
"DOCLING_PICTURE_DESCRIPTION_LOCAL",
|
|
||||||
"rag.docling_picture_description_local",
|
|
||||||
docling_picture_description_local,
|
|
||||||
)
|
|
||||||
|
|
||||||
docling_picture_description_api = os.getenv("DOCLING_PICTURE_DESCRIPTION_API", "")
|
|
||||||
try:
|
|
||||||
docling_picture_description_api = json.loads(docling_picture_description_api)
|
|
||||||
except json.JSONDecodeError:
|
|
||||||
docling_picture_description_api = {}
|
|
||||||
|
|
||||||
|
|
||||||
DOCLING_PICTURE_DESCRIPTION_API = PersistentConfig(
|
|
||||||
"DOCLING_PICTURE_DESCRIPTION_API",
|
|
||||||
"rag.docling_picture_description_api",
|
|
||||||
docling_picture_description_api,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
DOCUMENT_INTELLIGENCE_ENDPOINT = PersistentConfig(
|
DOCUMENT_INTELLIGENCE_ENDPOINT = PersistentConfig(
|
||||||
"DOCUMENT_INTELLIGENCE_ENDPOINT",
|
"DOCUMENT_INTELLIGENCE_ENDPOINT",
|
||||||
"rag.document_intelligence_endpoint",
|
"rag.document_intelligence_endpoint",
|
||||||
|
|
|
||||||
|
|
@ -268,18 +268,8 @@ from open_webui.config import (
|
||||||
EXTERNAL_DOCUMENT_LOADER_API_KEY,
|
EXTERNAL_DOCUMENT_LOADER_API_KEY,
|
||||||
TIKA_SERVER_URL,
|
TIKA_SERVER_URL,
|
||||||
DOCLING_SERVER_URL,
|
DOCLING_SERVER_URL,
|
||||||
|
DOCLING_API_KEY,
|
||||||
DOCLING_PARAMS,
|
DOCLING_PARAMS,
|
||||||
DOCLING_DO_OCR,
|
|
||||||
DOCLING_FORCE_OCR,
|
|
||||||
DOCLING_OCR_ENGINE,
|
|
||||||
DOCLING_OCR_LANG,
|
|
||||||
DOCLING_PDF_BACKEND,
|
|
||||||
DOCLING_TABLE_MODE,
|
|
||||||
DOCLING_PIPELINE,
|
|
||||||
DOCLING_DO_PICTURE_DESCRIPTION,
|
|
||||||
DOCLING_PICTURE_DESCRIPTION_MODE,
|
|
||||||
DOCLING_PICTURE_DESCRIPTION_LOCAL,
|
|
||||||
DOCLING_PICTURE_DESCRIPTION_API,
|
|
||||||
DOCUMENT_INTELLIGENCE_ENDPOINT,
|
DOCUMENT_INTELLIGENCE_ENDPOINT,
|
||||||
DOCUMENT_INTELLIGENCE_KEY,
|
DOCUMENT_INTELLIGENCE_KEY,
|
||||||
MISTRAL_OCR_API_BASE_URL,
|
MISTRAL_OCR_API_BASE_URL,
|
||||||
|
|
@ -874,18 +864,8 @@ app.state.config.EXTERNAL_DOCUMENT_LOADER_URL = EXTERNAL_DOCUMENT_LOADER_URL
|
||||||
app.state.config.EXTERNAL_DOCUMENT_LOADER_API_KEY = EXTERNAL_DOCUMENT_LOADER_API_KEY
|
app.state.config.EXTERNAL_DOCUMENT_LOADER_API_KEY = EXTERNAL_DOCUMENT_LOADER_API_KEY
|
||||||
app.state.config.TIKA_SERVER_URL = TIKA_SERVER_URL
|
app.state.config.TIKA_SERVER_URL = TIKA_SERVER_URL
|
||||||
app.state.config.DOCLING_SERVER_URL = DOCLING_SERVER_URL
|
app.state.config.DOCLING_SERVER_URL = DOCLING_SERVER_URL
|
||||||
|
app.state.config.DOCLING_API_KEY = DOCLING_API_KEY
|
||||||
app.state.config.DOCLING_PARAMS = DOCLING_PARAMS
|
app.state.config.DOCLING_PARAMS = DOCLING_PARAMS
|
||||||
app.state.config.DOCLING_DO_OCR = DOCLING_DO_OCR
|
|
||||||
app.state.config.DOCLING_FORCE_OCR = DOCLING_FORCE_OCR
|
|
||||||
app.state.config.DOCLING_OCR_ENGINE = DOCLING_OCR_ENGINE
|
|
||||||
app.state.config.DOCLING_OCR_LANG = DOCLING_OCR_LANG
|
|
||||||
app.state.config.DOCLING_PDF_BACKEND = DOCLING_PDF_BACKEND
|
|
||||||
app.state.config.DOCLING_TABLE_MODE = DOCLING_TABLE_MODE
|
|
||||||
app.state.config.DOCLING_PIPELINE = DOCLING_PIPELINE
|
|
||||||
app.state.config.DOCLING_DO_PICTURE_DESCRIPTION = DOCLING_DO_PICTURE_DESCRIPTION
|
|
||||||
app.state.config.DOCLING_PICTURE_DESCRIPTION_MODE = DOCLING_PICTURE_DESCRIPTION_MODE
|
|
||||||
app.state.config.DOCLING_PICTURE_DESCRIPTION_LOCAL = DOCLING_PICTURE_DESCRIPTION_LOCAL
|
|
||||||
app.state.config.DOCLING_PICTURE_DESCRIPTION_API = DOCLING_PICTURE_DESCRIPTION_API
|
|
||||||
app.state.config.DOCUMENT_INTELLIGENCE_ENDPOINT = DOCUMENT_INTELLIGENCE_ENDPOINT
|
app.state.config.DOCUMENT_INTELLIGENCE_ENDPOINT = DOCUMENT_INTELLIGENCE_ENDPOINT
|
||||||
app.state.config.DOCUMENT_INTELLIGENCE_KEY = DOCUMENT_INTELLIGENCE_KEY
|
app.state.config.DOCUMENT_INTELLIGENCE_KEY = DOCUMENT_INTELLIGENCE_KEY
|
||||||
app.state.config.MISTRAL_OCR_API_BASE_URL = MISTRAL_OCR_API_BASE_URL
|
app.state.config.MISTRAL_OCR_API_BASE_URL = MISTRAL_OCR_API_BASE_URL
|
||||||
|
|
|
||||||
|
|
@ -132,8 +132,9 @@ class TikaLoader:
|
||||||
|
|
||||||
|
|
||||||
class DoclingLoader:
|
class DoclingLoader:
|
||||||
def __init__(self, url, file_path=None, mime_type=None, params=None):
|
def __init__(self, url, api_key=None, file_path=None, mime_type=None, params=None):
|
||||||
self.url = url.rstrip("/")
|
self.url = url.rstrip("/")
|
||||||
|
self.api_key = api_key
|
||||||
self.file_path = file_path
|
self.file_path = file_path
|
||||||
self.mime_type = mime_type
|
self.mime_type = mime_type
|
||||||
|
|
||||||
|
|
@ -141,6 +142,10 @@ class DoclingLoader:
|
||||||
|
|
||||||
def load(self) -> list[Document]:
|
def load(self) -> list[Document]:
|
||||||
with open(self.file_path, "rb") as f:
|
with open(self.file_path, "rb") as f:
|
||||||
|
headers = {}
|
||||||
|
if self.api_key:
|
||||||
|
headers["Authorization"] = f"Bearer {self.api_key}"
|
||||||
|
|
||||||
files = {
|
files = {
|
||||||
"files": (
|
"files": (
|
||||||
self.file_path,
|
self.file_path,
|
||||||
|
|
@ -149,60 +154,15 @@ class DoclingLoader:
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
params = {"image_export_mode": "placeholder"}
|
r = requests.post(
|
||||||
|
f"{self.url}/v1/convert/file",
|
||||||
if self.params:
|
files=files,
|
||||||
if self.params.get("do_picture_description"):
|
data={
|
||||||
params["do_picture_description"] = self.params.get(
|
"image_export_mode": "placeholder",
|
||||||
"do_picture_description"
|
**self.params,
|
||||||
)
|
},
|
||||||
|
headers=headers,
|
||||||
picture_description_mode = self.params.get(
|
)
|
||||||
"picture_description_mode", ""
|
|
||||||
).lower()
|
|
||||||
|
|
||||||
if picture_description_mode == "local" and self.params.get(
|
|
||||||
"picture_description_local", {}
|
|
||||||
):
|
|
||||||
params["picture_description_local"] = json.dumps(
|
|
||||||
self.params.get("picture_description_local", {})
|
|
||||||
)
|
|
||||||
|
|
||||||
elif picture_description_mode == "api" and self.params.get(
|
|
||||||
"picture_description_api", {}
|
|
||||||
):
|
|
||||||
params["picture_description_api"] = json.dumps(
|
|
||||||
self.params.get("picture_description_api", {})
|
|
||||||
)
|
|
||||||
|
|
||||||
params["do_ocr"] = self.params.get("do_ocr")
|
|
||||||
|
|
||||||
params["force_ocr"] = self.params.get("force_ocr")
|
|
||||||
|
|
||||||
if (
|
|
||||||
self.params.get("do_ocr")
|
|
||||||
and self.params.get("ocr_engine")
|
|
||||||
and self.params.get("ocr_lang")
|
|
||||||
):
|
|
||||||
params["ocr_engine"] = self.params.get("ocr_engine")
|
|
||||||
params["ocr_lang"] = [
|
|
||||||
lang.strip()
|
|
||||||
for lang in self.params.get("ocr_lang").split(",")
|
|
||||||
if lang.strip()
|
|
||||||
]
|
|
||||||
|
|
||||||
if self.params.get("pdf_backend"):
|
|
||||||
params["pdf_backend"] = self.params.get("pdf_backend")
|
|
||||||
|
|
||||||
if self.params.get("table_mode"):
|
|
||||||
params["table_mode"] = self.params.get("table_mode")
|
|
||||||
|
|
||||||
if self.params.get("pipeline"):
|
|
||||||
params["pipeline"] = self.params.get("pipeline")
|
|
||||||
|
|
||||||
endpoint = f"{self.url}/v1/convert/file"
|
|
||||||
r = requests.post(endpoint, files=files, data=params)
|
|
||||||
|
|
||||||
if r.ok:
|
if r.ok:
|
||||||
result = r.json()
|
result = r.json()
|
||||||
document_data = result.get("document", {})
|
document_data = result.get("document", {})
|
||||||
|
|
@ -211,7 +171,6 @@ class DoclingLoader:
|
||||||
metadata = {"Content-Type": self.mime_type} if self.mime_type else {}
|
metadata = {"Content-Type": self.mime_type} if self.mime_type else {}
|
||||||
|
|
||||||
log.debug("Docling extracted text: %s", text)
|
log.debug("Docling extracted text: %s", text)
|
||||||
|
|
||||||
return [Document(page_content=text, metadata=metadata)]
|
return [Document(page_content=text, metadata=metadata)]
|
||||||
else:
|
else:
|
||||||
error_msg = f"Error calling Docling API: {r.reason}"
|
error_msg = f"Error calling Docling API: {r.reason}"
|
||||||
|
|
@ -340,6 +299,7 @@ class Loader:
|
||||||
|
|
||||||
loader = DoclingLoader(
|
loader = DoclingLoader(
|
||||||
url=self.kwargs.get("DOCLING_SERVER_URL"),
|
url=self.kwargs.get("DOCLING_SERVER_URL"),
|
||||||
|
api_key=self.kwargs.get("DOCLING_API_KEY", None),
|
||||||
file_path=file_path,
|
file_path=file_path,
|
||||||
mime_type=file_content_type,
|
mime_type=file_content_type,
|
||||||
params=params,
|
params=params,
|
||||||
|
|
|
||||||
|
|
@ -453,18 +453,8 @@ async def get_rag_config(request: Request, user=Depends(get_admin_user)):
|
||||||
"EXTERNAL_DOCUMENT_LOADER_API_KEY": request.app.state.config.EXTERNAL_DOCUMENT_LOADER_API_KEY,
|
"EXTERNAL_DOCUMENT_LOADER_API_KEY": request.app.state.config.EXTERNAL_DOCUMENT_LOADER_API_KEY,
|
||||||
"TIKA_SERVER_URL": request.app.state.config.TIKA_SERVER_URL,
|
"TIKA_SERVER_URL": request.app.state.config.TIKA_SERVER_URL,
|
||||||
"DOCLING_SERVER_URL": request.app.state.config.DOCLING_SERVER_URL,
|
"DOCLING_SERVER_URL": request.app.state.config.DOCLING_SERVER_URL,
|
||||||
|
"DOCLING_API_KEY": request.app.state.config.DOCLING_API_KEY,
|
||||||
"DOCLING_PARAMS": request.app.state.config.DOCLING_PARAMS,
|
"DOCLING_PARAMS": request.app.state.config.DOCLING_PARAMS,
|
||||||
"DOCLING_DO_OCR": request.app.state.config.DOCLING_DO_OCR,
|
|
||||||
"DOCLING_FORCE_OCR": request.app.state.config.DOCLING_FORCE_OCR,
|
|
||||||
"DOCLING_OCR_ENGINE": request.app.state.config.DOCLING_OCR_ENGINE,
|
|
||||||
"DOCLING_OCR_LANG": request.app.state.config.DOCLING_OCR_LANG,
|
|
||||||
"DOCLING_PDF_BACKEND": request.app.state.config.DOCLING_PDF_BACKEND,
|
|
||||||
"DOCLING_TABLE_MODE": request.app.state.config.DOCLING_TABLE_MODE,
|
|
||||||
"DOCLING_PIPELINE": request.app.state.config.DOCLING_PIPELINE,
|
|
||||||
"DOCLING_DO_PICTURE_DESCRIPTION": request.app.state.config.DOCLING_DO_PICTURE_DESCRIPTION,
|
|
||||||
"DOCLING_PICTURE_DESCRIPTION_MODE": request.app.state.config.DOCLING_PICTURE_DESCRIPTION_MODE,
|
|
||||||
"DOCLING_PICTURE_DESCRIPTION_LOCAL": request.app.state.config.DOCLING_PICTURE_DESCRIPTION_LOCAL,
|
|
||||||
"DOCLING_PICTURE_DESCRIPTION_API": request.app.state.config.DOCLING_PICTURE_DESCRIPTION_API,
|
|
||||||
"DOCUMENT_INTELLIGENCE_ENDPOINT": request.app.state.config.DOCUMENT_INTELLIGENCE_ENDPOINT,
|
"DOCUMENT_INTELLIGENCE_ENDPOINT": request.app.state.config.DOCUMENT_INTELLIGENCE_ENDPOINT,
|
||||||
"DOCUMENT_INTELLIGENCE_KEY": request.app.state.config.DOCUMENT_INTELLIGENCE_KEY,
|
"DOCUMENT_INTELLIGENCE_KEY": request.app.state.config.DOCUMENT_INTELLIGENCE_KEY,
|
||||||
"MISTRAL_OCR_API_BASE_URL": request.app.state.config.MISTRAL_OCR_API_BASE_URL,
|
"MISTRAL_OCR_API_BASE_URL": request.app.state.config.MISTRAL_OCR_API_BASE_URL,
|
||||||
|
|
@ -642,18 +632,8 @@ class ConfigForm(BaseModel):
|
||||||
|
|
||||||
TIKA_SERVER_URL: Optional[str] = None
|
TIKA_SERVER_URL: Optional[str] = None
|
||||||
DOCLING_SERVER_URL: Optional[str] = None
|
DOCLING_SERVER_URL: Optional[str] = None
|
||||||
|
DOCLING_API_KEY: Optional[str] = None
|
||||||
DOCLING_PARAMS: Optional[dict] = None
|
DOCLING_PARAMS: Optional[dict] = None
|
||||||
DOCLING_DO_OCR: Optional[bool] = None
|
|
||||||
DOCLING_FORCE_OCR: Optional[bool] = None
|
|
||||||
DOCLING_OCR_ENGINE: Optional[str] = None
|
|
||||||
DOCLING_OCR_LANG: Optional[str] = None
|
|
||||||
DOCLING_PDF_BACKEND: Optional[str] = None
|
|
||||||
DOCLING_TABLE_MODE: Optional[str] = None
|
|
||||||
DOCLING_PIPELINE: Optional[str] = None
|
|
||||||
DOCLING_DO_PICTURE_DESCRIPTION: Optional[bool] = None
|
|
||||||
DOCLING_PICTURE_DESCRIPTION_MODE: Optional[str] = None
|
|
||||||
DOCLING_PICTURE_DESCRIPTION_LOCAL: Optional[dict] = None
|
|
||||||
DOCLING_PICTURE_DESCRIPTION_API: Optional[dict] = None
|
|
||||||
DOCUMENT_INTELLIGENCE_ENDPOINT: Optional[str] = None
|
DOCUMENT_INTELLIGENCE_ENDPOINT: Optional[str] = None
|
||||||
DOCUMENT_INTELLIGENCE_KEY: Optional[str] = None
|
DOCUMENT_INTELLIGENCE_KEY: Optional[str] = None
|
||||||
MISTRAL_OCR_API_BASE_URL: Optional[str] = None
|
MISTRAL_OCR_API_BASE_URL: Optional[str] = None
|
||||||
|
|
@ -831,68 +811,16 @@ async def update_rag_config(
|
||||||
if form_data.DOCLING_SERVER_URL is not None
|
if form_data.DOCLING_SERVER_URL is not None
|
||||||
else request.app.state.config.DOCLING_SERVER_URL
|
else request.app.state.config.DOCLING_SERVER_URL
|
||||||
)
|
)
|
||||||
|
request.app.state.config.DOCLING_API_KEY = (
|
||||||
|
form_data.DOCLING_API_KEY
|
||||||
|
if form_data.DOCLING_API_KEY is not None
|
||||||
|
else request.app.state.config.DOCLING_API_KEY
|
||||||
|
)
|
||||||
request.app.state.config.DOCLING_PARAMS = (
|
request.app.state.config.DOCLING_PARAMS = (
|
||||||
form_data.DOCLING_PARAMS
|
form_data.DOCLING_PARAMS
|
||||||
if form_data.DOCLING_PARAMS is not None
|
if form_data.DOCLING_PARAMS is not None
|
||||||
else request.app.state.config.DOCLING_PARAMS
|
else request.app.state.config.DOCLING_PARAMS
|
||||||
)
|
)
|
||||||
request.app.state.config.DOCLING_DO_OCR = (
|
|
||||||
form_data.DOCLING_DO_OCR
|
|
||||||
if form_data.DOCLING_DO_OCR is not None
|
|
||||||
else request.app.state.config.DOCLING_DO_OCR
|
|
||||||
)
|
|
||||||
request.app.state.config.DOCLING_FORCE_OCR = (
|
|
||||||
form_data.DOCLING_FORCE_OCR
|
|
||||||
if form_data.DOCLING_FORCE_OCR is not None
|
|
||||||
else request.app.state.config.DOCLING_FORCE_OCR
|
|
||||||
)
|
|
||||||
request.app.state.config.DOCLING_OCR_ENGINE = (
|
|
||||||
form_data.DOCLING_OCR_ENGINE
|
|
||||||
if form_data.DOCLING_OCR_ENGINE is not None
|
|
||||||
else request.app.state.config.DOCLING_OCR_ENGINE
|
|
||||||
)
|
|
||||||
request.app.state.config.DOCLING_OCR_LANG = (
|
|
||||||
form_data.DOCLING_OCR_LANG
|
|
||||||
if form_data.DOCLING_OCR_LANG is not None
|
|
||||||
else request.app.state.config.DOCLING_OCR_LANG
|
|
||||||
)
|
|
||||||
request.app.state.config.DOCLING_PDF_BACKEND = (
|
|
||||||
form_data.DOCLING_PDF_BACKEND
|
|
||||||
if form_data.DOCLING_PDF_BACKEND is not None
|
|
||||||
else request.app.state.config.DOCLING_PDF_BACKEND
|
|
||||||
)
|
|
||||||
request.app.state.config.DOCLING_TABLE_MODE = (
|
|
||||||
form_data.DOCLING_TABLE_MODE
|
|
||||||
if form_data.DOCLING_TABLE_MODE is not None
|
|
||||||
else request.app.state.config.DOCLING_TABLE_MODE
|
|
||||||
)
|
|
||||||
request.app.state.config.DOCLING_PIPELINE = (
|
|
||||||
form_data.DOCLING_PIPELINE
|
|
||||||
if form_data.DOCLING_PIPELINE is not None
|
|
||||||
else request.app.state.config.DOCLING_PIPELINE
|
|
||||||
)
|
|
||||||
request.app.state.config.DOCLING_DO_PICTURE_DESCRIPTION = (
|
|
||||||
form_data.DOCLING_DO_PICTURE_DESCRIPTION
|
|
||||||
if form_data.DOCLING_DO_PICTURE_DESCRIPTION is not None
|
|
||||||
else request.app.state.config.DOCLING_DO_PICTURE_DESCRIPTION
|
|
||||||
)
|
|
||||||
|
|
||||||
request.app.state.config.DOCLING_PICTURE_DESCRIPTION_MODE = (
|
|
||||||
form_data.DOCLING_PICTURE_DESCRIPTION_MODE
|
|
||||||
if form_data.DOCLING_PICTURE_DESCRIPTION_MODE is not None
|
|
||||||
else request.app.state.config.DOCLING_PICTURE_DESCRIPTION_MODE
|
|
||||||
)
|
|
||||||
request.app.state.config.DOCLING_PICTURE_DESCRIPTION_LOCAL = (
|
|
||||||
form_data.DOCLING_PICTURE_DESCRIPTION_LOCAL
|
|
||||||
if form_data.DOCLING_PICTURE_DESCRIPTION_LOCAL is not None
|
|
||||||
else request.app.state.config.DOCLING_PICTURE_DESCRIPTION_LOCAL
|
|
||||||
)
|
|
||||||
request.app.state.config.DOCLING_PICTURE_DESCRIPTION_API = (
|
|
||||||
form_data.DOCLING_PICTURE_DESCRIPTION_API
|
|
||||||
if form_data.DOCLING_PICTURE_DESCRIPTION_API is not None
|
|
||||||
else request.app.state.config.DOCLING_PICTURE_DESCRIPTION_API
|
|
||||||
)
|
|
||||||
|
|
||||||
request.app.state.config.DOCUMENT_INTELLIGENCE_ENDPOINT = (
|
request.app.state.config.DOCUMENT_INTELLIGENCE_ENDPOINT = (
|
||||||
form_data.DOCUMENT_INTELLIGENCE_ENDPOINT
|
form_data.DOCUMENT_INTELLIGENCE_ENDPOINT
|
||||||
if form_data.DOCUMENT_INTELLIGENCE_ENDPOINT is not None
|
if form_data.DOCUMENT_INTELLIGENCE_ENDPOINT is not None
|
||||||
|
|
@ -1189,18 +1117,8 @@ async def update_rag_config(
|
||||||
"EXTERNAL_DOCUMENT_LOADER_API_KEY": request.app.state.config.EXTERNAL_DOCUMENT_LOADER_API_KEY,
|
"EXTERNAL_DOCUMENT_LOADER_API_KEY": request.app.state.config.EXTERNAL_DOCUMENT_LOADER_API_KEY,
|
||||||
"TIKA_SERVER_URL": request.app.state.config.TIKA_SERVER_URL,
|
"TIKA_SERVER_URL": request.app.state.config.TIKA_SERVER_URL,
|
||||||
"DOCLING_SERVER_URL": request.app.state.config.DOCLING_SERVER_URL,
|
"DOCLING_SERVER_URL": request.app.state.config.DOCLING_SERVER_URL,
|
||||||
|
"DOCLING_API_KEY": request.app.state.config.DOCLING_API_KEY,
|
||||||
"DOCLING_PARAMS": request.app.state.config.DOCLING_PARAMS,
|
"DOCLING_PARAMS": request.app.state.config.DOCLING_PARAMS,
|
||||||
"DOCLING_DO_OCR": request.app.state.config.DOCLING_DO_OCR,
|
|
||||||
"DOCLING_FORCE_OCR": request.app.state.config.DOCLING_FORCE_OCR,
|
|
||||||
"DOCLING_OCR_ENGINE": request.app.state.config.DOCLING_OCR_ENGINE,
|
|
||||||
"DOCLING_OCR_LANG": request.app.state.config.DOCLING_OCR_LANG,
|
|
||||||
"DOCLING_PDF_BACKEND": request.app.state.config.DOCLING_PDF_BACKEND,
|
|
||||||
"DOCLING_TABLE_MODE": request.app.state.config.DOCLING_TABLE_MODE,
|
|
||||||
"DOCLING_PIPELINE": request.app.state.config.DOCLING_PIPELINE,
|
|
||||||
"DOCLING_DO_PICTURE_DESCRIPTION": request.app.state.config.DOCLING_DO_PICTURE_DESCRIPTION,
|
|
||||||
"DOCLING_PICTURE_DESCRIPTION_MODE": request.app.state.config.DOCLING_PICTURE_DESCRIPTION_MODE,
|
|
||||||
"DOCLING_PICTURE_DESCRIPTION_LOCAL": request.app.state.config.DOCLING_PICTURE_DESCRIPTION_LOCAL,
|
|
||||||
"DOCLING_PICTURE_DESCRIPTION_API": request.app.state.config.DOCLING_PICTURE_DESCRIPTION_API,
|
|
||||||
"DOCUMENT_INTELLIGENCE_ENDPOINT": request.app.state.config.DOCUMENT_INTELLIGENCE_ENDPOINT,
|
"DOCUMENT_INTELLIGENCE_ENDPOINT": request.app.state.config.DOCUMENT_INTELLIGENCE_ENDPOINT,
|
||||||
"DOCUMENT_INTELLIGENCE_KEY": request.app.state.config.DOCUMENT_INTELLIGENCE_KEY,
|
"DOCUMENT_INTELLIGENCE_KEY": request.app.state.config.DOCUMENT_INTELLIGENCE_KEY,
|
||||||
"MISTRAL_OCR_API_BASE_URL": request.app.state.config.MISTRAL_OCR_API_BASE_URL,
|
"MISTRAL_OCR_API_BASE_URL": request.app.state.config.MISTRAL_OCR_API_BASE_URL,
|
||||||
|
|
@ -1607,20 +1525,8 @@ def process_file(
|
||||||
EXTERNAL_DOCUMENT_LOADER_API_KEY=request.app.state.config.EXTERNAL_DOCUMENT_LOADER_API_KEY,
|
EXTERNAL_DOCUMENT_LOADER_API_KEY=request.app.state.config.EXTERNAL_DOCUMENT_LOADER_API_KEY,
|
||||||
TIKA_SERVER_URL=request.app.state.config.TIKA_SERVER_URL,
|
TIKA_SERVER_URL=request.app.state.config.TIKA_SERVER_URL,
|
||||||
DOCLING_SERVER_URL=request.app.state.config.DOCLING_SERVER_URL,
|
DOCLING_SERVER_URL=request.app.state.config.DOCLING_SERVER_URL,
|
||||||
DOCLING_PARAMS={
|
DOCLING_API_KEY=request.app.state.config.DOCLING_API_KEY,
|
||||||
"do_ocr": request.app.state.config.DOCLING_DO_OCR,
|
DOCLING_PARAMS=request.app.state.config.DOCLING_PARAMS,
|
||||||
"force_ocr": request.app.state.config.DOCLING_FORCE_OCR,
|
|
||||||
"ocr_engine": request.app.state.config.DOCLING_OCR_ENGINE,
|
|
||||||
"ocr_lang": request.app.state.config.DOCLING_OCR_LANG,
|
|
||||||
"pdf_backend": request.app.state.config.DOCLING_PDF_BACKEND,
|
|
||||||
"table_mode": request.app.state.config.DOCLING_TABLE_MODE,
|
|
||||||
"pipeline": request.app.state.config.DOCLING_PIPELINE,
|
|
||||||
"do_picture_description": request.app.state.config.DOCLING_DO_PICTURE_DESCRIPTION,
|
|
||||||
"picture_description_mode": request.app.state.config.DOCLING_PICTURE_DESCRIPTION_MODE,
|
|
||||||
"picture_description_local": request.app.state.config.DOCLING_PICTURE_DESCRIPTION_LOCAL,
|
|
||||||
"picture_description_api": request.app.state.config.DOCLING_PICTURE_DESCRIPTION_API,
|
|
||||||
**request.app.state.config.DOCLING_PARAMS,
|
|
||||||
},
|
|
||||||
PDF_EXTRACT_IMAGES=request.app.state.config.PDF_EXTRACT_IMAGES,
|
PDF_EXTRACT_IMAGES=request.app.state.config.PDF_EXTRACT_IMAGES,
|
||||||
DOCUMENT_INTELLIGENCE_ENDPOINT=request.app.state.config.DOCUMENT_INTELLIGENCE_ENDPOINT,
|
DOCUMENT_INTELLIGENCE_ENDPOINT=request.app.state.config.DOCUMENT_INTELLIGENCE_ENDPOINT,
|
||||||
DOCUMENT_INTELLIGENCE_KEY=request.app.state.config.DOCUMENT_INTELLIGENCE_KEY,
|
DOCUMENT_INTELLIGENCE_KEY=request.app.state.config.DOCUMENT_INTELLIGENCE_KEY,
|
||||||
|
|
|
||||||
|
|
@ -151,26 +151,6 @@
|
||||||
toast.error($i18n.t('Docling Server URL required.'));
|
toast.error($i18n.t('Docling Server URL required.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (
|
|
||||||
RAGConfig.CONTENT_EXTRACTION_ENGINE === 'docling' &&
|
|
||||||
RAGConfig.DOCLING_DO_OCR &&
|
|
||||||
((RAGConfig.DOCLING_OCR_ENGINE === '' && RAGConfig.DOCLING_OCR_LANG !== '') ||
|
|
||||||
(RAGConfig.DOCLING_OCR_ENGINE !== '' && RAGConfig.DOCLING_OCR_LANG === ''))
|
|
||||||
) {
|
|
||||||
toast.error(
|
|
||||||
$i18n.t('Both Docling OCR Engine and Language(s) must be provided or both left empty.')
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
RAGConfig.CONTENT_EXTRACTION_ENGINE === 'docling' &&
|
|
||||||
RAGConfig.DOCLING_DO_OCR === false &&
|
|
||||||
RAGConfig.DOCLING_FORCE_OCR === true
|
|
||||||
) {
|
|
||||||
toast.error($i18n.t('In order to force OCR, performing OCR must be enabled.'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
RAGConfig.CONTENT_EXTRACTION_ENGINE === 'datalab_marker' &&
|
RAGConfig.CONTENT_EXTRACTION_ENGINE === 'datalab_marker' &&
|
||||||
RAGConfig.DATALAB_MARKER_ADDITIONAL_CONFIG &&
|
RAGConfig.DATALAB_MARKER_ADDITIONAL_CONFIG &&
|
||||||
|
|
@ -238,12 +218,6 @@
|
||||||
ALLOWED_FILE_EXTENSIONS: RAGConfig.ALLOWED_FILE_EXTENSIONS.split(',')
|
ALLOWED_FILE_EXTENSIONS: RAGConfig.ALLOWED_FILE_EXTENSIONS.split(',')
|
||||||
.map((ext) => ext.trim())
|
.map((ext) => ext.trim())
|
||||||
.filter((ext) => ext !== ''),
|
.filter((ext) => ext !== ''),
|
||||||
DOCLING_PICTURE_DESCRIPTION_LOCAL: JSON.parse(
|
|
||||||
RAGConfig.DOCLING_PICTURE_DESCRIPTION_LOCAL || '{}'
|
|
||||||
),
|
|
||||||
DOCLING_PICTURE_DESCRIPTION_API: JSON.parse(
|
|
||||||
RAGConfig.DOCLING_PICTURE_DESCRIPTION_API || '{}'
|
|
||||||
),
|
|
||||||
DOCLING_PARAMS:
|
DOCLING_PARAMS:
|
||||||
typeof RAGConfig.DOCLING_PARAMS === 'string' && RAGConfig.DOCLING_PARAMS.trim() !== ''
|
typeof RAGConfig.DOCLING_PARAMS === 'string' && RAGConfig.DOCLING_PARAMS.trim() !== ''
|
||||||
? JSON.parse(RAGConfig.DOCLING_PARAMS)
|
? JSON.parse(RAGConfig.DOCLING_PARAMS)
|
||||||
|
|
@ -281,16 +255,6 @@
|
||||||
const config = await getRAGConfig(localStorage.token);
|
const config = await getRAGConfig(localStorage.token);
|
||||||
config.ALLOWED_FILE_EXTENSIONS = (config?.ALLOWED_FILE_EXTENSIONS ?? []).join(', ');
|
config.ALLOWED_FILE_EXTENSIONS = (config?.ALLOWED_FILE_EXTENSIONS ?? []).join(', ');
|
||||||
|
|
||||||
config.DOCLING_PICTURE_DESCRIPTION_LOCAL = JSON.stringify(
|
|
||||||
config.DOCLING_PICTURE_DESCRIPTION_LOCAL ?? {},
|
|
||||||
null,
|
|
||||||
2
|
|
||||||
);
|
|
||||||
config.DOCLING_PICTURE_DESCRIPTION_API = JSON.stringify(
|
|
||||||
config.DOCLING_PICTURE_DESCRIPTION_API ?? {},
|
|
||||||
null,
|
|
||||||
2
|
|
||||||
);
|
|
||||||
config.DOCLING_PARAMS =
|
config.DOCLING_PARAMS =
|
||||||
typeof config.DOCLING_PARAMS === 'object'
|
typeof config.DOCLING_PARAMS === 'object'
|
||||||
? JSON.stringify(config.DOCLING_PARAMS ?? {}, null, 2)
|
? JSON.stringify(config.DOCLING_PARAMS ?? {}, null, 2)
|
||||||
|
|
@ -589,174 +553,19 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{:else if RAGConfig.CONTENT_EXTRACTION_ENGINE === 'docling'}
|
{:else if RAGConfig.CONTENT_EXTRACTION_ENGINE === 'docling'}
|
||||||
<div class="flex w-full mt-1">
|
<div class="my-0.5 flex gap-2 pr-2">
|
||||||
<input
|
<input
|
||||||
class="flex-1 w-full text-sm bg-transparent outline-hidden"
|
class="flex-1 w-full text-sm bg-transparent outline-hidden"
|
||||||
placeholder={$i18n.t('Enter Docling Server URL')}
|
placeholder={$i18n.t('Enter Docling Server URL')}
|
||||||
bind:value={RAGConfig.DOCLING_SERVER_URL}
|
bind:value={RAGConfig.DOCLING_SERVER_URL}
|
||||||
/>
|
/>
|
||||||
|
<SensitiveInput
|
||||||
|
placeholder={$i18n.t('Enter Docling API Key')}
|
||||||
|
bind:value={RAGConfig.DOCLING_API_KEY}
|
||||||
|
required={false}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex w-full mt-2">
|
|
||||||
<div class="flex-1 flex justify-between">
|
|
||||||
<div class=" self-center text-xs font-medium">
|
|
||||||
{$i18n.t('Perform OCR')}
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center relative">
|
|
||||||
<Switch bind:state={RAGConfig.DOCLING_DO_OCR} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{#if RAGConfig.DOCLING_DO_OCR}
|
|
||||||
<div class="flex w-full mt-2">
|
|
||||||
<input
|
|
||||||
class="flex-1 w-full text-sm bg-transparent outline-hidden"
|
|
||||||
placeholder={$i18n.t('Enter Docling OCR Engine')}
|
|
||||||
bind:value={RAGConfig.DOCLING_OCR_ENGINE}
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
class="flex-1 w-full text-sm bg-transparent outline-hidden"
|
|
||||||
placeholder={$i18n.t('Enter Docling OCR Language(s)')}
|
|
||||||
bind:value={RAGConfig.DOCLING_OCR_LANG}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<div class="flex w-full mt-2">
|
|
||||||
<div class="flex-1 flex justify-between">
|
|
||||||
<div class=" self-center text-xs font-medium">
|
|
||||||
{$i18n.t('Force OCR')}
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center relative">
|
|
||||||
<Switch bind:state={RAGConfig.DOCLING_FORCE_OCR} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between w-full mt-2">
|
|
||||||
<div class="self-center text-xs font-medium">
|
|
||||||
<Tooltip content={''} placement="top-start">
|
|
||||||
{$i18n.t('PDF Backend')}
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
|
||||||
<div class="">
|
|
||||||
<select
|
|
||||||
class="dark:bg-gray-900 w-fit pr-8 rounded-sm px-2 text-xs bg-transparent outline-hidden text-right"
|
|
||||||
bind:value={RAGConfig.DOCLING_PDF_BACKEND}
|
|
||||||
>
|
|
||||||
<option value="pypdfium2">{$i18n.t('pypdfium2')}</option>
|
|
||||||
<option value="dlparse_v1">{$i18n.t('dlparse_v1')}</option>
|
|
||||||
<option value="dlparse_v2">{$i18n.t('dlparse_v2')}</option>
|
|
||||||
<option value="dlparse_v4">{$i18n.t('dlparse_v4')}</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between w-full mt-2">
|
|
||||||
<div class="self-center text-xs font-medium">
|
|
||||||
<Tooltip content={''} placement="top-start">
|
|
||||||
{$i18n.t('Table Mode')}
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
|
||||||
<div class="">
|
|
||||||
<select
|
|
||||||
class="dark:bg-gray-900 w-fit pr-8 rounded-sm px-2 text-xs bg-transparent outline-hidden text-right"
|
|
||||||
bind:value={RAGConfig.DOCLING_TABLE_MODE}
|
|
||||||
>
|
|
||||||
<option value="fast">{$i18n.t('fast')}</option>
|
|
||||||
<option value="accurate">{$i18n.t('accurate')}</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between w-full mt-2">
|
|
||||||
<div class="self-center text-xs font-medium">
|
|
||||||
<Tooltip content={''} placement="top-start">
|
|
||||||
{$i18n.t('Pipeline')}
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
|
||||||
<div class="">
|
|
||||||
<select
|
|
||||||
class="dark:bg-gray-900 w-fit pr-8 rounded-sm px-2 text-xs bg-transparent outline-hidden text-right"
|
|
||||||
bind:value={RAGConfig.DOCLING_PIPELINE}
|
|
||||||
>
|
|
||||||
<option value="standard">{$i18n.t('standard')}</option>
|
|
||||||
<option value="vlm">{$i18n.t('vlm')}</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex w-full mt-2">
|
|
||||||
<div class="flex-1 flex justify-between">
|
|
||||||
<div class=" self-center text-xs font-medium">
|
|
||||||
{$i18n.t('Describe Pictures in Documents')}
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center relative">
|
|
||||||
<Switch bind:state={RAGConfig.DOCLING_DO_PICTURE_DESCRIPTION} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{#if RAGConfig.DOCLING_DO_PICTURE_DESCRIPTION}
|
|
||||||
<div class="flex justify-between w-full mt-2">
|
|
||||||
<div class="self-center text-xs font-medium">
|
|
||||||
<Tooltip content={''} placement="top-start">
|
|
||||||
{$i18n.t('Picture Description Mode')}
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
|
||||||
<div class="">
|
|
||||||
<select
|
|
||||||
class="dark:bg-gray-900 w-fit pr-8 rounded-sm px-2 text-xs bg-transparent outline-hidden text-right"
|
|
||||||
bind:value={RAGConfig.DOCLING_PICTURE_DESCRIPTION_MODE}
|
|
||||||
>
|
|
||||||
<option value="">{$i18n.t('Default')}</option>
|
|
||||||
<option value="local">{$i18n.t('Local')}</option>
|
|
||||||
<option value="api">{$i18n.t('API')}</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{#if RAGConfig.DOCLING_PICTURE_DESCRIPTION_MODE === 'local'}
|
|
||||||
<div class="flex flex-col gap-2 mt-2">
|
|
||||||
<div class=" flex flex-col w-full justify-between">
|
|
||||||
<div class=" mb-1 text-xs font-medium">
|
|
||||||
{$i18n.t('Picture Description Local Config')}
|
|
||||||
</div>
|
|
||||||
<div class="flex w-full items-center relative">
|
|
||||||
<Tooltip
|
|
||||||
content={$i18n.t(
|
|
||||||
'Options for running a local vision-language model in the picture description. The parameters refer to a model hosted on Hugging Face. This parameter is mutually exclusive with picture_description_api.'
|
|
||||||
)}
|
|
||||||
placement="top-start"
|
|
||||||
className="w-full"
|
|
||||||
>
|
|
||||||
<Textarea
|
|
||||||
bind:value={RAGConfig.DOCLING_PICTURE_DESCRIPTION_LOCAL}
|
|
||||||
placeholder={$i18n.t('Enter Config in JSON format')}
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{:else if RAGConfig.DOCLING_PICTURE_DESCRIPTION_MODE === 'api'}
|
|
||||||
<div class="flex flex-col gap-2 mt-2">
|
|
||||||
<div class=" flex flex-col w-full justify-between">
|
|
||||||
<div class=" mb-1 text-xs font-medium">
|
|
||||||
{$i18n.t('Picture Description API Config')}
|
|
||||||
</div>
|
|
||||||
<div class="flex w-full items-center relative">
|
|
||||||
<Tooltip
|
|
||||||
content={$i18n.t(
|
|
||||||
'API details for using a vision-language model in the picture description. This parameter is mutually exclusive with picture_description_local.'
|
|
||||||
)}
|
|
||||||
placement="top-start"
|
|
||||||
className="w-full"
|
|
||||||
>
|
|
||||||
<Textarea
|
|
||||||
bind:value={RAGConfig.DOCLING_PICTURE_DESCRIPTION_API}
|
|
||||||
placeholder={$i18n.t('Enter Config in JSON format')}
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<div class="flex flex-col gap-2 mt-2">
|
<div class="flex flex-col gap-2 mt-2">
|
||||||
<div class=" flex flex-col w-full justify-between">
|
<div class=" flex flex-col w-full justify-between">
|
||||||
<div class=" mb-1 text-xs font-medium">
|
<div class=" mb-1 text-xs font-medium">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue