Skip to content

Commit 263d372

Browse files
committed
refactor: replace parse_xml_content with parse_patch_blocks for improved patch processing
1 parent fa701f9 commit 263d372

1 file changed

Lines changed: 7 additions & 17 deletions

File tree

codetide/agents/tide/agent.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
AGENT_TIDE_SYSTEM_PROMPT, GET_CODE_IDENTIFIERS_SYSTEM_PROMPT, WRITE_PATCH_SYSTEM_PROMPT
55
)
66
from .consts import AGENT_TIDE_ASCII_ART
7-
from .utils import parse_xml_content
7+
from .utils import parse_patch_blocks
88

99
try:
1010
from aicore.llm import Llm
@@ -20,7 +20,6 @@
2020
from pydantic import BaseModel
2121
from typing import Optional
2222
from datetime import date
23-
from tqdm import tqdm
2423
import asyncio
2524
import os
2625

@@ -66,24 +65,15 @@ async def agent_loop(self):
6665
prefix_prompt=codeContext
6766
)
6867

69-
diffPatches = parse_xml_content(response, multiple=True)
68+
diffPatches = parse_patch_blocks(response, multiple=True)
7069
if diffPatches:
71-
diffPatches = [diffPatch.replace("\'", "'") for diffPatch in diffPatches]
72-
diffPatches = [diffPatch.replace('\"', '"') for diffPatch in diffPatches]
73-
for diffPatch in tqdm(diffPatches):
74-
process_patch(diffPatch, open_file, write_file, remove_file, file_exists)
70+
71+
for patch in diffPatches:
72+
patch = patch.replace("\'", "'").replace('\"', '"')
73+
process_patch(patch, open_file, write_file, remove_file, file_exists)
74+
7575

7676
await self.tide.check_for_updates(serialize=True, include_cached_ids=True)
77-
78-
# else:
79-
# response = await self.llm.acomplete(
80-
# self.history,
81-
# system_prompt=[
82-
# AGENT_TIDE_SYSTEM_PROMPT.format(DATE=TODAY),
83-
# ASSISTANT_SYSTEM_PROMPT.format(DATE=TODAY)
84-
# ],
85-
# prefix_prompt=repo_tree
86-
# )
8777

8878
self.history.append(response)
8979

0 commit comments

Comments
 (0)