Merge pull request #167 from ImPavloh/patch-1

Refactor load_prompt function
pull/294/head
Toran Bruce Richards 2023-04-06 07:55:10 +01:00 committed by GitHub
commit ce646f7a3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 6 deletions

View File

@ -1,15 +1,14 @@
import os
from pathlib import Path
SRC_DIR = Path(__file__).parent
def load_prompt():
try:
# get directory of this file:
file_dir = Path(os.path.dirname(os.path.realpath(__file__)))
data_dir = file_dir / "data"
prompt_file = data_dir / "prompt.txt"
# Load the promt from data/prompt.txt
with open(SRC_DIR/ "data/prompt.txt", "r") as prompt_file:
file_dir = Path(__file__).parent
prompt_file_path = file_dir / "data" / "prompt.txt"
# Load the prompt from data/prompt.txt
with open(prompt_file_path, "r") as prompt_file:
prompt = prompt_file.read()
return prompt