Fixed simple pylint warnings

This commit is contained in:
2024-08-19 19:29:59 +02:00
parent 0a5769f8a0
commit 9610525ecb
+6 -3
View File
@@ -140,7 +140,7 @@ def get_os_friendly_name():
return os_name return os_name
def get_system_prompt(user_prompt, shell): def get_system_prompt(shell):
""" """
Retrieves and constructs a system prompt by replacing placeholders Retrieves and constructs a system prompt by replacing placeholders
in a predefined template with specific values. in a predefined template with specific values.
@@ -186,7 +186,8 @@ def chat_completion(client, query, config):
config (dict): Configuration settings for the chat service, which should include: config (dict): Configuration settings for the chat service, which should include:
- "shell" (str): Type of shell to use in the system prompt. - "shell" (str): Type of shell to use in the system prompt.
- "model" (str): The specific model to use for the chat completion. - "model" (str): The specific model to use for the chat completion.
- "temperature" (float): Sampling temperature to use for the response generation (higher values mean the model will take more risks). - "temperature" (float): Sampling temperature to use for the response generation (higher
values mean the model will take more risks).
- "max_tokens" (int): Maximum number of tokens to generate in the chat response. - "max_tokens" (int): Maximum number of tokens to generate in the chat response.
Returns: Returns:
@@ -199,7 +200,7 @@ def chat_completion(client, query, config):
print ("No user prompt specified.") print ("No user prompt specified.")
sys.exit(-1) sys.exit(-1)
system_prompt = get_system_prompt(query, config["shell"]) system_prompt = get_system_prompt(config["shell"])
# Ensure query is a question # Ensure query is a question
if query[-1:] != "?" and query[-1:] != ".": if query[-1:] != "?" and query[-1:] != ".":
@@ -273,6 +274,7 @@ def missing_posix_display():
return display == b'\n' return display == b'\n'
# TODO: Change the output according the configuration
def prompt_user_input(config, response): def prompt_user_input(config, response):
""" """
Print the command proposal in blue and prompt the user for next action based on the safety Print the command proposal in blue and prompt the user for next action based on the safety
@@ -336,6 +338,7 @@ def evaluate_input(config, user_input, command):
# Unix: /bin/bash /bin/zsh: uses -c both Ubuntu and macOS should work, others might not # Unix: /bin/bash /bin/zsh: uses -c both Ubuntu and macOS should work, others might not
subprocess.run([config["shell"], "-c", command], shell=False, check=True) subprocess.run([config["shell"], "-c", command], shell=False, check=True)
# TODO: change call_open_ai function
if user_input.upper() == "M": if user_input.upper() == "M":
print("Modify prompt: ", end = '') print("Modify prompt: ", end = '')
modded_query = input() modded_query = input()