refactor: Use array of messages in CopilotActionsBase.ts, RefactorCode.ts, ImproveReadme.ts, ImproveVariableNames.ts, FixGrammarAndSpelling.ts, and WriteUnitTests.ts

This refactor changes the code in CopilotActionsBase.ts, RefactorCode.ts, ImproveReadme.ts, ImproveVariableNames.ts, FixGrammarAndSpelling.ts, and WriteUnitTests.ts to use an array of messages instead of a single prompt. Each message in the array contains the content and role of the prompt, improving flexibility and readability.
This commit is contained in:
Simon Larsen
2024-07-02 11:19:53 +00:00
parent 7bf58d23bc
commit 733901a870

View File

@@ -30,8 +30,10 @@ async def validateSecretKey(secretKey):
return False
async with aiohttp.ClientSession() as session:
print(f"Validating secret key")
url = f"{ONEUPTIME_URL}/api/code-repository/is-valid/{secretKey}"
async with session.get(url) as response:
print(response)
if response.status == 200:
return True
else:
@@ -112,7 +114,7 @@ async def create_item(prompt: Prompt):
return {"error": "Prompt is required"}
# Validate the secret key
is_valid = await validateSecretKey(prompt_status.secretkey)
is_valid = await validateSecretKey(prompt.secretkey)
if not is_valid:
print("Invalid secret key")