manual-deploy 2026-06-08 00:13
This commit is contained in:
parent
738afda78a
commit
4b68523825
@ -200,7 +200,7 @@ async def get_ocr_config(
|
||||
cfg = row.scalar_one_or_none()
|
||||
if not cfg:
|
||||
return {"configured": False}
|
||||
key = cfg.api_key_enc or ""
|
||||
key = decrypt_secret(cfg.api_key_enc) or ""
|
||||
masked_key = f"{key[:6]}{'*' * (len(key) - 10)}{key[-4:]}" if len(key) > 10 else "***"
|
||||
return {
|
||||
"configured": True,
|
||||
@ -232,7 +232,7 @@ async def parse_document(
|
||||
async with httpx.AsyncClient(timeout=120) as client:
|
||||
r = await client.post(
|
||||
f"{UPSTAGE_BASE}/document-digitization",
|
||||
headers={"Authorization": f"Bearer {cfg.api_key_enc}"},
|
||||
headers={"Authorization": f"Bearer {decrypt_secret(cfg.api_key_enc)}"},
|
||||
files={"document": (file.filename, file_bytes, mime)},
|
||||
data={
|
||||
"model": model or cfg.model,
|
||||
@ -286,7 +286,7 @@ async def extract_information(
|
||||
async with httpx.AsyncClient(timeout=120) as client:
|
||||
r = await client.post(
|
||||
f"{UPSTAGE_BASE}/information-extraction",
|
||||
headers={"Authorization": f"Bearer {cfg.api_key_enc}"},
|
||||
headers={"Authorization": f"Bearer {decrypt_secret(cfg.api_key_enc)}"},
|
||||
files={"document": (file.filename, file_bytes, mime)},
|
||||
data={"schema": json.dumps(schema_dict, ensure_ascii=False)}
|
||||
)
|
||||
@ -342,7 +342,7 @@ async def document_qa(
|
||||
async with httpx.AsyncClient(timeout=120) as client:
|
||||
r = await client.post(
|
||||
f"{UPSTAGE_BASE}/document-qa",
|
||||
headers={"Authorization": f"Bearer {cfg.api_key_enc}"},
|
||||
headers={"Authorization": f"Bearer {decrypt_secret(cfg.api_key_enc)}"},
|
||||
files={"document": (file.filename, file_bytes, mime)},
|
||||
data={"question": question}
|
||||
)
|
||||
@ -386,14 +386,14 @@ async def batch_parse(
|
||||
if mode == "extract" and schema:
|
||||
r = await client.post(
|
||||
f"{UPSTAGE_BASE}/information-extraction",
|
||||
headers={"Authorization": f"Bearer {cfg.api_key_enc}"},
|
||||
headers={"Authorization": f"Bearer {decrypt_secret(cfg.api_key_enc)}"},
|
||||
files={"document": (file.filename, file_bytes, mime)},
|
||||
data={"schema": schema}
|
||||
)
|
||||
else:
|
||||
r = await client.post(
|
||||
f"{UPSTAGE_BASE}/document-digitization",
|
||||
headers={"Authorization": f"Bearer {cfg.api_key_enc}"},
|
||||
headers={"Authorization": f"Bearer {decrypt_secret(cfg.api_key_enc)}"},
|
||||
files={"document": (file.filename, file_bytes, mime)},
|
||||
data={"model": cfg.model, "ocr": "auto", "output_formats": '["text"]'}
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user