Renamed prompt.txt to yolo.prompt
This commit is contained in:
@@ -126,10 +126,10 @@ def get_os_friendly_name():
|
|||||||
def get_full_prompt(user_prompt, shell):
|
def get_full_prompt(user_prompt, shell):
|
||||||
"""
|
"""
|
||||||
Constructs a full prompt string by appending the user's prompt to a predefined prompt template
|
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,
|
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
|
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
|
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.
|
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
|
user_prompt : str
|
||||||
The prompt supplied by the user to be appended to the pre-prompt.
|
The prompt supplied by the user to be appended to the pre-prompt.
|
||||||
shell : str
|
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
|
Returns
|
||||||
-------
|
-------
|
||||||
str
|
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.
|
user-provided shell info, the OS name, and the user-supplied prompt string.
|
||||||
"""
|
"""
|
||||||
yolo_path = os.path.abspath(__file__)
|
yolo_path = os.path.abspath(__file__)
|
||||||
prompt_path = os.path.dirname(yolo_path)
|
prompt_path = os.path.dirname(yolo_path)
|
||||||
|
|
||||||
## Load the prompt and prep it
|
## 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 = open(prompt_file,"r").read()
|
||||||
pre_prompt = pre_prompt.replace("{shell}", shell)
|
pre_prompt = pre_prompt.replace("{shell}", shell)
|
||||||
pre_prompt = pre_prompt.replace("{os}", get_os_friendly_name())
|
pre_prompt = pre_prompt.replace("{os}", get_os_friendly_name())
|
||||||
|
|||||||
Reference in New Issue
Block a user