Spaces:
Sleeping
Sleeping
style(code_review_agent): fix import order, remove trailing whitespace, add blank line
Browse files
app/agents/code_review_agent.py
CHANGED
|
@@ -1,11 +1,12 @@
|
|
| 1 |
-
from app.core.logger import get_logger
|
| 2 |
-
import os
|
| 3 |
import asyncio
|
| 4 |
-
|
|
|
|
| 5 |
from app.core.llm import call_llm_for_json
|
| 6 |
-
from app.core.
|
| 7 |
-
from app.
|
| 8 |
-
from app.models.repository import RepositoryMetadata
|
|
|
|
|
|
|
| 9 |
from app.tools.github_tool import get_changed_files
|
| 10 |
|
| 11 |
logger = get_logger(__name__)
|
|
@@ -40,7 +41,7 @@ async def run(local_path: str, metadata: RepositoryMetadata) -> ReviewSuggestion
|
|
| 40 |
try:
|
| 41 |
with open(file_path, "r", encoding="utf-8", errors="ignore") as f:
|
| 42 |
content = f.read()[:2500]
|
| 43 |
-
content = sanitize_for_prompt(content)
|
| 44 |
source_samples.append(f"### {file_path}\n{content}")
|
| 45 |
except Exception as e: # nosec B110
|
| 46 |
logger.warning("Failed to read file", extra={"file": file_path, "error": str(e)})
|
|
|
|
|
|
|
|
|
|
| 1 |
import asyncio
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
from app.core.llm import call_llm_for_json
|
| 5 |
+
from app.core.logger import get_logger
|
| 6 |
+
from app.core.prompts import AUTO_FIX_PROMPT, CODE_REVIEW_PROMPT
|
| 7 |
+
from app.models.repository import RepositoryMetadata
|
| 8 |
+
from app.models.review import AutoFix, ReviewSuggestions
|
| 9 |
+
from app.tools.file_scanner import get_python_files, sanitize_for_prompt
|
| 10 |
from app.tools.github_tool import get_changed_files
|
| 11 |
|
| 12 |
logger = get_logger(__name__)
|
|
|
|
| 41 |
try:
|
| 42 |
with open(file_path, "r", encoding="utf-8", errors="ignore") as f:
|
| 43 |
content = f.read()[:2500]
|
| 44 |
+
content = sanitize_for_prompt(content)
|
| 45 |
source_samples.append(f"### {file_path}\n{content}")
|
| 46 |
except Exception as e: # nosec B110
|
| 47 |
logger.warning("Failed to read file", extra={"file": file_path, "error": str(e)})
|