Merge pull request #96 from PierreGode/PierreGode-patch-3

Update review.yml
This commit is contained in:
PierreGode 2024-12-10 15:35:58 +01:00 committed by GitHub
commit 501a558c0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -64,13 +64,23 @@ jobs:
patch = fdata.get('patch', '') patch = fdata.get('patch', '')
# Call OpenAI for inline code analysis # Call OpenAI for inline code analysis
issues_prompt = f"""Analyze the following code changes for syntax errors, typos, and critical issues. Provide comments for specific errors with the line number where they occur: issues_prompt = f"""
\n\n{patch}""" Review the following code patch for errors and issues such as:
- Syntax errors
- Logical errors
- Typos or misconfigurations
Provide specific inline comments that include:
- The exact line number
- A clear explanation of the issue
- A suggested fix (if possible)
Patch to analyze:
{patch}
"""
ai_headers = {"Content-Type": "application/json", "Authorization": f"Bearer {openai_key}"} ai_headers = {"Content-Type": "application/json", "Authorization": f"Bearer {openai_key}"}
data_issues = { data_issues = {
"model": "gpt-4o-mini", "model": "gpt-4o-mini",
"messages": [{"role": "user", "content": issues_prompt}], "messages": [{"role": "user", "content": issues_prompt}],
"temperature": 0.7 "temperature": 0.5
} }
issues_response = requests.post("https://api.openai.com/v1/chat/completions", headers=ai_headers, json=data_issues) issues_response = requests.post("https://api.openai.com/v1/chat/completions", headers=ai_headers, json=data_issues)
issues_response.raise_for_status() issues_response.raise_for_status()