kikocis/auto-code-rover public
Changesets · Branches · Tags · Compare
| Changeset | 0f4e2e4e2ecbb83a8b74e1c24318b654bb5c7edf3d4960f005463465a9c7e20f |
|---|---|
| Author | Zhang Yuntong <ang.unong@gmail.com> · 2024-05-07 13:49 +08:00 |
| Committer | Zhang Yuntong <ang.unong@gmail.com> · 2024-05-07 13:49 +08:00 |
| Parents | 222ea812b676 |
7 files changed
modified app/api/agent_write_patch.py +40 −11
| @@ -4,8 +4,7 @@ | ||
| 4 | 4 | |
| 5 | 5 | import json |
| 6 | 6 | import shutil |
| 7 | -from typing import Callable | |
| 8 | -from collections.abc import Iterable | |
| 7 | +from collections.abc import Callable, Iterable | |
| 9 | 8 | from copy import deepcopy |
| 10 | 9 | from os.path import join as pjoin |
| 11 | 10 | from pathlib import Path |
| @@ -58,7 +57,7 @@ | ||
| 58 | 57 | output_dir: str, |
| 59 | 58 | task: Task, |
| 60 | 59 | retries=3, |
| 61 | - print_callback: Callable[[dict], None] | None = None | |
| 60 | + print_callback: Callable[[dict], None] | None = None, | |
| 62 | 61 | ) -> tuple[str, float, int, int]: |
| 63 | 62 | """ |
| 64 | 63 | Since the agent may not always write an applicable patch, we allow for retries. |
| @@ -99,7 +98,9 @@ | ||
| 99 | 98 | with open(raw_patch_file, "w") as f: |
| 100 | 99 | f.write(res_text) |
| 101 | 100 | |
| 102 | - print_patch_generation(res_text, f"try {i} / {retries}", print_callback=print_callback) | |
| 101 | + print_patch_generation( | |
| 102 | + res_text, f"try {i} / {retries}", print_callback=print_callback | |
| 103 | + ) | |
| 103 | 104 | |
| 104 | 105 | # Attemp to extract a real patch from the raw patch |
| 105 | 106 | diff_file = pjoin(output_dir, f"extracted_patch_{i}.diff") |
| @@ -112,7 +113,11 @@ | ||
| 112 | 113 | |
| 113 | 114 | if extract_status == ExtractStatus.APPLICABLE_PATCH: |
| 114 | 115 | patch_content = Path(diff_file).read_text() |
| 115 | - print_acr(f"```diff\n{patch_content}\n```", "extracted patch", print_callback=print_callback) | |
| 116 | + print_acr( | |
| 117 | + f"```diff\n{patch_content}\n```", | |
| 118 | + "extracted patch", | |
| 119 | + print_callback=print_callback, | |
| 120 | + ) | |
| 116 | 121 | |
| 117 | 122 | # patch generated is applicable and all edits are ok, so we can think about validation |
| 118 | 123 | if globals.enable_validation: |
| @@ -126,7 +131,11 @@ | ||
| 126 | 131 | "Written a patch that resolves the issue. Congratulations!" |
| 127 | 132 | ) |
| 128 | 133 | new_thread.add_user(result_msg) # just for logging |
| 129 | - print_acr(result_msg, f"patch generation try {i} / {retries}", print_callback=print_callback) | |
| 134 | + print_acr( | |
| 135 | + result_msg, | |
| 136 | + f"patch generation try {i} / {retries}", | |
| 137 | + print_callback=print_callback, | |
| 138 | + ) | |
| 130 | 139 | can_stop = True |
| 131 | 140 | # the following two branches cannot be swapped, because |
| 132 | 141 | # --enable-perfect-angelic is meant to override --enable-angelic |
| @@ -147,7 +156,11 @@ | ||
| 147 | 156 | |
| 148 | 157 | result_msg = f"{msg}\n{angelic_msg}" |
| 149 | 158 | new_thread.add_user(result_msg) |
| 150 | - print_acr(result_msg, f"patch generation try {i} / {retries}", print_callback=print_callback) | |
| 159 | + print_acr( | |
| 160 | + result_msg, | |
| 161 | + f"patch generation try {i} / {retries}", | |
| 162 | + print_callback=print_callback, | |
| 163 | + ) | |
| 151 | 164 | continue |
| 152 | 165 | elif globals.enable_angelic: |
| 153 | 166 | raise NotImplementedError( |
| @@ -157,7 +170,11 @@ | ||
| 157 | 170 | result_msg = f"Written an applicable patch, but it did not resolve the issue. {err_message} " |
| 158 | 171 | result_msg += " Please try again." |
| 159 | 172 | new_thread.add_user(result_msg) |
| 160 | - print_acr(result_msg, f"patch generation try {i} / {retries}", print_callback=print_callback) | |
| 173 | + print_acr( | |
| 174 | + result_msg, | |
| 175 | + f"patch generation try {i} / {retries}", | |
| 176 | + print_callback=print_callback, | |
| 177 | + ) | |
| 161 | 178 | continue |
| 162 | 179 | elif globals.enable_perfect_angelic: |
| 163 | 180 | if not isinstance(task, SweTask): |
| @@ -176,14 +193,22 @@ | ||
| 176 | 193 | result_msg = msg |
| 177 | 194 | |
| 178 | 195 | new_thread.add_user(result_msg) |
| 179 | - print_acr(result_msg, f"patch generation try {i} / {retries}", print_callback=print_callback) | |
| 196 | + print_acr( | |
| 197 | + result_msg, | |
| 198 | + f"patch generation try {i} / {retries}", | |
| 199 | + print_callback=print_callback, | |
| 200 | + ) | |
| 180 | 201 | continue |
| 181 | 202 | elif globals.enable_angelic: |
| 182 | 203 | raise NotImplementedError("Angelic debugging has not been integrated") |
| 183 | 204 | else: |
| 184 | 205 | result_msg = "Extracted a patch. Since validation is disabled, you should validation the patch later on. Ending the workflow." |
| 185 | 206 | new_thread.add_user(result_msg) # just for logging |
| 186 | - print_acr(result_msg, f"patch generation try {i} / {retries}", print_callback=print_callback) | |
| 207 | + print_acr( | |
| 208 | + result_msg, | |
| 209 | + f"patch generation try {i} / {retries}", | |
| 210 | + print_callback=print_callback, | |
| 211 | + ) | |
| 187 | 212 | can_stop = True |
| 188 | 213 | |
| 189 | 214 | else: |
| @@ -194,7 +219,11 @@ | ||
| 194 | 219 | + " Please try again." |
| 195 | 220 | ) |
| 196 | 221 | new_thread.add_user(new_prompt) |
| 197 | - print_acr(new_prompt, f"patch generation try {i} / {retries}", print_callback=print_callback) | |
| 222 | + print_acr( | |
| 223 | + new_prompt, | |
| 224 | + f"patch generation try {i} / {retries}", | |
| 225 | + print_callback=print_callback, | |
| 226 | + ) | |
| 198 | 227 | result_msg = "Failed to write a valid patch." |
| 199 | 228 | |
| 200 | 229 | return result_msg |
modified app/api/manage.py +8 −7
| @@ -1,8 +1,7 @@ | ||
| 1 | 1 | import json |
| 2 | 2 | import os |
| 3 | 3 | import shutil |
| 4 | -from typing import Callable | |
| 5 | -from collections.abc import Mapping | |
| 4 | +from collections.abc import Callable, Mapping | |
| 6 | 5 | from copy import deepcopy |
| 7 | 6 | from os.path import join as pjoin |
| 8 | 7 | from pathlib import Path |
| @@ -178,9 +177,10 @@ | ||
| 178 | 177 | return all_tool_objs |
| 179 | 178 | |
| 180 | 179 | def dispatch_intent( |
| 181 | - self, intent: FunctionCallIntent, | |
| 180 | + self, | |
| 181 | + intent: FunctionCallIntent, | |
| 182 | 182 | message_thread: MessageThread, |
| 183 | - print_callback:Callable[[dict], None] | None = None | |
| 183 | + print_callback: Callable[[dict], None] | None = None, | |
| 184 | 184 | ) -> tuple[str, str, bool]: |
| 185 | 185 | """Dispatch a function call intent to actually perform its action. |
| 186 | 186 | |
| @@ -432,9 +432,10 @@ | ||
| 432 | 432 | """ |
| 433 | 433 | return self.search_manager.search_code_in_file(code_str, file_name) |
| 434 | 434 | |
| 435 | - def write_patch(self, | |
| 435 | + def write_patch( | |
| 436 | + self, | |
| 436 | 437 | message_thread: MessageThread, |
| 437 | - print_callback:Callable[[dict], None] | None = None | |
| 438 | + print_callback: Callable[[dict], None] | None = None, | |
| 438 | 439 | ) -> tuple[str, str, bool]: |
| 439 | 440 | """Based on the current context, ask another agent to write a patch. |
| 440 | 441 | |
| @@ -447,7 +448,7 @@ | ||
| 447 | 448 | self.output_dir, |
| 448 | 449 | self.task, |
| 449 | 450 | # self.validator, |
| 450 | - print_callback=print_callback | |
| 451 | + print_callback=print_callback, | |
| 451 | 452 | ) |
| 452 | 453 | summary = "The tool returned the patch written by another agent." |
| 453 | 454 | # The return status of write_patch does not really matter, so we just use True here |
modified app/inference.py +50 −14
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | import inspect |
| 2 | 2 | import json |
| 3 | 3 | import re |
| 4 | -from typing import Callable | |
| 4 | +from collections.abc import Callable | |
| 5 | 5 | from os.path import join as pjoin |
| 6 | 6 | from pathlib import Path |
| 7 | 7 | |
| @@ -73,7 +73,7 @@ | ||
| 73 | 73 | msg_thread: MessageThread, |
| 74 | 74 | api_manager: ProjectApiManager, |
| 75 | 75 | start_round_no: int = 0, |
| 76 | - print_callback: Callable[[dict], None] | None = None | |
| 76 | + print_callback: Callable[[dict], None] | None = None, | |
| 77 | 77 | ) -> bool: |
| 78 | 78 | """ |
| 79 | 79 | This version uses json data to process API calls, instead of using the OpenAI function calling. |
| @@ -102,7 +102,11 @@ | ||
| 102 | 102 | |
| 103 | 103 | print_banner(f"CONTEXT RETRIEVAL ROUND {round_no}") |
| 104 | 104 | |
| 105 | - print_acr(prompt, f"context retrieval round {start_round_no}", print_callback=print_callback) | |
| 105 | + print_acr( | |
| 106 | + prompt, | |
| 107 | + f"context retrieval round {start_round_no}", | |
| 108 | + print_callback=print_callback, | |
| 109 | + ) | |
| 106 | 110 | |
| 107 | 111 | res_text, *_ = common.SELECTED_MODEL.call(msg_thread.to_msg()) |
| 108 | 112 | msg_thread.add_model(res_text, tools=[]) |
| @@ -117,7 +121,11 @@ | ||
| 117 | 121 | if selected_apis is None: |
| 118 | 122 | msg = "The search API calls seem not valid. Please check the arguments you give carefully and try again." |
| 119 | 123 | msg_thread.add_user(msg) |
| 120 | - print_acr(msg, f"context retrieval round {round_no}", print_callback=print_callback) | |
| 124 | + print_acr( | |
| 125 | + msg, | |
| 126 | + f"context retrieval round {round_no}", | |
| 127 | + print_callback=print_callback, | |
| 128 | + ) | |
| 121 | 129 | continue |
| 122 | 130 | |
| 123 | 131 | selected_apis_json = json.loads(selected_apis) |
| @@ -137,7 +145,11 @@ | ||
| 137 | 145 | s = ", ".join(f"{k}: `{v}`" for k, v in location.items()) |
| 138 | 146 | formatted.extend([f"\n- {s}"]) |
| 139 | 147 | |
| 140 | - print_acr("\n".join(formatted), "Agent-selected API calls", print_callback=print_callback) | |
| 148 | + print_acr( | |
| 149 | + "\n".join(formatted), | |
| 150 | + "Agent-selected API calls", | |
| 151 | + print_callback=print_callback, | |
| 152 | + ) | |
| 141 | 153 | |
| 142 | 154 | # collected enough information to write patch |
| 143 | 155 | if buggy_locations and (not json_api_calls): |
| @@ -157,12 +169,20 @@ | ||
| 157 | 169 | |
| 158 | 170 | print_banner("PATCH GENERATION") |
| 159 | 171 | logger.debug("Gathered enough information. Invoking write_patch.") |
| 160 | - print_acr(collated_tool_response, "patch generation round 1", print_callback=print_callback) | |
| 172 | + print_acr( | |
| 173 | + collated_tool_response, | |
| 174 | + "patch generation round 1", | |
| 175 | + print_callback=print_callback, | |
| 176 | + ) | |
| 161 | 177 | break |
| 162 | 178 | |
| 163 | 179 | msg = "The buggy locations is not precise. You may need to check whether the arguments are correct and search more information." |
| 164 | 180 | msg_thread.add_user(msg) |
| 165 | - print_acr(msg, f"context retrieval round {round_no}", print_callback=print_callback) | |
| 181 | + print_acr( | |
| 182 | + msg, | |
| 183 | + f"context retrieval round {round_no}", | |
| 184 | + print_callback=print_callback, | |
| 185 | + ) | |
| 166 | 186 | continue |
| 167 | 187 | |
| 168 | 188 | # prepare response from tools |
| @@ -186,11 +206,17 @@ | ||
| 186 | 206 | collated_tool_response += tool_output + "\n\n" |
| 187 | 207 | |
| 188 | 208 | msg_thread.add_user(collated_tool_response) |
| 189 | - print_acr(collated_tool_response, f"context retrieval round {round_no}", print_callback=print_callback) | |
| 209 | + print_acr( | |
| 210 | + collated_tool_response, | |
| 211 | + f"context retrieval round {round_no}", | |
| 212 | + print_callback=print_callback, | |
| 213 | + ) | |
| 190 | 214 | |
| 191 | 215 | msg = "Let's analyze collected context first" |
| 192 | 216 | msg_thread.add_user(msg) |
| 193 | - print_acr(msg, f"context retrieval round {round_no}", print_callback=print_callback) | |
| 217 | + print_acr( | |
| 218 | + msg, f"context retrieval round {round_no}", print_callback=print_callback | |
| 219 | + ) | |
| 194 | 220 | |
| 195 | 221 | res_text, *_ = common.SELECTED_MODEL.call(msg_thread.to_msg()) |
| 196 | 222 | msg_thread.add_model(res_text, tools=[]) |
| @@ -206,7 +232,11 @@ | ||
| 206 | 232 | # llama models tend to always output search APIs and buggy locations. |
| 207 | 233 | msg += "\n\nNOTE: If you have already identified the bug locations, do not make any search API calls." |
| 208 | 234 | msg_thread.add_user(msg) |
| 209 | - print_acr(msg, f"context retrieval round {round_no}", print_callback=print_callback) | |
| 235 | + print_acr( | |
| 236 | + msg, | |
| 237 | + f"context retrieval round {round_no}", | |
| 238 | + print_callback=print_callback, | |
| 239 | + ) | |
| 210 | 240 | else: |
| 211 | 241 | logger.info("Too many rounds. Try writing patch anyway.") |
| 212 | 242 | |
| @@ -215,7 +245,9 @@ | ||
| 215 | 245 | api_manager.start_new_tool_call_layer() |
| 216 | 246 | |
| 217 | 247 | write_patch_intent = FunctionCallIntent("write_patch", {}, None) |
| 218 | - api_manager.dispatch_intent(write_patch_intent, msg_thread, print_callback=print_callback) | |
| 248 | + api_manager.dispatch_intent( | |
| 249 | + write_patch_intent, msg_thread, print_callback=print_callback | |
| 250 | + ) | |
| 219 | 251 | |
| 220 | 252 | conversation_file = pjoin(output_dir, f"conversation_round_{round_no}.json") |
| 221 | 253 | msg_thread.save_to_file(conversation_file) |
| @@ -383,8 +415,10 @@ | ||
| 383 | 415 | |
| 384 | 416 | |
| 385 | 417 | def run_one_task( |
| 386 | - output_dir: str, api_manager: ProjectApiManager, problem_stmt: str, | |
| 387 | - print_callback: Callable[[dict], None] | None = None | |
| 418 | + output_dir: str, | |
| 419 | + api_manager: ProjectApiManager, | |
| 420 | + problem_stmt: str, | |
| 421 | + print_callback: Callable[[dict], None] | None = None, | |
| 388 | 422 | ) -> bool: |
| 389 | 423 | """ |
| 390 | 424 | Main entry point to run inference on one task. |
| @@ -415,7 +449,9 @@ | ||
| 415 | 449 | msg_thread.add_user(localization_prompt) |
| 416 | 450 | |
| 417 | 451 | if globals.enable_layered: |
| 418 | - return start_conversation_round_stratified(output_dir, msg_thread, api_manager, print_callback=print_callback) | |
| 452 | + return start_conversation_round_stratified( | |
| 453 | + output_dir, msg_thread, api_manager, print_callback=print_callback | |
| 454 | + ) | |
| 419 | 455 | else: |
| 420 | 456 | return start_conversation_round_state_machine( |
| 421 | 457 | output_dir, msg_thread, api_manager |
modified app/log.py +30 −21
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | import time |
| 2 | +from collections.abc import Callable | |
| 2 | 3 | from os import get_terminal_size |
| 3 | -from typing import Callable | |
| 4 | 4 | |
| 5 | 5 | from loguru import logger |
| 6 | 6 | from rich.console import Console |
| @@ -57,7 +57,10 @@ | ||
| 57 | 57 | content = content.replace(key, value) |
| 58 | 58 | return content |
| 59 | 59 | |
| 60 | -def print_acr(msg: str, desc="", print_callback: Callable[[dict], None] | None = None) -> None: | |
| 60 | + | |
| 61 | +def print_acr( | |
| 62 | + msg: str, desc="", print_callback: Callable[[dict], None] | None = None | |
| 63 | +) -> None: | |
| 61 | 64 | if not print_stdout: |
| 62 | 65 | return |
| 63 | 66 | |
| @@ -80,14 +83,14 @@ | ||
| 80 | 83 | console.print(panel) |
| 81 | 84 | |
| 82 | 85 | if print_callback: |
| 83 | - print_callback({ | |
| 84 | - 'title': f"{name} ({desc})", | |
| 85 | - 'message': msg, | |
| 86 | - 'category': 'auto_code_rover' | |
| 87 | - }) | |
| 86 | + print_callback( | |
| 87 | + {"title": f"{name} ({desc})", "message": msg, "category": "auto_code_rover"} | |
| 88 | + ) | |
| 88 | 89 | |
| 89 | 90 | |
| 90 | -def print_retrieval(msg: str, desc="", print_callback: Callable[[dict], None] | None = None) -> None: | |
| 91 | +def print_retrieval( | |
| 92 | + msg: str, desc="", print_callback: Callable[[dict], None] | None = None | |
| 93 | +) -> None: | |
| 91 | 94 | if not print_stdout: |
| 92 | 95 | return |
| 93 | 96 | |
| @@ -109,14 +112,18 @@ | ||
| 109 | 112 | ) |
| 110 | 113 | console.print(panel) |
| 111 | 114 | if print_callback: |
| 112 | - print_callback({ | |
| 113 | - 'title': f"{name} ({desc})", | |
| 114 | - 'message': msg, | |
| 115 | - 'category': 'context_retrieval_agent' | |
| 116 | - }) | |
| 117 | - | |
| 118 | - | |
| 119 | -def print_patch_generation(msg: str, desc="", print_callback: Callable[[dict], None] | None = None) -> None: | |
| 115 | + print_callback( | |
| 116 | + { | |
| 117 | + "title": f"{name} ({desc})", | |
| 118 | + "message": msg, | |
| 119 | + "category": "context_retrieval_agent", | |
| 120 | + } | |
| 121 | + ) | |
| 122 | + | |
| 123 | + | |
| 124 | +def print_patch_generation( | |
| 125 | + msg: str, desc="", print_callback: Callable[[dict], None] | None = None | |
| 126 | +) -> None: | |
| 120 | 127 | if not print_stdout: |
| 121 | 128 | return |
| 122 | 129 | |
| @@ -138,11 +145,13 @@ | ||
| 138 | 145 | ) |
| 139 | 146 | console.print(panel) |
| 140 | 147 | if print_callback: |
| 141 | - print_callback({ | |
| 142 | - 'title': f"{name} ({desc})", | |
| 143 | - 'message': msg, | |
| 144 | - 'category': 'patch_generation' | |
| 145 | - }) | |
| 148 | + print_callback( | |
| 149 | + { | |
| 150 | + "title": f"{name} ({desc})", | |
| 151 | + "message": msg, | |
| 152 | + "category": "patch_generation", | |
| 153 | + } | |
| 154 | + ) | |
| 146 | 155 | |
| 147 | 156 | |
| 148 | 157 | def print_issue(content: str) -> None: |
modified app/main.py +19 −9
| @@ -4,8 +4,7 @@ | ||
| 4 | 4 | |
| 5 | 5 | import json |
| 6 | 6 | from argparse import ArgumentParser |
| 7 | -from typing import Callable | |
| 8 | -from collections.abc import Mapping, Sequence | |
| 7 | +from collections.abc import Callable, Mapping, Sequence | |
| 9 | 8 | from concurrent.futures import ProcessPoolExecutor |
| 10 | 9 | from datetime import datetime |
| 11 | 10 | from itertools import chain |
| @@ -18,7 +17,6 @@ | ||
| 18 | 17 | from app import utils as apputils |
| 19 | 18 | from app.api.manage import ProjectApiManager |
| 20 | 19 | from app.model import common |
| 21 | -from app.model.register import register_all_models | |
| 22 | 20 | from app.post_process import ( |
| 23 | 21 | extract_organize_and_form_input, |
| 24 | 22 | get_final_patch_path, |
| @@ -28,7 +26,10 @@ | ||
| 28 | 26 | from app.raw_tasks import RawGithubTask, RawLocalTask, RawSweTask, RawTask |
| 29 | 27 | from app.task import Task |
| 30 | 28 | |
| 31 | -def get_args(from_command_line_str: str = None, subparser_dest_attr_name: str = "command"): | |
| 29 | + | |
| 30 | +def get_args( | |
| 31 | + from_command_line_str: str = None, subparser_dest_attr_name: str = "command" | |
| 32 | +): | |
| 32 | 33 | parser = ArgumentParser() |
| 33 | 34 | subparsers = parser.add_subparsers(dest=subparser_dest_attr_name) |
| 34 | 35 | |
| @@ -64,6 +65,7 @@ | ||
| 64 | 65 | return parser.parse_args() |
| 65 | 66 | return parser.parse_args(from_command_line_str.split()) |
| 66 | 67 | |
| 68 | + | |
| 67 | 69 | def main(args, subparser_dest_attr_name: str = "command"): |
| 68 | 70 | |
| 69 | 71 | ## common options |
| @@ -414,7 +416,9 @@ | ||
| 414 | 416 | executor.submit(run_raw_task, task) |
| 415 | 417 | |
| 416 | 418 | |
| 417 | -def run_raw_task(task: RawTask, print_callback: Callable[[dict], None] | None = None) -> bool: | |
| 419 | +def run_raw_task( | |
| 420 | + task: RawTask, print_callback: Callable[[dict], None] | None = None | |
| 421 | +) -> bool: | |
| 418 | 422 | """ |
| 419 | 423 | High-level entry for running one task. |
| 420 | 424 | |
| @@ -467,7 +471,11 @@ | ||
| 467 | 471 | return run_ok |
| 468 | 472 | |
| 469 | 473 | |
| 470 | -def do_inference(python_task: Task, task_output_dir: str, print_callback: Callable[[dict], None] | None = None) -> bool: | |
| 474 | +def do_inference( | |
| 475 | + python_task: Task, | |
| 476 | + task_output_dir: str, | |
| 477 | + print_callback: Callable[[dict], None] | None = None, | |
| 478 | +) -> bool: | |
| 471 | 479 | |
| 472 | 480 | apputils.create_dir_if_not_exists(task_output_dir) |
| 473 | 481 | |
| @@ -489,8 +497,10 @@ | ||
| 489 | 497 | _, _, run_ok = api_manager.fault_localization() |
| 490 | 498 | else: |
| 491 | 499 | run_ok = inference.run_one_task( |
| 492 | - api_manager.output_dir, api_manager, python_task.get_issue_statement(), | |
| 493 | - print_callback | |
| 500 | + api_manager.output_dir, | |
| 501 | + api_manager, | |
| 502 | + python_task.get_issue_statement(), | |
| 503 | + print_callback, | |
| 494 | 504 | ) |
| 495 | 505 | |
| 496 | 506 | api_manager.dump_tool_call_sequence_to_file() |
| @@ -526,4 +536,4 @@ | ||
| 526 | 536 | if __name__ == "__main__": |
| 527 | 537 | logger.remove() |
| 528 | 538 | args = get_args() |
| 529 | - main(args) | |
| No newline at the end of the file | ||
| 539 | + main(args) |
modified demo_vis/main.py +43 −36
| @@ -1,28 +1,34 @@ | ||
| 1 | -import os, time, sys, datetime | |
| 2 | -import threading | |
| 1 | +import datetime | |
| 3 | 2 | import json |
| 3 | +import os | |
| 4 | +import sys | |
| 5 | +import threading | |
| 6 | +import time | |
| 4 | 7 | from queue import Queue |
| 5 | -from flask import Flask, Response, request, jsonify | |
| 6 | -from flask_cors import CORS, cross_origin | |
| 7 | 8 | |
| 8 | -sys.path.append('/opt/auto-code-rover/') | |
| 9 | -from app.raw_tasks import RawGithubTask | |
| 10 | -from app.model import common | |
| 11 | -from app.model.register import register_all_models | |
| 12 | -from app.main import get_args, run_raw_task | |
| 13 | -from app import globals, log | |
| 9 | +from flask import Flask, Response, jsonify, request | |
| 10 | +from flask_cors import cross_origin | |
| 14 | 11 | |
| 12 | +sys.path.append("/opt/auto-code-rover/") | |
| 15 | 13 | from test_data import RawGithubTask_for_debug, test_generate_data |
| 16 | 14 | |
| 15 | +from app import globals, log | |
| 16 | +from app.main import get_args, run_raw_task | |
| 17 | +from app.model import common | |
| 18 | +from app.model.register import register_all_models | |
| 19 | +from app.raw_tasks import RawGithubTask | |
| 20 | + | |
| 17 | 21 | app = Flask(__name__) |
| 18 | 22 | |
| 23 | + | |
| 19 | 24 | def initialize_thread_cost(): |
| 20 | 25 | common.thread_cost.process_cost = 0.0 |
| 21 | 26 | common.thread_cost.process_input_tokens = 0 |
| 22 | 27 | common.thread_cost.process_output_tokens = 0 |
| 23 | 28 | |
| 24 | -@app.route('/api/run_github_issue', methods=['POST']) | |
| 25 | -@cross_origin(origin='http://localhost:3000') # nextjs cross origin | |
| 29 | + | |
| 30 | +@app.route("/api/run_github_issue", methods=["POST"]) | |
| 31 | +@cross_origin(origin="http://localhost:3000") # nextjs cross origin | |
| 26 | 32 | def run_github_issue(): |
| 27 | 33 | |
| 28 | 34 | if not request.is_json: |
| @@ -30,16 +36,17 @@ | ||
| 30 | 36 | register_all_models() |
| 31 | 37 | |
| 32 | 38 | data = request.get_json() |
| 33 | - args = get_args('''github-issue --output-dir output --setup-dir setup --model gpt-4-0125-preview --model-temperature 0.2''') | |
| 34 | - args.task_id = datetime.datetime.now().strftime('%Y-%m-%d_%H:%M:%S') | |
| 35 | - args.clone_link = data['repository_link'] | |
| 36 | - args.commit_hash = data['commit_hash'] | |
| 37 | - args.issue_link = data['issue_link'] | |
| 39 | + args = get_args( | |
| 40 | + """github-issue --output-dir output --setup-dir setup --model gpt-4-0125-preview --model-temperature 0.2""" | |
| 41 | + ) | |
| 42 | + args.task_id = datetime.datetime.now().strftime("%Y-%m-%d_%H:%M:%S") | |
| 43 | + args.clone_link = data["repository_link"] | |
| 44 | + args.commit_hash = data["commit_hash"] | |
| 45 | + args.issue_link = data["issue_link"] | |
| 38 | 46 | |
| 39 | 47 | globals.output_dir = args.output_dir |
| 40 | 48 | if globals.output_dir is not None: |
| 41 | 49 | globals.output_dir = os.path.abspath(globals.output_dir) |
| 42 | - num_processes: int = int(args.num_processes) | |
| 43 | 50 | # set whether brief or verbose log |
| 44 | 51 | print_stdout: bool = not args.no_print |
| 45 | 52 | log.print_stdout = print_stdout |
| @@ -73,33 +80,31 @@ | ||
| 73 | 80 | args.issue_link, |
| 74 | 81 | os.path.abspath(args.setup_dir), |
| 75 | 82 | ) |
| 76 | - except RuntimeError as e: | |
| 77 | - error_form = { | |
| 78 | - 'message': str(e) | |
| 79 | - } | |
| 83 | + except RuntimeError as e: | |
| 84 | + error_form = {"message": str(e)} | |
| 80 | 85 | return jsonify(error_form), 400 |
| 81 | 86 | |
| 82 | 87 | def stream_print(): |
| 83 | 88 | print_queue = Queue() |
| 84 | - | |
| 89 | + | |
| 85 | 90 | def callback(data: dict): |
| 86 | - print_queue.put(f'{json.dumps(data)}</////json_end>') | |
| 87 | - | |
| 91 | + print_queue.put(f"{json.dumps(data)}</////json_end>") | |
| 92 | + | |
| 88 | 93 | def run(task, callback): |
| 89 | 94 | initialize_thread_cost() |
| 90 | - callback({ | |
| 91 | - 'category': 'issue_info', | |
| 92 | - 'problem_statement': task.problem_statement | |
| 93 | - }) | |
| 95 | + callback( | |
| 96 | + {"category": "issue_info", "problem_statement": task.problem_statement} | |
| 97 | + ) | |
| 94 | 98 | run_raw_task(task, callback) |
| 95 | 99 | |
| 96 | 100 | thread = threading.Thread(target=run, args=(task, callback)) |
| 97 | 101 | if app.debug: |
| 98 | - callback({ | |
| 99 | - 'category': 'issue_info', | |
| 100 | - 'problem_statement': task.problem_statement | |
| 101 | - }) | |
| 102 | - thread = threading.Thread(target=test_generate_data, args=(callback,)) # debug | |
| 102 | + callback( | |
| 103 | + {"category": "issue_info", "problem_statement": task.problem_statement} | |
| 104 | + ) | |
| 105 | + thread = threading.Thread( | |
| 106 | + target=test_generate_data, args=(callback,) | |
| 107 | + ) # debug | |
| 103 | 108 | time.sleep(1) |
| 104 | 109 | else: |
| 105 | 110 | thread = threading.Thread(target=run, args=(task, callback)) |
| @@ -110,8 +115,10 @@ | ||
| 110 | 115 | yield print_queue.get() |
| 111 | 116 | else: |
| 112 | 117 | time.sleep(0.1) |
| 113 | - return Response(stream_print(), mimetype='text/event-stream') | |
| 118 | + | |
| 119 | + return Response(stream_print(), mimetype="text/event-stream") | |
| 120 | + | |
| 114 | 121 | |
| 115 | 122 | # http://localhost:5000/ |
| 116 | 123 | if __name__ == "__main__": |
| 117 | - app.run(host='0.0.0.0', port=5000, debug=False) | |
| 124 | + app.run(host="0.0.0.0", port=5000, debug=False) |
modified demo_vis/test_data.py +112 −112
| @@ -1,20 +1,24 @@ | ||
| 1 | -import os, time | |
| 1 | +import json | |
| 2 | +import os | |
| 3 | +import time | |
| 2 | 4 | from os.path import join as pjoin |
| 3 | 5 | from pathlib import Path |
| 4 | -from app.log import log_and_print | |
| 5 | -from app.raw_tasks import RawTask, PlainTask | |
| 6 | + | |
| 6 | 7 | from app import utils as app_utils |
| 8 | +from app.log import log_and_print | |
| 9 | +from app.raw_tasks import PlainTask, RawTask | |
| 10 | + | |
| 7 | 11 | |
| 8 | 12 | class RawGithubTask_for_debug(RawTask): |
| 9 | 13 | """ |
| 10 | - Encapsulate everything required to run ACR on a fresh issue from the internet. | |
| 11 | - | |
| 12 | - For debug / dev: github limits the calling times of api. Therefore when | |
| 13 | - debuging, use the hardcode task: | |
| 14 | + Encapsulate everything required to run ACR on a fresh issue from the internet. | |
| 15 | + | |
| 16 | + For debug / dev: github limits the calling times of api. Therefore when | |
| 17 | + debuging, use the hardcode task: | |
| 14 | 18 | self.clone_link = 'https://github.com/langchain-ai/langchain.git' |
| 15 | 19 | self.commit_hash = 'cb6e5e5' |
| 16 | 20 | self.issue_link = 'https://github.com/langchain-ai/langchain/issues/20453' |
| 17 | - self.problem_statement: refer to the implementation of fetch_github_issue function | |
| 21 | + self.problem_statement: refer to the implementation of fetch_github_issue function | |
| 18 | 22 | """ |
| 19 | 23 | |
| 20 | 24 | def __init__( |
| @@ -23,12 +27,12 @@ | ||
| 23 | 27 | clone_link: str, |
| 24 | 28 | commit_hash: str, |
| 25 | 29 | issue_link: str, |
| 26 | - setup_dir: str | |
| 30 | + setup_dir: str, | |
| 27 | 31 | ): |
| 28 | 32 | self._task_id = task_id |
| 29 | - self.clone_link = 'https://github.com/langchain-ai/langchain.git' | |
| 30 | - self.commit_hash = 'cb6e5e5' | |
| 31 | - self.issue_link = 'https://github.com/langchain-ai/langchain/issues/20453' | |
| 33 | + self.clone_link = "https://github.com/langchain-ai/langchain.git" | |
| 34 | + self.commit_hash = "cb6e5e5" | |
| 35 | + self.issue_link = "https://github.com/langchain-ai/langchain/issues/20453" | |
| 32 | 36 | self.setup_dir = setup_dir |
| 33 | 37 | self.clone_path = pjoin(self.setup_dir, self.task_id) |
| 34 | 38 | self.problem_statement, self.created_at = self.fetch_issue() |
| @@ -41,11 +45,7 @@ | ||
| 41 | 45 | def clone_repo(self): |
| 42 | 46 | clone_path = Path(self.clone_path) |
| 43 | 47 | if os.path.exists(clone_path): |
| 44 | - return # Dev/Debug mode | |
| 45 | - log_and_print( | |
| 46 | - f"Path {clone_path} already exists. Removing it to get a fresh clone." | |
| 47 | - ) | |
| 48 | - shutil.rmtree(clone_path) | |
| 48 | + return # Dev/Debug mode | |
| 49 | 49 | app_utils.clone_repo(self.clone_link, str(clone_path.parent), clone_path.name) |
| 50 | 50 | log_and_print(f"Cloned source code to {clone_path}.") |
| 51 | 51 | |
| @@ -88,8 +88,8 @@ | ||
| 88 | 88 | def fetch_github_issue(cls, issue_url: str) -> tuple[str, str, str]: |
| 89 | 89 | """Extract owner, repo, and issue number from the URL""" |
| 90 | 90 | |
| 91 | - title = '''`PaiEasChatEndpoint._call_eas` should return `bytes` type instead of `str` type''' | |
| 92 | - body = ''' | |
| 91 | + title = """`PaiEasChatEndpoint._call_eas` should return `bytes` type instead of `str` type""" | |
| 92 | + body = """ | |
| 93 | 93 | ### Checked other resources |
| 94 | 94 | |
| 95 | 95 | - [X] I added a very descriptive title to this issue. |
| @@ -139,7 +139,7 @@ | ||
| 139 | 139 | ------------------ |
| 140 | 140 | > OS: Linux |
| 141 | 141 | > OS Version: #190-Ubuntu SMP Fri Feb 2 23:24:22 UTC 2024 |
| 142 | -> Python Version: 3.9.18 (main, Feb 13 2024, 14:37:08) | |
| 142 | +> Python Version: 3.9.18 (main, Feb 13 2024, 14:37:08) | |
| 143 | 143 | [GCC 9.4.0] |
| 144 | 144 | |
| 145 | 145 | Package Information |
| @@ -156,8 +156,8 @@ | ||
| 156 | 156 | |
| 157 | 157 | > langgraph |
| 158 | 158 | > langserve |
| 159 | -''' | |
| 160 | - created_at = '''2024-04-15T07:47:06Z''' | |
| 159 | +""" | |
| 160 | + created_at = """2024-04-15T07:47:06Z""" | |
| 161 | 161 | |
| 162 | 162 | return title, body, created_at |
| 163 | 163 | |
| @@ -170,10 +170,10 @@ | ||
| 170 | 170 | |
| 171 | 171 | |
| 172 | 172 | test_data = [ |
| 173 | - { | |
| 174 | - 'title': 'AutoCodeRover (context retrieval round 0)', | |
| 175 | - 'category': 'auto_code_rover', | |
| 176 | - 'message': '''Based on the files, classes, methods, and code statements from the issue related to the bug, you can use the following search APIs to get more context of the project. | |
| 173 | + { | |
| 174 | + "title": "AutoCodeRover (context retrieval round 0)", | |
| 175 | + "category": "auto_code_rover", | |
| 176 | + "message": """Based on the files, classes, methods, and code statements from the issue related to the bug, you can use the following search APIs to get more context of the project. | |
| 177 | 177 | - search_class(class_name: str): Search for a class in the codebase |
| 178 | 178 | - search_method_in_file(method_name: str, file_path: str): Search for a method in a given file |
| 179 | 179 | - search_method_in_class(method_name: str, class_name: str): Search for a method in a given class |
| @@ -183,31 +183,31 @@ | ||
| 183 | 183 | |
| 184 | 184 | Note that you can use multiple search APIs in one round. |
| 185 | 185 | |
| 186 | -Now analyze the issue and select necessary APIs to get more context of the project. Each API call must have concrete arguments as inputs.''' | |
| 187 | - }, | |
| 188 | - { | |
| 189 | - 'title': 'Context Retrieval Agent (round 0)', | |
| 190 | - 'category': 'context_retrieval_agent', | |
| 191 | - 'message': '''I will start by searching for the `PaiEasChatEndpoint` class to understand its structure and methods. Then, I will search for the `_call_eas` method within this class to investigate its implementation. | |
| 186 | +Now analyze the issue and select necessary APIs to get more context of the project. Each API call must have concrete arguments as inputs.""", | |
| 187 | + }, | |
| 188 | + { | |
| 189 | + "title": "Context Retrieval Agent (round 0)", | |
| 190 | + "category": "context_retrieval_agent", | |
| 191 | + "message": """I will start by searching for the `PaiEasChatEndpoint` class to understand its structure and methods. Then, I will search for the `_call_eas` method within this class to investigate its implementation. | |
| 192 | 192 | |
| 193 | 193 | 1. `search_class("PaiEasChatEndpoint")` |
| 194 | -2. `search_method_in_class("_call_eas", "PaiEasChatEndpoint")`''' | |
| 195 | - }, | |
| 196 | - { | |
| 197 | - 'title': 'AutoCodeRover (Agent-selected API calls)', | |
| 198 | - 'category': 'auto_code_rover', | |
| 199 | - 'message': ''' | |
| 194 | +2. `search_method_in_class("_call_eas", "PaiEasChatEndpoint")`""", | |
| 195 | + }, | |
| 196 | + { | |
| 197 | + "title": "AutoCodeRover (Agent-selected API calls)", | |
| 198 | + "category": "auto_code_rover", | |
| 199 | + "message": """ | |
| 200 | 200 | API calls: |
| 201 | 201 | |
| 202 | 202 | - `search_class('PaiEasChatEndpoint')` |
| 203 | 203 | |
| 204 | 204 | - `search_method_in_class('_call_eas', 'PaiEasChatEndpoint')` |
| 205 | - ''' | |
| 206 | - }, | |
| 207 | - { | |
| 208 | - 'title': 'AutoCodeRover (context retrieval round 0)', | |
| 209 | - 'category': 'auto_code_rover', | |
| 210 | - 'message': ''' | |
| 205 | + """, | |
| 206 | + }, | |
| 207 | + { | |
| 208 | + "title": "AutoCodeRover (context retrieval round 0)", | |
| 209 | + "category": "auto_code_rover", | |
| 210 | + "message": ''' | |
| 211 | 211 | Result of search_class('PaiEasChatEndpoint'): |
| 212 | 212 | |
| 213 | 213 | Found 1 classes with name PaiEasChatEndpoint in the codebase: |
| @@ -292,17 +292,17 @@ | ||
| 292 | 292 | |
| 293 | 293 | </code> |
| 294 | 294 | ``` |
| 295 | - ''' | |
| 296 | - }, | |
| 297 | - { | |
| 298 | - 'title': 'Context Retrieval Agent (round 0)', | |
| 299 | - 'category': 'auto_code_rover', | |
| 300 | - 'message': '''Let's analyze collected context first''' | |
| 301 | - }, | |
| 302 | - { | |
| 303 | - 'title': 'AutoCodeRover (context retrieval round 0)', | |
| 304 | - 'category': 'context_retrieval_agent', | |
| 305 | - 'message': '''Based on the search results, here is the analysis of the `PaiEasChatEndpoint` class and the `_call_eas` method: | |
| 295 | + ''', | |
| 296 | + }, | |
| 297 | + { | |
| 298 | + "title": "Context Retrieval Agent (round 0)", | |
| 299 | + "category": "auto_code_rover", | |
| 300 | + "message": """Let's analyze collected context first""", | |
| 301 | + }, | |
| 302 | + { | |
| 303 | + "title": "AutoCodeRover (context retrieval round 0)", | |
| 304 | + "category": "context_retrieval_agent", | |
| 305 | + "message": """Based on the search results, here is the analysis of the `PaiEasChatEndpoint` class and the `_call_eas` method: | |
| 306 | 306 | |
| 307 | 307 | 1. **PaiEasChatEndpoint Class**: |
| 308 | 308 | - The `PaiEasChatEndpoint` class is defined in the file `libs/community/langchain_community/chat_models/pai_eas_endpoint.py`. |
| @@ -317,19 +317,19 @@ | ||
| 317 | 317 | - If the request fails (status code other than 200), it raises an exception with the status code and response message. |
| 318 | 318 | - Currently, the method returns the response text as a `str`. |
| 319 | 319 | |
| 320 | -Based on this analysis, the issue is indeed related to the `_call_eas` method returning a `str` type instead of `bytes`, which leads to a type mismatch in the `_call` method. The fix involves modifying the `_call_eas` method to return `bytes` instead of `str`.''' | |
| 321 | - }, | |
| 322 | - { | |
| 323 | - 'title': 'AutoCodeRover (context retrieval round 0)', | |
| 324 | - 'category': 'auto_code_rover', | |
| 325 | - 'message': '''Based on your analysis, answer below questions: | |
| 320 | +Based on this analysis, the issue is indeed related to the `_call_eas` method returning a `str` type instead of `bytes`, which leads to a type mismatch in the `_call` method. The fix involves modifying the `_call_eas` method to return `bytes` instead of `str`.""", | |
| 321 | + }, | |
| 322 | + { | |
| 323 | + "title": "AutoCodeRover (context retrieval round 0)", | |
| 324 | + "category": "auto_code_rover", | |
| 325 | + "message": """Based on your analysis, answer below questions: | |
| 326 | 326 | - do we need more context: construct search API calls to get more context of the project. (leave it empty if you don't need more context) |
| 327 | -- where are bug locations: buggy files and methods. (leave it empty if you don't have enough information)''' | |
| 328 | - }, | |
| 329 | - { | |
| 330 | - 'title': 'AutoCodeRover (context retrieval round 0)', | |
| 331 | - 'category': 'auto_code_rover', | |
| 332 | - 'message': ''' | |
| 327 | +- where are bug locations: buggy files and methods. (leave it empty if you don't have enough information)""", | |
| 328 | + }, | |
| 329 | + { | |
| 330 | + "title": "AutoCodeRover (context retrieval round 0)", | |
| 331 | + "category": "auto_code_rover", | |
| 332 | + "message": """ | |
| 333 | 333 | Based on the files, classes, methods, and code statements from the issue related to the bug, you can use the following search APIs to get more context of the project. |
| 334 | 334 | - search_class(class_name: str): Search for a class in the codebase |
| 335 | 335 | - search_method_in_file(method_name: str, file_path: str): Search for a method in a given file |
| @@ -341,31 +341,31 @@ | ||
| 341 | 341 | Note that you can use multiple search APIs in one round. |
| 342 | 342 | |
| 343 | 343 | Now analyze the issue and select necessary APIs to get more context of the project. Each API call must have concrete arguments as inputs. |
| 344 | - ''' | |
| 345 | - }, | |
| 346 | - { | |
| 347 | - 'title': 'Context Retrieval Agent (round 1)', | |
| 348 | - 'category': 'context_retrieval_agent', | |
| 349 | - 'message': '''- **More Context**: | |
| 344 | + """, | |
| 345 | + }, | |
| 346 | + { | |
| 347 | + "title": "Context Retrieval Agent (round 1)", | |
| 348 | + "category": "context_retrieval_agent", | |
| 349 | + "message": """- **More Context**: | |
| 350 | 350 | - We have sufficient context to proceed with fixing the bug. No additional search API calls are needed at this point. |
| 351 | 351 | |
| 352 | 352 | - **Bug Locations**: |
| 353 | 353 | - Buggy File: `libs/community/langchain_community/chat_models/pai_eas_endpoint.py` |
| 354 | -- Buggy Method: `_call_eas` in the `PaiEasChatEndpoint` class''' | |
| 355 | - }, | |
| 356 | - { | |
| 357 | - 'title': 'AutoCodeRover (Agent-selected API calls)', | |
| 358 | - 'category': 'auto_code_rover', | |
| 359 | - 'message': ''' | |
| 354 | +- Buggy Method: `_call_eas` in the `PaiEasChatEndpoint` class""", | |
| 355 | + }, | |
| 356 | + { | |
| 357 | + "title": "AutoCodeRover (Agent-selected API calls)", | |
| 358 | + "category": "auto_code_rover", | |
| 359 | + "message": """ | |
| 360 | 360 | |
| 361 | 361 | Bug locations |
| 362 | 362 | |
| 363 | -- file: `libs/community/langchain_community/chat_models/pai_eas_endpoint.py`, class: `PaiEasChatEndpoint`, method: `_call_eas`''' | |
| 364 | - }, | |
| 365 | - { | |
| 366 | - 'title': 'AutoCodeRover (Patch generation round 1)', | |
| 367 | - 'category': 'auto_code_rover', | |
| 368 | - 'message': '''Here is the code in buggy locations: | |
| 363 | +- file: `libs/community/langchain_community/chat_models/pai_eas_endpoint.py`, class: `PaiEasChatEndpoint`, method: `_call_eas`""", | |
| 364 | + }, | |
| 365 | + { | |
| 366 | + "title": "AutoCodeRover (Patch generation round 1)", | |
| 367 | + "category": "auto_code_rover", | |
| 368 | + "message": '''Here is the code in buggy locations: | |
| 369 | 369 | |
| 370 | 370 | |
| 371 | 371 | |
| @@ -399,12 +399,12 @@ | ||
| 399 | 399 | |
| 400 | 400 | </code> |
| 401 | 401 | ``` |
| 402 | -''' | |
| 403 | - }, | |
| 404 | - { | |
| 405 | - 'title': 'AutoCodeRover (patch generation)', | |
| 406 | - 'category': 'auto_code_rover', | |
| 407 | - 'message': ''' | |
| 402 | +''', | |
| 403 | + }, | |
| 404 | + { | |
| 405 | + "title": "AutoCodeRover (patch generation)", | |
| 406 | + "category": "auto_code_rover", | |
| 407 | + "message": """ | |
| 408 | 408 | Write a patch for the issue, based on the retrieved context. |
| 409 | 409 | |
| 410 | 410 | You can import necessary libraries. |
| @@ -432,12 +432,12 @@ | ||
| 432 | 432 | |
| 433 | 433 | # modification 3 |
| 434 | 434 | ... |
| 435 | -```''' | |
| 436 | - }, | |
| 437 | - { | |
| 438 | - 'category': 'patch_generation', | |
| 439 | - 'title': 'Patch Generation (try 1 / 3)', | |
| 440 | - 'message': '''``` | |
| 435 | +```""", | |
| 436 | + }, | |
| 437 | + { | |
| 438 | + "category": "patch_generation", | |
| 439 | + "title": "Patch Generation (try 1 / 3)", | |
| 440 | + "message": '''``` | |
| 441 | 441 | # Patch for changing the return type of _call_eas method to bytes |
| 442 | 442 | |
| 443 | 443 | import requests |
| @@ -488,12 +488,12 @@ | ||
| 488 | 488 | |
| 489 | 489 | return response.content |
| 490 | 490 | </patched> |
| 491 | -```''' | |
| 492 | - }, | |
| 493 | - { | |
| 494 | - 'title': 'AutoCodeRover (extracted patch)', | |
| 495 | - 'category': 'auto_code_rover', | |
| 496 | - 'message': '''```diff | |
| 491 | +```''', | |
| 492 | + }, | |
| 493 | + { | |
| 494 | + "title": "AutoCodeRover (extracted patch)", | |
| 495 | + "category": "auto_code_rover", | |
| 496 | + "message": '''```diff | |
| 497 | 497 | diff --git a/libs/community/langchain_community/chat_models/pai_eas_endpoint.py b/libs/community/langchain_community/chat_models/pai_eas_endpoint.py |
| 498 | 498 | index e438ad25e..309c6d287 100644 |
| 499 | 499 | --- a/libs/community/langchain_community/chat_models/pai_eas_endpoint.py |
| @@ -517,17 +517,17 @@ | ||
| 517 | 517 | def _call_eas_stream(self, query_body: dict) -> Any: |
| 518 | 518 | """Generate text from the eas service.""" |
| 519 | 519 | |
| 520 | -```''' | |
| 521 | - }, | |
| 522 | - { | |
| 523 | - 'title': 'AutoCodeRover (patch generation try 1 / 3)', | |
| 524 | - 'category': 'auto_code_rover', | |
| 525 | - 'message': '''Extracted a patch. Since validation is disabled, you should validation the patch later on. Ending the workflow.''' | |
| 526 | - }, | |
| 527 | - ] | |
| 520 | +```''', | |
| 521 | + }, | |
| 522 | + { | |
| 523 | + "title": "AutoCodeRover (patch generation try 1 / 3)", | |
| 524 | + "category": "auto_code_rover", | |
| 525 | + "message": """Extracted a patch. Since validation is disabled, you should validation the patch later on. Ending the workflow.""", | |
| 526 | + }, | |
| 527 | +] | |
| 528 | + | |
| 528 | 529 | |
| 529 | 530 | def test_generate_data(callback): |
| 530 | 531 | for data in test_data: |
| 531 | 532 | callback(data) |
| 532 | 533 | time.sleep(1) |
| 533 | - |