27 lines
677 B
Python
27 lines
677 B
Python
"""
|
|
Profile 加载器 — 从 profiles/ 目录读取 Markdown 文件作为 Agent 的 instruction
|
|
"""
|
|
|
|
from pathlib import Path
|
|
|
|
PROFILES_DIR = Path(__file__).parent.parent / "profiles"
|
|
|
|
|
|
def load_profile(filename: str) -> str:
|
|
"""
|
|
加载指定名称的 profile 文件内容。
|
|
|
|
Args:
|
|
filename: profile 文件名,如 "l1_live_course.md"
|
|
|
|
Returns:
|
|
profile 文件的完整文本内容
|
|
|
|
Raises:
|
|
FileNotFoundError: profile 文件不存在
|
|
"""
|
|
filepath = PROFILES_DIR / filename
|
|
if not filepath.exists():
|
|
raise FileNotFoundError(f"Profile 文件不存在: {filepath}")
|
|
return filepath.read_text(encoding="utf-8")
|