mirror of
https://github.com/primedigitaltech/market-assistant.git
synced 2026-07-21 23:41:39 +08:00
新增 pipeline/openai_gateway:credentials、text_chat、ingredients_op、ingredients_defaults 等;AI_crawler 仅加载 .env 与重导出。CrawlerOpenAiCompatible 与京东详情/流水线改走 import pipeline.openai_gateway,不再依赖 sys.path 注入爬虫目录。llm/providers/shared 转重导 gateway。详情脚本补充 backend 入 path。 Made-with: Cursor
23 lines
641 B
Python
23 lines
641 B
Python
"""(连接, 读) 超时时长:供 ``chat/completions`` 与视觉请求使用。"""
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
|
|
def chat_completion_read_timeout() -> tuple[float, float]:
|
|
read = 600
|
|
raw = (os.environ.get("LLM_CHAT_TIMEOUT") or os.environ.get("OPENAI_TIMEOUT") or "").strip()
|
|
if raw:
|
|
try:
|
|
read = max(60, int(raw))
|
|
except ValueError:
|
|
pass
|
|
conn = 30.0
|
|
raw_c = (os.environ.get("LLM_CHAT_CONNECT_TIMEOUT") or "").strip()
|
|
if raw_c:
|
|
try:
|
|
conn = max(5.0, float(raw_c))
|
|
except ValueError:
|
|
pass
|
|
return (conn, float(read))
|