Fix typo's (#2735)

Co-authored-by: lengweiping <lengweiping@vinotar.com>
This commit is contained in:
lengweiping1983
2023-04-21 12:09:17 +08:00
committed by GitHub
parent ec27d5729c
commit 63c2182870
3 changed files with 10 additions and 9 deletions

View File

@@ -22,10 +22,10 @@ def analyze_code(code: str) -> list[str]:
improve the code. improve the code.
""" """
function_string = "def analyze_code(code: str) -> List[str]:" function_string = "def analyze_code(code: str) -> list[str]:"
args = [code] args = [code]
description_string = ( description_string = (
"Analyzes the given code and returns a list of suggestions" " for improvements." "Analyzes the given code and returns a list of suggestions for improvements."
) )
return call_ai_function(function_string, args, description_string) return call_ai_function(function_string, args, description_string)

View File

@@ -10,20 +10,21 @@ CFG = Config()
@command( @command(
"clone_repository", "clone_repository",
"Clone Repositoryy", "Clone Repository",
'"repository_url": "<repository_url>", "clone_path": "<clone_path>"', '"repository_url": "<repository_url>", "clone_path": "<clone_path>"',
CFG.github_username and CFG.github_api_key, CFG.github_username and CFG.github_api_key,
"Configure github_username and github_api_key.", "Configure github_username and github_api_key.",
) )
def clone_repository(repository_url: str, clone_path: str) -> str: def clone_repository(repository_url: str, clone_path: str) -> str:
"""Clone a GitHub repository locally """Clone a GitHub repository locally.
Args: Args:
repository_url (str): The URL of the repository to clone repository_url (str): The URL of the repository to clone.
clone_path (str): The path to clone the repository to clone_path (str): The path to clone the repository to.
Returns: Returns:
str: The result of the clone operation""" str: The result of the clone operation.
"""
split_url = repository_url.split("//") split_url = repository_url.split("//")
auth_repo_url = f"//{CFG.github_username}:{CFG.github_api_key}@".join(split_url) auth_repo_url = f"//{CFG.github_username}:{CFG.github_api_key}@".join(split_url)
safe_clone_path = path_in_workspace(clone_path) safe_clone_path = path_in_workspace(clone_path)

View File

@@ -17,14 +17,14 @@ def improve_code(suggestions: list[str], code: str) -> str:
chat completion api call. chat completion api call.
Parameters: Parameters:
suggestions (List): A list of suggestions around what needs to be improved. suggestions (list): A list of suggestions around what needs to be improved.
code (str): Code to be improved. code (str): Code to be improved.
Returns: Returns:
A result string from create chat completion. Improved code in response. A result string from create chat completion. Improved code in response.
""" """
function_string = ( function_string = (
"def generate_improved_code(suggestions: List[str], code: str) -> str:" "def generate_improved_code(suggestions: list[str], code: str) -> str:"
) )
args = [json.dumps(suggestions), code] args = [json.dumps(suggestions), code]
description_string = ( description_string = (