| 123456789101112131415161718 |
- # -*- coding: utf-8 -*-
- """Prompt loading helpers for document chat."""
- from pathlib import Path
- from typing import Any, Dict
- import yaml
- PROJECT_ROOT = Path(__file__).resolve().parents[3]
- PROMPT_DIR = PROJECT_ROOT / "config" / "prompt"
- def load_prompt_config(file_name: str) -> Dict[str, Any]:
- prompt_path = PROMPT_DIR / file_name
- if not prompt_path.exists():
- return {}
- with open(prompt_path, "r", encoding="utf-8") as handle:
- return yaml.safe_load(handle) or {}
|