wony617
commited on
Commit
Β·
f319272
1
Parent(s):
259de55
Fix log error and remove toctree logging
Browse files- agent/toctree_handler.py +0 -1
- agent/workflow.py +28 -17
agent/toctree_handler.py
CHANGED
@@ -265,7 +265,6 @@ Korean title:"""
|
|
265 |
# Process toctree update with LLM
|
266 |
self.process_pr_commit(filepath)
|
267 |
# Commit toctree as separate commit
|
268 |
-
print("self.updated_ko_toctree:", self.updated_ko_toctree)
|
269 |
if self.updated_ko_toctree:
|
270 |
return self.commit_and_push_toctree(
|
271 |
pr_agent=pr_agent,
|
|
|
265 |
# Process toctree update with LLM
|
266 |
self.process_pr_commit(filepath)
|
267 |
# Commit toctree as separate commit
|
|
|
268 |
if self.updated_ko_toctree:
|
269 |
return self.commit_and_push_toctree(
|
270 |
pr_agent=pr_agent,
|
agent/workflow.py
CHANGED
@@ -12,7 +12,14 @@ from translator.content import (
|
|
12 |
preprocess_content,
|
13 |
)
|
14 |
from translator.retriever import report, get_github_issue_open_pr
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
import json
|
18 |
from logger.github_logger import GitHubLogger
|
@@ -175,21 +182,22 @@ def generate_github_pr(
|
|
175 |
print(f" π Repository: {github_config['owner']}/{github_config['repo_name']}")
|
176 |
|
177 |
agent = GitHubPRAgent()
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
|
|
193 |
# Process toctree update after successful translation PR
|
194 |
toctree_result = None
|
195 |
if en_title:
|
@@ -210,7 +218,10 @@ def generate_github_pr(
|
|
210 |
|
211 |
# Append full result JSON to dedicated GitHub logging repository (always)
|
212 |
try:
|
213 |
-
|
|
|
|
|
|
|
214 |
log_res = GitHubLogger().append_jsonl(log_entry)
|
215 |
print(f"π Log append result: {log_res}")
|
216 |
except Exception as e:
|
|
|
12 |
preprocess_content,
|
13 |
)
|
14 |
from translator.retriever import report, get_github_issue_open_pr
|
15 |
+
# GitHub PR Agent import
|
16 |
+
try:
|
17 |
+
from pr_generator.agent import GitHubPRAgent
|
18 |
+
|
19 |
+
GITHUB_PR_AVAILABLE = True
|
20 |
+
except ImportError as e:
|
21 |
+
print(f"β οΈ GitHub PR Agent is not available: {e}")
|
22 |
+
GITHUB_PR_AVAILABLE = False
|
23 |
|
24 |
import json
|
25 |
from logger.github_logger import GitHubLogger
|
|
|
182 |
print(f" π Repository: {github_config['owner']}/{github_config['repo_name']}")
|
183 |
|
184 |
agent = GitHubPRAgent()
|
185 |
+
result = agent.run_translation_pr_workflow(
|
186 |
+
reference_pr_url=github_config["reference_pr_url"],
|
187 |
+
target_language=target_language,
|
188 |
+
filepath=filepath,
|
189 |
+
translated_doc=translated_content,
|
190 |
+
owner=github_config["owner"],
|
191 |
+
repo_name=github_config["repo_name"],
|
192 |
+
base_branch=github_config.get("base_branch", "main"),
|
193 |
+
)
|
194 |
+
# TEST CODE
|
195 |
+
# result = {
|
196 |
+
# 'status': 'partial_success',
|
197 |
+
# 'branch': 'ko-attention_interface',
|
198 |
+
# 'file_path': 'docs/source/ko/attention_interface.md',
|
199 |
+
# 'message': 'File was saved and commit was successful.\nPR creation failed: ERROR: Existing PR found: https://github.com/Jwaminju/transformers/pull/1', 'error_details': 'ERROR: Existing PR found: https://github.com/Jwaminju/transformers/pull/1'
|
200 |
+
# }
|
201 |
# Process toctree update after successful translation PR
|
202 |
toctree_result = None
|
203 |
if en_title:
|
|
|
218 |
|
219 |
# Append full result JSON to dedicated GitHub logging repository (always)
|
220 |
try:
|
221 |
+
log_data = result.copy()
|
222 |
+
if toctree_result:
|
223 |
+
log_data["toctree_result"] = toctree_result
|
224 |
+
log_entry = json.dumps(log_data, ensure_ascii=False) + "\n"
|
225 |
log_res = GitHubLogger().append_jsonl(log_entry)
|
226 |
print(f"π Log append result: {log_res}")
|
227 |
except Exception as e:
|