init medical training project
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import hashlib
|
||||
from pathlib import Path
|
||||
from functools import lru_cache
|
||||
|
||||
_PROMPTS_DIR = Path(__file__).resolve().parent
|
||||
|
||||
|
||||
@lru_cache(maxsize=16)
|
||||
def load_prompt(name: str) -> tuple[str, str]:
|
||||
"""加载提示词文件,返回 (content, prompt_version)。
|
||||
|
||||
prompt_version = 文件内容 MD5 前 8 位,用于审计追溯。
|
||||
"""
|
||||
path = _PROMPTS_DIR / f'{name}.md'
|
||||
content = path.read_text(encoding='utf-8')
|
||||
version = hashlib.md5(content.encode('utf-8')).hexdigest()[:8]
|
||||
return content, version
|
||||
Reference in New Issue
Block a user