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

17 lines
473 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
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