Renamed prompt.txt to yolo.prompt

This commit is contained in:
Heiko Joerg Schick
2023-09-05 22:36:04 +02:00
parent 79b6de19f2
commit a3e4209d1e
2 changed files with 5 additions and 5 deletions
View File
+5 -5
View File
@@ -126,10 +126,10 @@ def get_os_friendly_name():
def get_full_prompt(user_prompt, shell):
"""
Constructs a full prompt string by appending the user's prompt to a predefined prompt template
located in the 'prompt.txt' file.
located in the 'yolo.prompt' file.
The function finds the absolute path of the currently executing file, and based on this path,
identifies the directory of 'prompt.txt'. It reads this file, replaces placeholders {shell}
identifies the directory of 'yolo.prompt'. It reads this file, replaces placeholders {shell}
and {os} in the text file with a passed shell parameter and the friendly name of the operating
system respectively. The user prompt is then appended to this pre-prompt. If the resulting
prompt does not end with a question mark or a period, a question mark is added at last.
@@ -139,19 +139,19 @@ def get_full_prompt(user_prompt, shell):
user_prompt : str
The prompt supplied by the user to be appended to the pre-prompt.
shell : str
The shell information to be inserted in the place of {shell} placeholder in 'prompt.txt'.
The shell information to be inserted in the place of {shell} placeholder in 'yolo.prompt'.
Returns
-------
str
The full prompt, constructed from the template prompt in 'prompt.txt',
The full prompt, constructed from the template prompt in 'yolo.prompt',
user-provided shell info, the OS name, and the user-supplied prompt string.
"""
yolo_path = os.path.abspath(__file__)
prompt_path = os.path.dirname(yolo_path)
## Load the prompt and prep it
prompt_file = os.path.join(prompt_path, "prompt.txt")
prompt_file = os.path.join(prompt_path, "yolo.prompt")
pre_prompt = open(prompt_file,"r").read()
pre_prompt = pre_prompt.replace("{shell}", shell)
pre_prompt = pre_prompt.replace("{os}", get_os_friendly_name())