Files
gangyan/langchain-chat/server/knowledge_base/pdf_convert_url.py

17 lines
473 B
Python
Raw Normal View History

"""
PDF Markdown 微服务的 HTTP 地址仅此一处拼 URL import configs避免旧 .pyc / 错误包名导致仍用 0.0.0.0
"""
from __future__ import annotations
import os
_DEFAULT = "http://127.0.0.1:6006/convert/"
def resolve_pdf_convert_post_url() -> str:
u = (os.environ.get("PDF_CONVERT_API_URL") or "").strip() or _DEFAULT
u = u.replace("0.0.0.0", "127.0.0.1")
if not u.startswith("http"):
return _DEFAULT
return u