chore: format

This commit is contained in:
Timothy Jaeryang Baek 2025-09-09 18:19:31 +04:00
parent cbb4684b16
commit 485392fe63
3 changed files with 17 additions and 5 deletions

View File

@ -178,7 +178,11 @@ class DoclingLoader:
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"):
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()
@ -195,7 +199,6 @@ class DoclingLoader:
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)

View File

@ -337,7 +337,10 @@ async def speech(request: Request, user=Depends(get_verified_user)):
timeout=timeout, trust_env=True
) as session:
r = await session.post(
url=urljoin(request.app.state.config.TTS_OPENAI_API_BASE_URL, "/audio/speech"),
url=urljoin(
request.app.state.config.TTS_OPENAI_API_BASE_URL,
"/audio/speech",
),
json=payload,
headers={
"Content-Type": "application/json",
@ -465,7 +468,10 @@ async def speech(request: Request, user=Depends(get_verified_user)):
timeout=timeout, trust_env=True
) as session:
async with session.post(
urljoin(base_url or f"https://{region}.tts.speech.microsoft.com", "/cognitiveservices/v1"),
urljoin(
base_url or f"https://{region}.tts.speech.microsoft.com",
"/cognitiveservices/v1",
),
headers={
"Ocp-Apim-Subscription-Key": request.app.state.config.TTS_API_KEY,
"Content-Type": "application/ssml+xml",

View File

@ -340,7 +340,10 @@ def merge_ollama_models_lists(model_lists):
return list(merged_models.values())
@cached(ttl=MODELS_CACHE_TTL, key=lambda _, user: f"ollama_all_models_{user.id}" if user else "ollama_all_models")
@cached(
ttl=MODELS_CACHE_TTL,
key=lambda _, user: f"ollama_all_models_{user.id}" if user else "ollama_all_models",
)
async def get_all_models(request: Request, user: UserModel = None):
log.info("get_all_models()")
if request.app.state.config.ENABLE_OLLAMA_API: