fix: DSA path auto-detect — check server path /home/hmo/daily-stock-analysis first

This commit is contained in:
hmo
2026-06-29 23:47:59 +08:00
parent 6abc2e45b0
commit 89153832b4
4 changed files with 28 additions and 10 deletions
Binary file not shown.
Binary file not shown.
+13 -3
View File
@@ -26,10 +26,20 @@ from pathlib import Path
logger = logging.getLogger(__name__)
# DSA 源码路径
_DSA_BASE = Path(__file__).resolve().parent.parent / "daily-stock-analysis" / "ZhuLinsen-daily_stock_analysis-a448886"
# DSA 源码路径(按优先级尝试)
_DSA_CANDIDATES = [
"/home/hmo/daily-stock-analysis",
str(Path(__file__).resolve().parent.parent / "daily-stock-analysis" / "ZhuLinsen-daily_stock_analysis-a448886"),
]
_HAS_DSA = _DSA_BASE.is_dir() and (_DSA_BASE / "data_provider" / "base.py").exists()
_DSA_BASE = None
for _c in _DSA_CANDIDATES:
_p = Path(_c)
if _p.is_dir() and (_p / "data_provider" / "base.py").exists():
_DSA_BASE = _p
break
_HAS_DSA = _DSA_BASE is not None
def enrich_analysis_context(region: str = "cn") -> str:
+15 -7
View File
@@ -36,14 +36,22 @@ logger = logging.getLogger(__name__)
# ── 路径配置 ─────────────────────────────────────────────────────────
# DSA 源码路径(相对于 MoFin 项目
_DSA_BASE = os.path.normpath(os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"..", "daily-stock-analysis",
"ZhuLinsen-daily_stock_analysis-a448886"
))
# DSA 源码路径(按优先级尝试
_DSA_CANDIDATES = [
"/home/hmo/daily-stock-analysis", # 服务器部署路径
os.path.normpath(os.path.join( # 本地开发路径
os.path.dirname(os.path.abspath(__file__)),
"..", "daily-stock-analysis", "ZhuLinsen-daily_stock_analysis-a448886"
)),
]
_HAS_DSA = os.path.isdir(_DSA_BASE)
_DSA_BASE = None
for _c in _DSA_CANDIDATES:
if os.path.isdir(_c) and os.path.isfile(os.path.join(_c, "data_provider", "base.py")):
_DSA_BASE = _c
break
_HAS_DSA = _DSA_BASE is not None
# ── MoDataProvider ───────────────────────────────────────────────────