mirror of
https://github.com/csunny/DB-GPT.git
synced 2026-07-16 17:15:22 +00:00
fix:fix example path
This commit is contained in:
@@ -71,17 +71,27 @@ def _resolve_example_source(example: dict) -> Optional[str]:
|
||||
(PyPI install mode).
|
||||
"""
|
||||
# --- 1. Source-code / work_dir mode ---
|
||||
base_dir = os.getcwd()
|
||||
candidates_dirs = [os.getcwd()]
|
||||
if (
|
||||
CFG.SYSTEM_APP
|
||||
and hasattr(CFG.SYSTEM_APP, "work_dir")
|
||||
and CFG.SYSTEM_APP.work_dir
|
||||
):
|
||||
base_dir = CFG.SYSTEM_APP.work_dir
|
||||
candidates_dirs.insert(0, CFG.SYSTEM_APP.work_dir)
|
||||
|
||||
candidate = os.path.join(base_dir, example["source_path"])
|
||||
if os.path.isfile(candidate):
|
||||
return candidate
|
||||
# Also try ROOT_PATH which reliably resolves to the project root in dev mode
|
||||
try:
|
||||
from dbgpt.configs.model_config import ROOT_PATH
|
||||
|
||||
if ROOT_PATH not in candidates_dirs:
|
||||
candidates_dirs.append(ROOT_PATH)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
for base_dir in candidates_dirs:
|
||||
candidate = os.path.join(base_dir, example["source_path"])
|
||||
if os.path.isfile(candidate):
|
||||
return candidate
|
||||
|
||||
# --- 2. Builtin examples bundled in the wheel ---
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user